TranslogiX uses PostgreSQL as its database and Drizzle ORM for schema management and queries. This page covers starting the database, applying the schema, seeding initial data, and opening the visual Drizzle Studio GUI.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fatelessdev/translogiX/llms.txt
Use this file to discover all available pages before exploring further.
Connection string
TheDATABASE_URL environment variable must be set before running any database commands or starting the application:
Starting the database with Docker Compose
The repository ships with adocker-compose.yml that starts a PostgreSQL 16 container pre-configured for TranslogiX.
Start the container
From the project root, run:The
-d flag runs the container in the background. Docker will pull the postgres:16 image on first run.Docker Compose service details
| Setting | Value |
|---|---|
| Service name | postgres |
| Container name | translogix-postgres |
| Image | postgres:16 |
| Exposed port | 5432 |
| Database name | translogix |
| Username | postgres |
| Password | postgres |
| Data volume | pgdata (persisted across restarts) |
Data is stored in a named Docker volume called
pgdata. Stopping the container with docker compose down preserves your data. Add the -v flag (docker compose down -v) only if you want to wipe the volume and start fresh.Drizzle scripts
The following npm scripts manage the database schema and data. Run them from the project root with your.env file in place.
db:push — sync schema without migrations
Compares the current schema in lib/db/schema.ts against the live database and applies any differences directly. Useful during active development when you do not need a migration history.
db:migrate — run migration files
Applies pending SQL migration files from the drizzle/ output directory in order. Use this in CI pipelines and production deployments to apply schema changes safely.
db:seed — seed initial data
Runs scripts/seed.ts using tsx to populate the database with initial records. Run this once after the schema has been applied to get a working dataset.
db:studio — open Drizzle Studio
Starts the Drizzle Studio web GUI, which lets you browse tables, inspect rows, and run queries through a browser interface.
https://local.drizzle.studio by default.
Schema overview
The schema is defined inlib/db/schema.ts and covers the following tables:
| Table | Purpose |
|---|---|
users | Application users with role (ADMIN, TRANSPORTER, DRIVER, CUSTOMER) |
sessions | BetterAuth session records |
accounts | BetterAuth account/credential records |
verifications | BetterAuth email verification tokens |
transporters | Transporter companies |
vehicles | Vehicles belonging to transporters (TRUCK, DUMPER, VAN, OTHER) |
routes | Named routes with distance, estimated time, and billing rates |
shipments | Shipment records linking transporters, vehicles, and routes |
tracking_updates | GPS location updates for in-transit shipments |