How adittyyaa/ticketing_sys_pv works
Purpose and deployment shape
PV Advisory is a customer-support ticketing system split into a Next.js frontend and a Node.js API backend. Development entry points are the root scripts in package.json; service runtimes are frontend/package.json (port 3000) and backend/server.js (port 3001). Docker support exists in frontend/Dockerfile and backend/Dockerfile.
Frontend application shell and routing
The frontend uses Next.js App Router. Global composition begins in frontend/src/app/layout.tsx, with the primary landing surface at frontend/src/app/page.tsx. Auth, ticket inbox/detail/create, solutions, and administration are route-level boundaries:
• frontend/src/app/auth/page.tsx
• frontend/src/app/tickets/page.tsx
• frontend/src/app/tickets/[id]/page.tsx
• frontend/src/app/admin/overview/page.tsx
Authenticated UI is organized around reusable shell components in frontend/src/components/layout/AppShell.tsx, frontend/src/components/layout/Sidebar.tsx, and frontend/src/components/layout/TopBar.tsx.
Client state, session lifecycle, and API boundary
Frontend services isolate HTTP access to the backend: frontend/src/services/api.ts, frontend/src/services/authService.ts, and frontend/src/services/ticketService.ts. Auth initialization and inactivity logout are provider-level concerns in frontend/src/components/providers/AuthInitProvider.tsx and frontend/src/components/providers/InactivityLogoutProvider.tsx, with consumer hooks in frontend/src/hooks/useAuth.ts.
Control flow is UI route/component → feature service/API client → backend REST route. Theme and local UI persistence remain client-side through frontend/src/contexts/ThemeContext.tsx and frontend/src/hooks/useLocalStorage.ts.
Ticketing and knowledge-management UI
Tickets are the dominant workflow: browse/filter via frontend/src/components/features/tickets/TicketInboxView.tsx and frontend/src/components/features/tickets/TicketFilterDrawer.tsx; inspect ticket records through frontend/src/components/features/tickets/CommentsSection.tsx and frontend/src/components/features/tickets/AttachmentsSection.tsx. The separate solutions area is exposed at frontend/src/app/solutions/page.tsx and calls frontend/src/services/solutionService.ts. Feedback is a parallel user-facing workflow through frontend/src/services/feedbackService.ts and frontend/src/components/modals/FeedbackModal.tsx.
Backend HTTP pipeline
backend/server.js is the API process entry point. It composes route registration from backend/routes/index.js, which partitions the REST surface into auth, tickets, solutions, feedback, and administration:
• backend/routes/auth.js
• backend/routes/tickets.js
• backend/routes/admin.js
Cross-cutting request boundaries are middleware for authentication, validation, security/CORS, logging, and failure handling: backend/middleware/auth.js, backend/middleware/validation.js, and backend/middleware/errorHandler.js. Thus the expected flow is request → middleware → route/controller → service → model/database → response.
Backend domain and persistence layers
Controllers adapt HTTP operations into domain services, notably backend/controllers/ticketController.js, backend/controllers/authController.js, and backend/controllers/solutionController.js. Services centralize ticket, comment, authentication, user, feedback, and solution operations in backend/services/ticketService.js, backend/services/commentService.js, and backend/services/authService.js.
Persistence is PostgreSQL-backed per the project documentation. Connection/configuration boundaries are backend/config/database.js and backend/lib/database.js. Core relational/domain records include backend/models/Ticket.js, backend/models/User.js, backend/models/Comment.js, plus attachments, categories, tags, ticket types, custom statuses, feedback, and solutions.
Operations and infrastructure
The system expects PostgreSQL and optionally PgAdmin alongside the two application services. Database bootstrap and production/schema operations are represented by backend/scripts/setup-production-db.js, backend/scripts/verify-schema.js, and backend/utils/database-setup-postgresql.sql. Backend performance work includes SQL changes in backend/performance-fixes.sql, monitoring in backend/performance-monitor.js, and caching infrastructure in backend/utils/cache.js.
Main entry points: page.tsx Auth, ticket and admin routes · api.ts API client and feature services · ticketService.js Ticketing domain services · layout.tsx App entry and landing
Components 20
Next.js frontend
- App entry and landing
frontend/src/app/layout.tsx - Auth, ticket and admin routes · Route-level boundaries for authentication, ticket workflows, and administration.
frontend/src/app/tickets/page.tsx - Authenticated app shell
frontend/src/components/layout/AppShell.tsx - Session lifecycle · Initializes authentication and enforces inactivity logout.
frontend/src/components/providers/AuthInitProvider.tsx - API client and feature services · Isolates backend access for auth, tickets, solutions, and feedback.
frontend/src/services/api.ts - Ticket inbox and detail UI · Supports filtering, comments, and attachments.
frontend/src/components/features/tickets/TicketInboxView.tsx - Solutions and feedback UI
frontend/src/app/solutions/page.tsx - Frontend container
frontend/Dockerfile
Node.js API
- API process
backend/server.js - REST route registry · Partitions auth, tickets, solutions, feedback, and administration endpoints.
backend/routes/index.js - Request middleware · Applies authentication, validation, security, logging, and error handling.
backend/middleware/auth.js - HTTP controllers · Adapts REST operations into domain service calls.
backend/controllers/ticketController.js - Ticketing domain services · Centralizes ticket, comment, authentication, user, feedback, and solution operations.
backend/services/ticketService.js - Relational domain models · Includes tickets, users, comments, attachments, taxonomy, feedback, and solutions.
backend/models/Ticket.js - Backend container
backend/Dockerfile
Data and operations
- Database access
backend/config/database.js - PostgreSQL
- Cache infrastructure
backend/utils/cache.js - Schema bootstrap and verification · Supports production setup and schema verification.
backend/scripts/setup-production-db.js - Performance monitoring · Pairs SQL performance fixes with runtime monitoring.
backend/performance-monitor.js
Connections 21
- App entry and landing → Auth, ticket and admin routes: renders routes
- Auth, ticket and admin routes → Authenticated app shell: uses
- App entry and landing → Session lifecycle: initializes
- Auth, ticket and admin routes → Ticket inbox and detail UI: hosts ticket workflow
- Auth, ticket and admin routes → Solutions and feedback UI: hosts knowledge workflow
- Ticket inbox and detail UI → API client and feature services: calls
- Solutions and feedback UI → API client and feature services: calls
- Session lifecycle → API client and feature services: manages session through
- API client and feature services → API process: REST requests
- API process → REST route registry: registers
- REST route registry → Request middleware: passes through
- Request middleware → HTTP controllers: authorizes and validates
- HTTP controllers → Ticketing domain services: invokes
- Ticketing domain services → Relational domain models: uses
- Relational domain models → Database access: persists through
- Database access → PostgreSQL: connects to
- Ticketing domain services → Cache infrastructure: uses
- Schema bootstrap and verification → PostgreSQL: initializes and verifies
- Performance monitoring → PostgreSQL: monitors and tunes
- Frontend container → App entry and landing: packages
- Backend container → API process: packages