Docs / apps/api/README.md
Chimti API
Standalone Fastify + Prisma API for the Chimti platform.
This repo owns:
- PostgreSQL schema and migrations
- Authentication and sessions
- RBAC and tenant scope
- Customers, orders, items, articles, pickup workflow, payments, ads, audit logs
- Public order summary links
- API routes consumed by user web, admin web, customer web, and mobile apps
Local Setup
npm install
cp .env.example .env
docker compose up -d
npm run prisma:generate
npm run prisma:migrate
npm run db:seed
npm run dev
Default local API:
http://localhost:4010
Health check:
GET /v1/health
Production
Required environment variables:
NODE_ENV=production
HOST=0.0.0.0
PORT=4010
DATABASE_URL=postgresql://...
AUTH_TOKEN_SECRET=long-random-secret
AUTH_TOKEN_EXPIRES_IN=30d
CORS_ORIGIN=https://app.yourdomain.com,https://admin.yourdomain.com,https://customer.yourdomain.com
Coolify start command if using Nixpacks:
npm ci && npm run prisma:generate
npm run start:prod
If using the included Dockerfile, Coolify can build and run the image directly.
One-Time Founder User
FOUNDER_EMAIL=founder@yourdomain.com \
FOUNDER_PASSWORD='StrongPass@123' \
FOUNDER_NAME='Founder Name' \
npm run db:create-founder
API Prefix
All business routes live under:
/v1
Tenant scope headers:
x-brand-id: <brandId>
x-store-id: <storeId>