How razgrom47/ticketsystem works
Project Type and Purpose
• This is a full-stack ticket management system (“TicketSystem”) combining a Java Spring Boot backend (REST API) and a Next.js/React frontend.
• Purpose: allow users to sign in (JWT-based auth), create/edit tickets and messages, upload files, and receive email notifications.
Key Components & Directory Structure
• Frontend (src/frontend):
• Next.js app (pages in src/app) with React components, hooks, context for JWT auth, UI theming & settings.
• Auth flow: sign-in, change-password, route guards, context provider.
• Ticket and User sections: pages, forms, filters, tables.
• Backend (src/main/java/com/ticketsystem/griffins):
• Controllers: UserController, TicketController, MessageController, FileController, SessionController.
• Services & Repositories: for users, tickets, messages, files, sessions, JWT management, email notifications.
• Entity/DTO layers modeling database tables.
• Session/filter: JwtFilter handles token validation.
• Flyway DB migrations (src/main/resources/db/migration).
• Database & Infra:
• PostgreSQL (ticketsystem DB) managed via Flyway.
• Email service connects to SMTP.
• Configuration in application.properties.
Relationships & Data Flow
• Browser ↔ Next.js frontend:
• User interacts with pages/components.
• Frontend calls backend REST endpoints (via axios utility).
• JWT stored in cookies/local storage; used in Authorization header.
• Next.js ↔ Spring Boot API:
• Authentication endpoints (/session).
• Ticket endpoints (/tickets), Message endpoints (/messages), File endpoints (/files), User endpoints (/users).
• File uploads/downloads.
• API ↔ Database:
• Spring Data JPA repositories read/write PostgreSQL tables.
• Flyway applies migrations on startup.
• API ↔ External Services:
• EmailService sends notifications via SMTP.
Architectural Patterns & Principles
• Frontend: Component-based UI, Context API for auth/settings, Route guards for role-based access, Next.js SSR/SSG.
• Backend: Layered MVC (Controller → Service → Repository), DTO mapping, JWT filter for stateless auth, Flyway for migrations.
• Clear separation of concerns: auth, tickets, messages, files, sessions each in own package.
Final Advice
• How JWT flows from login to protected endpoints.
• Don’t omit Flyway or file-upload interactions.