Standalone NestJS REST API for the Transport Management System.
-
Install dependencies:
pnpm install
-
Set up environment:
cp .env.example .env # Edit .env with your configuration -
Generate Prisma Client:
pnpm prisma:generate
-
Run database migrations:
pnpm prisma:migrate
-
Start development server:
pnpm dev
The API will be available at http://localhost:3001 (or the port in .env).
All routes are prefixed with /api:
GET /api/health- Health checkGET /api/tenants- List user's tenants (requires auth)GET /api/auth/me- Get current user/tenant (requires auth + X-Tenant-Id header)GET /api/transport/orders- List transport ordersPOST /api/transport/orders- Create transport orderGET /api/transport/trips- List tripsPOST /api/transport/trips- Create trip- And more...
See .env.example for required environment variables.
Required:
DATABASE_URL- PostgreSQL connection stringSUPABASE_PROJECT_URLorSUPABASE_PROJECT_REF- Supabase project referenceSUPABASE_SERVICE_ROLE_KEY- Supabase service role key
Optional:
PORT- Server port (default: 3001)WEB_APP_URL- Frontend URL for CORS (default: http://localhost:3000)
pnpm dev- Start development server with hot reloadpnpm build- Build for productionpnpm start:prod- Run production buildpnpm prisma:generate- Generate Prisma Clientpnpm prisma:migrate- Run database migrationspnpm prisma:migrate:deploy- Deploy migrations (production)pnpm prisma:studio- Open Prisma Studiopnpm prisma:seed- Seed database (requires SUPABASE_USER_EMAIL env var)
_export_api/
├── prisma/ # Prisma schema and migrations
│ ├── schema.prisma
│ ├── migrations/
│ └── seed.ts
├── src/ # NestJS application source
│ ├── auth/ # Authentication module
│ ├── health/ # Health check module
│ ├── tenants/ # Tenant management
│ ├── transport/ # Transport business logic
│ ├── prisma/ # Prisma service/module
│ ├── app.module.ts
│ └── main.ts # Application entry point
├── .env.example # Environment variables template
├── nest-cli.json # NestJS CLI configuration
├── package.json # Dependencies and scripts
└── tsconfig.json # TypeScript configuration
See MIGRATION_INSTRUCTIONS.md for detailed instructions on moving this code to a new repository.
Private - Internal use only.