Where to Find Core Modules in the TREK Server Source Code

The core modules in the TREK server source code are located in the server/src/nest/ directory, with the root application module at server/src/nest/app.module.ts orchestrating 35+ domain-specific modules including Database, Weather, Trips, and Auth.

The TREK travel planning platform is built on a NestJS backend architecture. All core modules in the TREK server source code follow standard NestJS patterns, organized under server/src/nest/ with each feature domain encapsulated in its own folder containing controllers, services, and providers.

Root Module Configuration

The entry point that wires all core modules together is server/src/nest/app.module.ts. This root module imports every domain module required by the application:

@Module({
  imports: [
    DatabaseModule,
    WeatherModule,
    AirportsModule,
    ConfigModule,
    SystemNoticesModule,
    MapsModule,
    CategoriesModule,
    TagsModule,
    NotificationsModule,
    AtlasModule,
    VacayModule,
    PackingModule,
    BudgetModule,
    ReservationsModule,
    DaysModule,
    AssignmentsModule,
    PlacesModule,
    TripsModule,
    TodoModule,
    CollabModule,
    FilesModule,
    PhotosModule,
    MemoriesModule,
    AirtrailModule,
    JourneyModule,
    ShareModule,
    SettingsModule,
    BackupModule,
    BookingImportModule,
    AuthModule,
    OidcModule,
    OauthModule,
    AdminModule,
    AddonsModule,
  ],
})
export class AppModule {}

Each entry in the imports array references a module folder under server/src/nest/. For example, TripsModule resolves to server/src/nest/trips/trips.module.ts, while AuthModule maps to server/src/nest/auth/auth.module.ts.

Domain Module Structure

Core modules follow a consistent directory structure. Within each module folder, you will find the module definition file, controllers, services, and DTOs.

Infrastructure Modules

DatabaseModule (server/src/nest/database/database.module.ts) provides database connectivity, while ConfigModule (server/src/nest/config/config.module.ts) handles environment variable management. These foundational modules are imported first to ensure dependent modules have access to configuration and persistence layers.

Feature Modules

Travel-specific functionality is organized into dedicated modules:

Auth and Security Modules

Authentication and authorization are split across multiple modules:

Application Bootstrap

The server/src/bootstrap.ts file initializes the Nest application using NestFactory and wires global middleware:

import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { AppModule } from './nest/app.module';
import { applyGlobalMiddleware, applyPlatformUploads, applyPlatformTransport, applyPlatformStatic } from './middleware';

export async function buildApp() {
  const app = await NestFactory.create(AppModule, new ExpressAdapter());
  const express = app.getHttpAdapter().getInstance();

  applyGlobalMiddleware(express, { bodyParser: false });
  applyPlatformUploads(express);
  applyPlatformTransport(express);
  applyPlatformStatic(express);

  await app.init();
  return app;
}

This bootstrap function creates the Express instance, applies security headers and CORS via applyGlobalMiddleware, and registers platform-specific routes for file uploads and static assets before initializing the Nest container.

Accessing Services Across Modules

To utilize functionality from another core module, import the service directly from the module's directory. For example, accessing TripsService from within another module:

import { Injectable } from '@nestjs/common';
import { TripsService } from '../trips/trips.service';

@Injectable()
export class ExampleService {
  constructor(private readonly tripsService: TripsService) {}

  async listUserTrips(userId: string) {
    return this.tripsService.findAllForUser(userId);
  }
}

The TripsService implementation resides at server/src/nest/trips/trips.service.ts.

When adding new endpoints to existing modules, define controllers within the module's folder. For example, extending the WeatherModule:

import { Controller, Get } from '@nestjs/common';
import { WeatherService } from './weather.service';

@Controller('weather')
export class WeatherController {
  constructor(private readonly weather: WeatherService) {}

  @Get('ping')
  ping() {
    return { status: 'ok', time: new Date() };
  }
}

This controller would be defined in server/src/nest/weather/weather.controller.ts and registered within WeatherModule.

Summary

  • Core modules in the TREK server are located in server/src/nest/ according to the mauriceboe/TREK repository structure.
  • Root module at server/src/nest/app.module.ts imports 35+ domain modules including Database, Trips, Auth, and Weather.
  • Each module follows NestJS conventions with dedicated folders containing *.module.ts, controllers, services, and DTOs.
  • Bootstrap occurs in server/src/bootstrap.ts which creates the Express instance and applies global middleware before initializing the Nest application.
  • Cross-module dependencies are resolved via NestJS dependency injection by importing services from their respective module directories.

Frequently Asked Questions

What is the main entry point for TREK server modules?

The main entry point is server/src/nest/app.module.ts. This root module imports all 35+ core modules including DatabaseModule, TripsModule, and AuthModule, serving as the central registry that wires the entire application together according to the mauriceboe/TREK source code.

How are the TREK server modules organized?

Modules are organized by domain under server/src/nest/. Each module resides in its own folder (e.g., trips/, weather/, auth/) containing the module definition file, controllers, service implementations, and data transfer objects following standard NestJS architectural patterns.

Where is the TREK server application initialized?

The application is initialized in server/src/bootstrap.ts. This file uses NestFactory.create() with an Express adapter, applies global middleware for security and CORS, configures platform-specific uploads and static routes, and then calls app.init() to register all controllers and providers from the core modules.

How do I import a service from another core module?

Import the service class directly from the target module's directory. For example, import { TripsService } from '../trips/trips.service'. NestJS handles the dependency injection automatically when the consuming module is properly configured in the imports array of app.module.ts.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →