TREK Server Dependencies: Complete Package Guide for Running the TREK Server
The TREK server requires 32 production dependencies including NestJS 11, better-sqlite3 for database operations, and specialized libraries for authentication, file handling, and WebSocket support, all declared in server/package.json.
The TREK server is a NestJS-based TypeScript application located in the mauriceboe/TREK repository. Understanding the dependencies for running the TREK server is essential for local development and deployment, as these packages provide everything from database connectivity to real-time communication. All runtime libraries are listed under the dependencies field in server/package.json and are imported throughout the codebase in server/src.
Core Framework Dependencies
The server architecture relies on the NestJS ecosystem. According to server/package.json, the core framework packages include:
@nestjs/common(^11.1.24) – Provides decorators, exception filters, and pipes@nestjs/core(^11.1.24) – Handles the dependency injection container and module resolution@nestjs/platform-express(^11.1.24) – Integrates Express as the underlying HTTP server
These packages work alongside express (^4.18.3), reflect-metadata (^0.2.2) for decorator metadata, and rxjs (^7.8.2) for reactive streams. The application bootstrap in server/src/index.ts wires these together to create the HTTP server instance.
Database and Authentication Libraries
Database
The TREK server uses better-sqlite3 (^12.8.0) for fast, synchronous SQLite database operations. This dependency is heavily utilized in server/src/services/tripService.ts for trip management and data persistence.
Authentication and Security
The authentication system implemented in server/src/services/authService.ts relies on multiple specialized packages:
@simplewebauthn/server(^13.1.2) – WebAuthn server-side functionalitybcryptjs(^2.4.3) – Password hashingjsonwebtoken(^9.0.2) – JWT token generation and verificationotplib(^12.0.1) – 2FA/TOTP generation@modelcontextprotocol/sdk(^1.28.0) – Model Context Protocol integration
Security middleware includes helmet (^8.1.0) for HTTP headers, cors (^2.8.5) for cross-origin requests, compression (^1.8.0) for response compression, and cookie-parser (^1.4.7).
HTTP Utilities and Real-Time Communication
Beyond Express, the server employs undici (^7.0.0) for HTTP requests, as demonstrated in server/src/services/weatherService.ts. Real-time features use ws (^8.21.0) for WebSocket support. Additional networking utilities include fast-xml-parser (^5.5.10) for XML processing and dotenv (^16.4.1) for environment configuration.
File Processing and Utility Libraries
For file operations and data manipulation, the TREK server includes:
archiver(^6.0.1) andunzipper(^0.12.3) – ZIP file creation and extractionjimp(^1.6.1) – Image processing and manipulationqrcode(^1.5.4) – QR code generationuuid(^14.0.0) – UUID generationzod(^4.3.6) – Schema validation and type checking
Supporting utilities include node-cron (^4.2.1) for scheduled tasks, nodemailer (^9.0.1) for email transmission, and semver (^7.7.4) for version management.
Build Tools and Workspace References
The server includes TypeScript compilation tools: typescript (^6.0.2), tsx (^4.21.0) for TypeScript execution, and tsconfig-paths (^4.2.0) for path mapping. The workspace also references @trek/shared (*), a local workspace package for shared types and utilities.
Installing TREK Server Dependencies
To install all dependencies for running the TREK server, execute the following from the repository root:
# Install all dependencies (npm, pnpm, or yarn)
npm install
# Build the server workspace specifically
npm run build --workspace=server
# Start development server with hot-reloading
npm run dev
This process reads the dependencies field from server/package.json and installs all 32 packages required for the application to function.
Summary
- The TREK server depends on 32 production packages defined in
server/package.json - NestJS 11 (
@nestjs/*) provides the core framework with Express as the underlying HTTP server - better-sqlite3 handles all database operations for trip management and user data
- Authentication combines WebAuthn, bcryptjs, jsonwebtoken, and otplib for multi-factor security
- File processing relies on archiver, unzipper, and jimp for ZIP and image operations
- Real-time features use ws for WebSocket connections and undici for HTTP client requests
Frequently Asked Questions
Does the TREK server require a specific Node.js version?
The TREK server uses modern TypeScript and NestJS 11 features alongside native modules like better-sqlite3. While the package.json does not explicitly specify an engines constraint, the dependencies—including tsx (^4.21.0) for TypeScript execution—typically require Node.js 18 or higher for full compatibility and optimal performance.
How does the TREK server handle environment configuration?
The server uses dotenv (^16.4.1) to load environment variables from .env files at runtime. This allows the application to configure database paths, JWT secrets, and external API keys without hardcoding sensitive values into the source code in server/src/index.ts and the various service implementations.
What database does the TREK server use and why?
The TREK server uses better-sqlite3 (^12.8.0), a high-performance SQLite3 driver for Node.js. This dependency provides synchronous, fast database operations suitable for the server's trip management features implemented in server/src/services/tripService.ts, eliminating the need for a separate database server setup while maintaining ACID compliance.
Can I run the TREK server without installing all dependencies?
No. The TREK server is a NestJS application that imports modules from all listed dependencies at runtime. Attempting to start the server without running npm install will result in MODULE_NOT_FOUND errors. All 32 packages—including @modelcontextprotocol/sdk for MCP integration and @simplewebauthn/server for passkey authentication—are required for full functionality as implemented in the service layer.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →