How jahanzaibaslammehar/field-service-api works
Field Service API is a NestJS field-service backend: contractors register companies, invite employees, create inspection cases, attach media, and prepare priced offers using supplier catalogs and AI-assisted materials parsing. The public gateway authenticates and scopes HTTP requests, then routes them to three TCP services sharing PostgreSQL through Prisma. The graph preserves the documented catalog-import and billing/storage capabilities; unsampled internals are represented at their supported directory paths, and unverified integration links are dashed.
Main entry points: src HTTP API · cases-http.controller.ts Case routes · suppliers-http.controller.ts Supplier routes · auth.controller.ts Authentication service
Components 24
HTTP gateway
- HTTP API
apps/api-gateway/src - Auth routes
apps/api-gateway/src/auth/auth-http.controller.ts - Case routes
apps/api-gateway/src/cases/cases-http.controller.ts - Media routes
apps/api-gateway/src/media/media-http.controller.ts - Offer routes
apps/api-gateway/src/offers/offers-http.controller.ts - Supplier routes
apps/api-gateway/src/suppliers/suppliers-http.controller.ts - Auth RPC proxy
apps/api-gateway/src/auth/auth-proxy.service.ts - Cases RPC proxy
apps/api-gateway/src/cases/cases-proxy.service.ts
Identity and tenancy
- Authentication service
apps/authentication/src/auth/auth.controller.ts - Auth and tokens
apps/authentication/src/auth/services/auth.service.ts - Signup and invitations
apps/authentication/src/auth/services/signup.service.ts
Cases and offers
- Case management
apps/cases/src/cases/services/cases.service.ts - Materials parsing and quotes
apps/cases/src/materials - Offer management
apps/cases/src/offers/services/offers.service.ts - Media handling
apps/cases/src/media/services/media.service.ts
Supplier catalog
- Supplier catalog
apps/suppliers/src/suppliers/services/suppliers.service.ts - Catalog import
apps/suppliers/src/suppliers/catalog-import/services/catalog-import.service.ts - CSV parsing
apps/suppliers/src/suppliers/catalog-import/services/csv-parser.service.ts - Excel parsing
apps/suppliers/src/suppliers/catalog-import/services/excel-parser.service.ts
Shared capabilities
- PostgreSQL / Prisma
libs/shared/database/src/lib/prisma.service.ts - S3 storage
libs/shared/storage/src/lib/s3-storage.service.ts - Stripe billing
libs/billing/stripe/src/lib/stripe.service.ts
Other components
- Contractor
- LLM provider
Connections 25
- Contractor → HTTP API: sends HTTP
- HTTP API → Auth routes: routes auth
apps/api-gateway/src/auth/auth-http.controller.ts - HTTP API → Case routes: routes cases
apps/api-gateway/src/cases/cases-http.controller.ts - HTTP API → Media routes: routes media
apps/api-gateway/src/media/media-http.controller.ts - HTTP API → Offer routes: routes offers
apps/api-gateway/src/offers/offers-http.controller.ts - HTTP API → Supplier routes: routes suppliers
apps/api-gateway/src/suppliers/suppliers-http.controller.ts - Auth routes → Auth RPC proxy: calls proxy
apps/api-gateway/src/auth/auth-http.controller.ts - Case routes → Cases RPC proxy: calls proxy
apps/api-gateway/src/cases/cases-http.controller.ts - Auth RPC proxy → Authentication service: TCP RPC
- Cases RPC proxy → Case management: TCP RPC
- Supplier routes → Supplier catalog: TCP RPC
- Authentication service → Auth and tokens: dispatches login
apps/authentication/src/auth/auth.controller.ts - Authentication service → Signup and invitations: dispatches signup
apps/authentication/src/auth/auth.controller.ts - Auth and tokens → PostgreSQL / Prisma: reads and writes
apps/authentication/src/auth/services/auth.service.ts - Case management → PostgreSQL / Prisma: persists cases
- Case routes → Materials parsing and quotes: requests quote
apps/api-gateway/src/cases/cases-http.controller.ts - Materials parsing and quotes → LLM provider: parses text
- Offer routes → Offer management: TCP RPC
- Media routes → Media handling: TCP RPC
- Media handling → S3 storage: stores media
- Supplier routes → Catalog import: imports catalog
- Catalog import → CSV parsing: parses CSV
apps/suppliers/src/suppliers/catalog-import/services/csv-parser.service.ts - Excel parsing → CSV parsing: reuses parsing
apps/suppliers/src/suppliers/catalog-import/services/excel-parser.service.ts - Supplier catalog → PostgreSQL / Prisma: catalog data
- Signup and invitations → Stripe billing: creates billing