How akene-uzezi/incident-tracker-backend works
Incident Tracker is a Go/Gin REST API used by two shared-session frontends. Clients enter through versioned routes, where authentication middleware protects selected operations; handlers validate and apply role/department rules, then invoke domain-specific PostgreSQL models. The principal workflows cover incident reporting and follow-up, death reporting with role-targeted notifications, and user authentication/administration. The tree and README identify additional API capabilities, but most handler-to-model wiring is not sampled, so those connections are limited to documented relationships.
Main entry points: routes.go API routes · deathreport.go Death report handlers · users.go User model · notifications.go Notification model
Components 18
API runtime
- HTTP server
cmd/server.go - API routes
cmd/routes.go - Auth middleware
cmd/middleware.go
Identity and access
- Auth handlers
cmd/auth.go - User handlers
cmd/users.go - User model
internal/db/users.go
Incident workflows
- Incident handlers
cmd/incidents.go - Comment handlers
cmd/comments.go - Management handlers
cmd/incidentmanagement.go - Incident model
internal/db/incidents.go - Comment model
internal/db/comments.go - Management model
internal/db/incidentmanagement.go
Death reports and alerts
- Death report handlers
cmd/deathreport.go - Death report model
internal/db/deathreporting.go - Notification handlers
cmd/notifications.go - Notification model
internal/db/notifications.go
Other components
- Next.js frontends
- PostgreSQL
Connections 24
- Next.js frontends → HTTP server: send requests
- HTTP server → API routes: uses handler
- API routes → Auth middleware: guards routes
- API routes → Auth handlers: dispatches auth
- API routes → User handlers: dispatches users
- API routes → Incident handlers: dispatches incidents
- API routes → Comment handlers: dispatches comments
- API routes → Management handlers: dispatches management
- API routes → Death report handlers: dispatches reports
- API routes → Notification handlers: dispatches alerts
- Auth handlers → User model: reads and writes
- User handlers → User model: reads and writes
- Incident handlers → Incident model: reads and writes
- Comment handlers → Comment model: reads and writes
- Management handlers → Management model: reads and writes
- Death report handlers → Death report model: reads and writes
- Death report handlers → Notification model: creates alerts
- Notification handlers → Notification model: reads and updates
- User model → PostgreSQL: queries
- Incident model → PostgreSQL: queries
- Comment model → PostgreSQL: queries
- Management model → PostgreSQL: queries
- Death report model → PostgreSQL: queries
- Notification model → PostgreSQL: queries