How senqi-666/fastapi-vue-admin works
Main Components
• Backend API Server – Highlight its layered structure:
• API layer (FastAPI routes grouped under “api/system/…” for auth, dept, menu, etc.)
• Core functionality (configuration, database connections, middlewares, security, logging)
• Business logic (services in “services/system/…”) and CRUD operations (under “crud/system/…”)
• Data models and schemas (organized in “models/”, “schemas/system/…”)
• Initialization scripts (for seeding the database)
• Frontend Client – Represent the Vue application:
• Components, layouts, and views (in “web/src/components”, “layouts”, “views”)
• API integrations (in “web/src/api/…”)
• Routing, state management (using Vue Router and Vuex/store)
• Infrastructure Components:
• Database (PostgreSQL as configured in “app/core/config.py”)
• Caching/Session store (Redis)
• API Documentation (Swagger UI, with static assets in “backend/app/static/swagger”)
• External dependencies such as authentication using JWT and OAuth2
• Inside the backend block, illustrate the separation:
• The API endpoints layer that communicates with the service layer.
• The service layer (handling business logic) which interacts with the CRUD and database layers.
• A connection line between the service/CRUD layers and the Database & Redis.
• Optionally, include a separate element for API documentation (Swagger/Redoc) that the frontend developers might use.
Architectural Patterns and Design Principles
• Separation of concerns within the backend layers:
• The use of controllers (FastAPI endpoints), services, and data access (CRUD, models).
• RBAC design that informs how services and CRUD operations handle permissions.
• For the frontend, note the component-based architecture of Vue3 (components, layouts, routing, state management).
• Integration of third-party libraries (Pydantic for data validation, SQLAlchemy for ORM, and Ant Design Vue for UI components).
Relevant Technologies and Frameworks
• Backend: FastAPI, SQLAlchemy 2.0, Pydantic, Swagger, Python (≥3.10).
• Frontend: Vue3, Ant Design Vue, TypeScript, Vite, NodeJS (≥20).
• Infrastructure: PostgreSQL and Redis.
• Incoming HTTP requests to FastAPI.
• API calls from the Vue frontend to backend endpoints.
• Rectangle for physical components (servers, databases).
• Rounded rectangles or circles for logical layers (API, services).
• Annotations where necessary (like “RBAC Logic”, “Authentication (JWT + OAuth2)”) to emphasize key aspects.
• Be sure to include initialization scripts and static API docs since they contribute to the project’s operability.
• The Frontend layer (Vue3) with its API integrations, routing, and state management.
• The Backend layer subdivided into API (routes, middlewares), Business (services & RBAC), Data (CRUD models, schemas), and configuration.
• Infrastructure elements such as PostgreSQL, Redis, and API documentation interfaces.