Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

Repository files navigation

FSM LTD — Fire Extinguisher Management System

Microservices-based system for managing fire extinguishers, customer records, expiration tracking, and automated email notifications.

Tech Stack

  • 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)

Architecture

Next.js (3000) → API Gateway (4000)
                    ├── Auth Service (4001)
                    ├── Inventory Service (4002)
                    └── Notification Service (4003)
                              ↓
                         PostgreSQL

Prerequisites

  1. Node.js 20+ and pnpm
  2. PostgreSQL — local install or Docker (see below)

Option A: Docker PostgreSQL

docker compose up -d

Uses port 5433 (to avoid conflict with a local PostgreSQL on 5432):

postgresql://postgres:postgres@localhost:5433/fsm_db

Option B: Local PostgreSQL

CREATE DATABASE fsm_db;

Setup

1. Install dependencies

pnpm install

2. Configure environment

cp .env.example .env

Edit .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"

3. Run database migrations

pnpm db:push
pnpm db:generate

4. Start all services

pnpm dev

This starts:

Swagger API Docs

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

How to Test

Admin login

  1. Open http://localhost:3000/login
  2. Use credentials from .env (ADMIN_EMAIL / ADMIN_PASSWORD)
  3. Access admin dashboard, register customers/extinguishers, view reports

Customer signup + OTP

  1. Go to http://localhost:3000/signup
  2. Register a new customer
  3. Check the auth-service terminal for the OTP code (if SMTP is not configured)
  4. Enter OTP at http://localhost:3000/verify-otp
  5. Access customer dashboard

Trigger expiration job manually (dev)

curl -X POST http://localhost:4003/dev/run-expiration-job \
  -H "x-service-key: dev-service-key-change-me"

Optional: SMTP for real emails

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>"

Documentation

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)

Figma & wireframe

Project Structure

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

Features Checklist

  • 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages