How skevo18/backend-projekt works
Main Components
• Frontend: A Vue 3 application (located in the frontend folder) with its own routing, components, and state management.
• Backend API: The FastAPI backend (in the backend directory) which includes:
• Main application entry point (main.py)
• Router modules handling different endpoints (authentication, page CRUD, email, etc.)
• Utility modules (e.g., mail functions)
• Database: Managed via SQLAlchemy with migration support from Alembic (within backend/db). Include components for:
• Database migration scripts (migrations directory)
• ORM definitions (e.g., orm.py)
• Docker & Deployment: Docker configuration files that define multiple services:
• Nginx (with its configuration files located in docker/nginx)
• A service running Uvicorn (or another webserver) for hosting FastAPI
• Containers for running PHP-FPM as required (as per the README, even if files are minimal, plan for it)
• MariaDB container for the database service
Relationships and Data Flow
• How the Frontend Vue application interacts with the Backend API via REST calls.
• That the Backend (FastAPI) interacts with the Database to perform CRUD operations and handle authentication.
• Docker container interactions:
• Nginx serves as a reverse proxy dispatching requests to the Uvicorn server.
• The Uvicorn server runs the FastAPI application.
• Database container (MariaDB) is used by the backend.
• (Include PHP-FPM container if applicable based on the Docker configuration.)
• Frontend → Backend: API calls (with authentication tokens exchanged via cookies)
• Backend → Database: ORM and migration-driven data operations
• Docker/Nginx → Uvicorn/Backend: Routing and load balancing
Architectural Patterns and Design Principles
• Separation of Concerns: The frontend and backend are clearly separated. The backend provides a RESTful API while the frontend consumes these services.
• Modular Design: Within the backend, routers and utilities are divided into their own modules (authentication, CRUD for various entities, etc.), and the database migrations are modular.
• Containerization: Docker is used to keep services isolated and replaceable, promoting a microservices-like architecture even within a monorepo setup.
• Security: Emphasis on authentication using HttpOnly cookies for token storage and safe handling of user input (e.g., sanitizing HTML inputs on the backend).
Incorporate Relevant Technologies and Tools
• Frontend: Vue 3, Vite (as seen in vite.config.js), and Typescript (noted with .ts files).
• Backend: FastAPI, Uvicorn (via Docker), SQLAlchemy 2.0, Alembic for migrations, and custom router modules.
• Deployment: Docker, Nginx, PHP-FPM configuration, and MariaDB.
• Version control and contribution guidelines (e.g., CONTRIBUTING.md, .gitignore, etc.) can be mentioned but are secondary to the core architectural components.
Specific Elements
• Clear labels for every component (e.g., “Vue 3 Frontend”, “FastAPI Backend”, “SQLAlchemy + Alembic”, “MariaDB Database”, “Nginx Reverse Proxy”, etc.).
• API calls from the frontend to the backend.
• Database queries from backend services to the database.
• Routing paths from Nginx to the appropriate container (Uvicorn/Backend).
Detailed Capture of Essential Elements
• Also, note external integrations like the SMTP service (for sending registration emails) and any external links (like Cloudflare suggestions) based on the README.
• Don’t omit details related to Docker setup, as many deployment and scalability aspects hinge upon container orchestration.