How n0pashkov/ticket-system works
Project Overview & Components
• Project Type: This is a full-stack application for managing repair tickets in a school. The backend is built with FastAPI and uses SQLAlchemy for database operations, while the frontend is developed using a React-based structure.
• Main Components:
• Backend API Server: Located under the “app” directory. It includes modules for API endpoints (handling tickets, users, comments, attachments, notifications, etc.), core configuration/security, database connections, and models/schemas.
• Database: Uses SQLite in development and PostgreSQL in production. Connection and configuration details exist in the “app/db” section.
• Frontend: Found in the “ticket-system-frontend” directory. It holds the React components (pages, hooks, context providers) that interact with the backend.
• Migrations & Configuration: Alembic is used for migrations (files in the “alembic” directory) and configuration files (e.g., alembic.ini, .env).
• Auxiliary Scripts: Scripts like “run.py”, “start_app.bat” and others ensure proper startup, network checking etc.
Architectural Patterns and Design Principles
• MVC-like Pattern on the Backend:
• Controllers (API endpoints) invoke services and interact with models.
• “Schemas” (using Pydantic) for data validation and response modeling.
• Separation of Concerns:
• Frontend is completely separated from the Backend by REST API boundaries.
• Environment configuration is separated using the .env file.
• Security:
• JWT-based authentication is centralized in the “app/core/security.py”.
• Extensibility:
• The modular structure (multiple endpoint files) facilitates extension like adding notifications or integration with other systems.
Technology & Frameworks
• Backend: FastAPI, SQLAlchemy, Pydantic, Alembic.
• Frontend: React (create-react-app structure) with context (AuthContext), custom hooks and components.
• Database: SQLite (development) and PostgreSQL (production).
• Testing: Pytest for backend, with tests configured in pytest.ini.
• Optional: Docker components if demonstrating containerized deployment.