How din-esh-kumar/synergy works
Purpose and entry points
This is a full-stack project-management/issue-tracking system with authentication, users, projects, issues, and periodic updates. The backend is a TypeScript HTTP API started through backend/src/server.ts, which builds the application in backend/src/app.ts. The frontend is a Vite React SPA bootstrapped by frontend/src/main.tsx, rooted at frontend/src/App.tsx, and routed through frontend/src/router.tsx.
Frontend application shell and state
The SPA provides application-wide authentication and theme state via frontend/src/context/AuthContext.tsx and frontend/src/context/ThemeContext.tsx. Feature hooks such as frontend/src/hooks/useIssues.ts, frontend/src/hooks/useProjects.ts, and frontend/src/hooks/useUsers.ts connect UI state to API-backed domain data. Routing is the main frontend control boundary: authenticated views should consume auth context rather than independently managing credentials.
API client and feature service boundary
Frontend network access is centralized in frontend/src/services/api.ts. Domain-specific services—frontend/src/services/auth.service.ts, frontend/src/services/issue.service.ts, frontend/src/services/project.service.ts, and frontend/src/services/updates.service.ts—encapsulate endpoint calls and isolate components/hooks from HTTP details. Shared API/domain contracts are represented by paths including frontend/src/types/auth.types.ts, frontend/src/types/issue.types.ts, and frontend/src/types/project.types.ts.
Backend HTTP composition
backend/src/app.ts composes middleware and route modules; backend/src/server.ts owns process startup. API capability is partitioned by route/controller pairs: authentication (backend/src/routes/auth.routes.ts, backend/src/controllers/auth.controller.ts), projects (backend/src/routes/project.routes.ts, backend/src/controllers/project.controller.ts), issues (backend/src/routes/issue.routes.ts, backend/src/controllers/issue.controller.ts), and updates (backend/src/routes/updates.routes.ts, backend/src/controllers/updates.controller.ts). Controllers are the request-to-domain/persistence boundary.
Authentication, authorization, and request protection
Auth uses JWT support in backend/src/utils/jwt.ts, enforced by backend/src/middleware/auth.middleware.ts. Role-based access is a separate policy layer in backend/src/middleware/role.middleware.ts; input validation and uniform failure handling are provided by backend/src/middleware/validators.ts and backend/src/middleware/errorHandler.ts. Requests therefore flow from route matching through authentication/authorization/validation into controllers, with errors returning through centralized middleware.
Persistence and domain model
The backend has database initialization in backend/src/config/database.ts and model definitions under backend/src/config/, including backend/src/config/User.model.ts, backend/src/config/Project.model.ts, backend/src/config/Issue.model.ts, plus Task, Team, Settings, AuditLog, DailyUpdate, and WeeklyUpdate models. A parallel backend/src/models/ set (backend/src/models/User.model.ts, backend/src/models/Project.model.ts, backend/src/models/Issue.model.ts, backend/src/models/Update.model.ts) suggests controller-facing domain model imports may be distinct from—or duplicative of—configured persistence schemas; this is an important ownership boundary to resolve before extending data flows.
External infrastructure
The system requires a configured backend database connection and environment values in backend/.env; frontend runtime endpoint configuration is in frontend/.env. backend/src/utils/s3.ts indicates an Amazon S3 integration, likely for object/file storage, and should remain behind this utility boundary rather than being called directly from controllers or frontend code.
Main entry points: App.tsx Application shell · issue.service.ts Domain API services · auth.middleware.ts Request protection · issue.controller.ts Domain controllers
Components 18
React SPA
- SPA bootstrap
frontend/src/main.tsx - Application shell
frontend/src/App.tsx - Route boundary · Authenticated views consume shared auth state.
frontend/src/router.tsx - Auth and theme state
frontend/src/context/AuthContext.tsx - Domain data hooks · Issues, projects, and users UI state.
frontend/src/hooks/useIssues.ts - Domain API services · Auth, issue, project, and update endpoint wrappers.
frontend/src/services/issue.service.ts - HTTP client
frontend/src/services/api.ts - Frontend contracts · Auth, issue, and project API/domain contracts.
frontend/src/types/issue.types.ts
HTTP API
- API process startup
backend/src/server.ts - HTTP application · Composes middleware and route modules.
backend/src/app.ts - Capability routes · Auth, project, issue, and update route matching.
backend/src/routes/auth.routes.ts - Request protection · JWT auth, role policy, validation, and centralized errors.
backend/src/middleware/auth.middleware.ts - Domain controllers · Auth, project, issue, and update request boundary.
backend/src/controllers/issue.controller.ts - JWT utility
backend/src/utils/jwt.ts - Object storage · Storage remains behind the utility boundary.
backend/src/utils/s3.ts
Persistence
- Database connection
backend/src/config/database.ts - Configured schemas · User, project, issue, task, team, settings, audit, and update schemas.
backend/src/config/Issue.model.ts - Controller-facing models · Parallel model set; ownership versus configured schemas needs resolution.
backend/src/models/Issue.model.ts
Connections 17
- SPA bootstrap → Application shell: mounts
- Application shell → Route boundary: renders
- Application shell → Auth and theme state: provides
- Route boundary → Domain data hooks: drives views
- Domain data hooks → Domain API services: loads and mutates
- Domain API services → HTTP client: uses
- Domain API services → Frontend contracts: uses contracts
- HTTP client → HTTP application: HTTP API
- API process startup → HTTP application: starts
- HTTP application → Capability routes: mounts
- Capability routes → Request protection: applies
- Request protection → JWT utility: verifies tokens
- Request protection → Domain controllers: authorizes and validates
- Domain controllers → Controller-facing models: uses
- Controller-facing models → Configured schemas: parallel ownership
- Configured schemas → Database connection: connects through
- Domain controllers → Object storage: file storage