How tsvtok/machinecaire works
MachineCare is a REST API for industrial machine maintenance: authenticated users manage machine records and report, track, and resolve incidents. The main flow is HTTP routes through controllers to MongoDB models, with JWT protection on user and maintenance endpoints and centralized error responses. The README documents Swagger/OpenAPI alongside authentication, profiles, machine CRUD/history, and signalement lifecycle. The sampled code supports the main controller/model relationships; service files were only indexed, so their role is not inferred.
Main entry points: app.js Express app · user.js Profile routes · machine.js Machine routes · signalement.js Incident routes
Components 17
API entry
- Express app
src/app.js - Auth routes
src/routes/auth.js - Profile routes
src/routes/user.js - Machine routes
src/routes/machine.js - Incident routes
src/routes/signalement.js
Identity and access
- Authentication
src/controllers/authController.js - User profiles
src/controllers/userController.js - JWT guard
src/middlewares/auth.middleware.js
Maintenance domain
- Machine management
src/controllers/machineController.js - Incident lifecycle
src/controllers/signalementController.js
MongoDB records
- User records
src/models/User.js - Machine records
src/models/Machine.js - Incident records
src/models/Signalement.js - MongoDB
src/config/db.js
API support
- Error handling
src/middlewares/errorHandler.js - API documentation
src/docs/swagger.js
Other components
- API client
Connections 23
- API client → Express app: sends requests
README.md - Express app → Auth routes: mounts at auth
src/app.js - Express app → Profile routes: mounts at users
src/app.js - Express app → Machine routes: mounts at machines
src/app.js - Express app → Incident routes: mounts at signalements
src/app.js - Express app → MongoDB: connects
src/app.js - Express app → User records: checks admin
src/app.js - Express app → Error handling: handles errors
src/app.js - Express app → API documentation: serves docs
src/app.js - Auth routes → Authentication: dispatches
src/routes/auth.js - Profile routes → JWT guard: protects routes
src/routes/user.js - Profile routes → User profiles: dispatches
src/routes/user.js - Machine routes → JWT guard: protects routes
src/routes/machine.js - Machine routes → Machine management: dispatches
src/routes/machine.js - Incident routes → JWT guard: protects routes
src/routes/signalement.js - Incident routes → Incident lifecycle: dispatches
src/routes/signalement.js - Authentication → User records: creates and checks
src/controllers/authController.js - User profiles → User records: reads and updates
src/controllers/userController.js - Machine management → Machine records: manages records
src/controllers/machineController.js - Machine management → Incident records: checks incident links
src/controllers/machineController.js - Incident lifecycle → Incident records: manages lifecycle
src/controllers/signalementController.js - Incident lifecycle → Machine records: validates machine
src/controllers/signalementController.js - API client → Express app: views API docs
README.md