How srushtionlinedev/globaliotplatform.backend works
This is an Express/MySQL backend for a customer-scoped IoT platform. The main workflow registers customers and their initial owner, role, permissions, and login account; users then log in for a JWT and use it on protected APIs such as current-user lookup and product creation. Health checks are a separate capability. The README also describes schema and seed management, represented here as database structure rather than a deployment pipeline. Authentication and product call paths are supported by excerpts; some secondary repository details and the health call chain are supported only by the SOURCE INDEX.
Main entry points: auth.service.js Auth workflows · product.service.js Product workflow · server.js Express server · database.js MySQL pool
Components 24
HTTP API
- Express server
server.js - Auth routes
src/routes/auth.routes.js - Auth controller
src/controllers/auth.controller.js - Auth validation
src/dto/auth - Health routes
src/routes/health.routes.js - Health controller
src/controllers/health.controller.js - Health service
src/services/health.service.js - Product routes
src/routes/product.routes.js - Product controller
src/controllers/product.controller.js - Product validation
src/dto/product/create-product.dto.js
Identity & Access
- JWT middleware
src/middleware/auth.middleware.js - JWT utility
src/utils/jwt.util.js - JWT configuration
src/config/jwt.js - Auth workflows
src/services/auth.service.js
Product Management
- Product workflow
src/services/product.service.js
Persistence
- Identity repositories
src/repositories/auth - Customer repository
src/repositories/customer/customer.repository.js - User repository
src/repositories/user/user.repository.js - MySQL pool
src/config/database.js - Health repository
src/repositories/health.repository.js - Product repository
src/repositories/product/product.repository.js - MySQL schema
database/schema - Reference seeds
database/seed
Other components
- API client
Connections 29
- API client → Express server: sends requests
README.md - Express server → Auth routes: mounts auth
server.js - Express server → Health routes: mounts health
server.js - Express server → Product routes: mounts products
server.js - Auth routes → Auth controller: dispatches
src/routes/auth.routes.js - Auth controller → Auth validation: validates with
src/controllers/auth.controller.js - Auth controller → Auth workflows: invokes
src/controllers/auth.controller.js - Auth routes → JWT middleware: protects current-user
src/routes/auth.routes.js - JWT middleware → JWT utility: verifies token
src/middleware/auth.middleware.js - JWT utility → JWT configuration: uses settings
src/utils/jwt.util.js - Auth workflows → JWT utility: generates token
src/services/auth.service.js - Auth workflows → MySQL pool: gets connections
src/services/auth.service.js - Auth workflows → Identity repositories: calls identity stores
src/services/auth.service.js - Auth workflows → Customer repository: creates customer
src/services/auth.service.js - Auth workflows → User repository: creates and reads user
src/services/auth.service.js - Health routes → Health controller: dispatches
src/routes/health.routes.js - Health controller → Health service: invokes
src/controllers/health.controller.js - Health service → Health repository: calls
src/services/health.service.js - Health repository → MySQL pool: queries
src/repositories/health.repository.js - Product routes → JWT middleware: protects creation
src/routes/product.routes.js - Product routes → Product controller: dispatches
src/routes/product.routes.js - Product controller → Product validation: validates with
src/controllers/product.controller.js - Product controller → Product workflow: invokes
src/controllers/product.controller.js - Product workflow → MySQL pool: gets connections
src/services/product.service.js - Product workflow → Customer repository: looks up customer
src/services/product.service.js - Product workflow → User repository: looks up user
src/services/product.service.js - Product workflow → Product repository: creates product
src/services/product.service.js - MySQL schema → MySQL pool: defines tables for
README.md - Reference seeds → MySQL schema: initializes reference data
README.md