Skip to main content

Getting Started

This guide will help you set up your development environment and get True Life running locally.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js 22+ - Download
  • pnpm 10+ - Install with npm install -g pnpm
  • Docker - For MongoDB and observability stack
  • FiveM Server - For running the game server

Installation

1. Clone the Repository

git clone https://github.com/true-life/true_life.git
cd true_life

2. Install Dependencies

pnpm install

3. Start Infrastructure

Start MongoDB (required):

docker compose up -d mongo

Optionally, start the full observability stack:

docker compose up -d otel-collector tempo loki grafana

4. Generate Assets

pnpm gen

5. Start Development

Start all development servers:

pnpm dev

This runs three processes in parallel:

  • Client build - Rollup watching src/ for client changes
  • Server build - Rollup watching src/ for server changes
  • UI dev server - Vite dev server at http://127.0.0.1:3000

Development Commands

CommandDescription
pnpm devFull dev environment (client + server + UI)
pnpm dev:clientClient build only with watch
pnpm dev:serverServer build only with watch
pnpm dev:uiUI dev server only
pnpm buildProduction build (all targets)
pnpm typecheckType check runtime code
pnpm lintESLint + typecheck
pnpm formatFormat with Prettier
pnpm testRun UI tests

Project Configuration

Environment Variables

Create a .env file in the project root:

# MongoDB
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=changeme

# Grafana (optional)
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=admin

FiveM Server Configuration

Add to your server.cfg:

# Development mode
set dev_mode "true"
set dev_features "" # Empty = load all modules

# MongoDB connection
set mongodb_uri "mongodb://admin:changeme@localhost:27017"
set mongodb_database "true_life"

# OpenTelemetry (optional)
set otel_enabled "true"
set otel_endpoint "http://localhost:4318"

Accessing Services

ServiceURLDescription
UI Dev Serverhttp://127.0.0.1:3000Vite HMR dev server
Grafanahttp://localhost:3001Dashboards and traces
Prometheushttp://localhost:9090Metrics
Live Maphttp://localhost:3002Interactive player map
Documentationhttp://localhost:3003This documentation

Next Steps