What Programming Language Is the TREK Server Written In?

The TREK server is written in TypeScript and runs on the Node.js runtime, utilizing the NestJS framework to handle HTTP requests and API routing.

The repository mauriceboe/TREK implements its server-side logic entirely in TypeScript, with all source files residing under the server/src/ directory. According to the source code, the codebase compiles TypeScript (.ts) files into JavaScript at build time, confirming a modern Node.js architecture designed for type safety and scalability.

TypeScript and Node.js Architecture

The TREK server leverages TypeScript as its primary programming language, executed on the Node.js runtime. This combination provides static typing during development while maintaining the performance characteristics of JavaScript in production.

The project uses NestJS, a progressive Node.js framework, to structure the application using decorators and modules. You can see this pattern in the dependency imports and class decorators throughout the server/src/ directory.

Evidence from the Source Code

Package Dependencies

The server/package.json file explicitly declares TypeScript as a core dependency:

  • "typescript": "^6.0.2" is listed in the dependencies, confirming the TypeScript compiler requirement.
  • "tsx": "^4.21.0" provides the TypeScript execution environment for development.
  • The workspace configuration designates the server directory as the primary server package.

This configuration file serves as the definitive source for the project's programming language stack.

Application Entry Points

Two critical TypeScript files handle application initialization:

  1. server/src/index.ts – The primary entry point that imports the NestJS framework and initiates the HTTP server.
  2. server/src/bootstrap.ts – A dedicated bootstrap module that instantiates the NestJS application and wires middleware.

Both files use the .ts extension and import from @nestjs/common, confirming they are TypeScript modules rather than plain JavaScript.

Build Pipeline and Compilation

The project employs a TypeScript-first build process:

  • Type checking: Runs tsc --noEmit to validate types without generating files.
  • Development execution: Uses tsx to run TypeScript directly in watch mode.
  • Production compilation: Transpiles TypeScript to JavaScript for deployment.

This pipeline confirms that TypeScript is not just for type definitions but is the actual source language of the server.

Key Server Files

The following files demonstrate the TypeScript implementation:

Practical Code Examples

Starting the Development Server

To run the TypeScript server in watch mode:


# From the repository root

npm run dev

This command uses the tsx runner to execute TypeScript without pre-compilation, enabling rapid development.

NestJS Controller Implementation

The HealthController in server/src/health/health.controller.ts illustrates the TypeScript decorator pattern:

import { Controller, Get } from '@nestjs/common';

@Controller('health')
export class HealthController {
  @Get()
  healthCheck() {
    return { status: 'OK', version: process.env.APP_VERSION };
  }
}

This controller uses TypeScript decorators (@Controller, @Get) provided by the NestJS framework.

Testing the Running API

Once the server is running, verify the TypeScript implementation is responding:

curl http://localhost:3001/api/health

# → {"status":"OK","version":"3.1.2"}

Summary

  • The TREK server is written in TypeScript, not plain JavaScript, providing compile-time type safety.
  • It runs on the Node.js runtime and uses the NestJS framework for API routing and dependency injection.
  • All server source files live in server/src/ and use the .ts extension.
  • The build pipeline uses TypeScript ^6.0.2 and tsx ^4.21.0 for development and compilation.
  • Entry points server/src/index.ts and server/src/bootstrap.ts handle application initialization using NestJS patterns.

Frequently Asked Questions

Is the TREK server written in JavaScript or TypeScript?

The TREK server is written in TypeScript. While it runs on the Node.js JavaScript runtime, all source files in server/src/ use the .ts extension and are compiled from TypeScript to JavaScript during the build process.

What framework does the TREK server use?

The server uses NestJS, a progressive Node.js framework. This is evident from the @nestjs/common imports in server/src/index.ts and the decorator-based controller pattern found in files like server/src/health/health.controller.ts.

Where are the server source files located?

All server-side source code resides in the server/src/ directory. Key files include server/src/index.ts (entry point), server/src/bootstrap.ts (application initialization), and server/src/nest/app.module.ts (root module configuration).

How is the TypeScript code compiled for production?

The project uses the TypeScript compiler (tsc) for type checking and tsx for development execution. The server/package.json specifies "typescript": "^6.0.2" and the build scripts handle the transpilation from TypeScript to JavaScript for deployment.

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 →