Microservices-based system for managing fire extinguishers, customer records, expiration tracking, and automated email notifications.
- Frontend: Next.js 14, TypeScript, Tailwind CSS
- Backend: NestJS (4 microservices + API gateway)
- Database: PostgreSQL + Prisma
- Auth: JWT
- Email: SMTP (optional — OTP/alerts also log to console in dev)
Next.js (3000) → API Gateway (4000)
├── Auth Service (4001)
├── Inventory Service (4002)
└── Notification Service (4003)
↓
PostgreSQL
- Node.js 20+ and pnpm
- PostgreSQL — local install or Docker (see below)
docker compose up -dUses port 5433 (to avoid conflict with a local PostgreSQL on 5432):
postgresql://postgres:postgres@localhost:5433/fsm_db
CREATE DATABASE fsm_db;pnpm installcp .env.example .envEdit .env and set your PostgreSQL connection:
DATABASE_URL="postgresql://postgres:YOUR_PASSWORD@localhost:5432/fsm_db?schema=public"Admin login is seeded from env (no signup form):
ADMIN_EMAIL="admin@fsm.local"
ADMIN_PASSWORD="Admin@123456"pnpm db:push
pnpm db:generatepnpm devThis starts:
- Web app → http://localhost:3000
- API Gateway → http://localhost:4000
- Auth Service → http://localhost:4001
- Inventory Service → http://localhost:4002
- Notification Service → http://localhost:4003
| Service | URL |
|---|---|
| Gateway | http://localhost:4000/docs |
| Auth | http://localhost:4001/api/docs |
| Inventory | http://localhost:4002/api/docs |
| Notifications | http://localhost:4003/api/docs |
- Open http://localhost:3000/login
- Use credentials from
.env(ADMIN_EMAIL/ADMIN_PASSWORD) - Access admin dashboard, register customers/extinguishers, view reports
- Go to http://localhost:3000/signup
- Register a new customer
- Check the auth-service terminal for the OTP code (if SMTP is not configured)
- Enter OTP at http://localhost:3000/verify-otp
- Access customer dashboard
curl -X POST http://localhost:4003/dev/run-expiration-job \
-H "x-service-key: dev-service-key-change-me"Set these in .env:
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"
SMTP_FROM="FSM LTD <your-email@gmail.com>"| Document | Description |
|---|---|
| docs/REQUIREMENTS.md | Functional requirements, data flows, forms |
| docs/architecture.md | Microservices architecture |
| docs/FIGMA_SIGNUP_SPEC.md | Figma signup mockup specification |
| DESIGN.md | UI/UX tokens (Linear-inspired, FSM light theme) |
- Build the signup mockup in Figma using
docs/FIGMA_SIGNUP_SPEC.md - Static HTML wireframe: http://localhost:3000/wireframes/signup.html (when web app is running)
FSM/
├── apps/
│ ├── web/ # Next.js frontend
│ ├── api-gateway/ # Single API entry point
│ ├── auth-service/ # Signup, login, JWT, OTP
│ ├── inventory-service/ # Customers, extinguishers, reports
│ └── notification-service/ # Email alerts + cron jobs
├── packages/
│ ├── database/ # Prisma schema + client
│ └── shared/ # Shared enums & pagination types
├── docs/
├── docker-compose.yml
└── .env.example
- User roles (Admin, Customer)
- Customer signup with email OTP verification
- Admin login (env-seeded, no signup)
- Customer & extinguisher registration
- Status auto-update (Active / Expiring Soon / Expired)
- Automated expiration email notifications
- Notification history for customers
- Follow-up flag for unrenewed expired extinguishers
- Admin reports with pagination
- Swagger documentation
- JWT auth, CORS, validation, structured logging