Express + TypeScript + Prisma + Postgres + Redis.
- Authentication: JWT access/refresh tokens, bcrypt hashing.
- RBAC: Role-based access control (Admin, User).
- Payments: Stripe integration (subscriptions, webhooks).
- Security: Helmet, Rate Limiting, Input Sanitization, Zod Validation.
- Database: PostgreSQL (Prisma ORM).
- Caching: Redis.
- Production Ready: Dockerized, graceful shutdown, environment validation.
- Node.js (v18+)
- Docker & Docker Compose (optional, for containerized run)
- PostgreSQL (if running locally)
- Redis (if running locally)
Copy .env.example to .env and fill in the following:
| Variable | Description |
|---|---|
NODE_ENV |
development, production, test |
PORT |
API Port (default: 3000) |
DATABASE_URL |
PostgreSQL Connection String |
JWT_SECRET |
Secret for Access Tokens |
REFRESH_TOKEN_SECRET |
Secret for Refresh Tokens |
REDIS_URL |
Redis Connection String |
STRIPE_SECRET_KEY |
Stripe Secret Key |
STRIPE_WEBHOOK_SECRET |
Stripe Webhook Sign Secret |
Run the entire stack (API, Postgres, Redis) with one command:
docker compose up --build -dThe API will be available at http://localhost:3000.
To stop:
docker compose down-
Install dependencies:
npm install
-
Start Services: Ensure PostgreSQL and Redis are running.
-
Database Setup:
npx prisma migrate dev npx prisma db seed
-
Run Development Server:
npm run dev
To build and run without Docker:
npm run build
npm startGET /health- System StatusPOST /auth/register- User RegistrationPOST /auth/login- User LoginPOST /api/stripe/checkout- Create Subscription
See src/routes for full API definition.