How nguyenhoangviethung/apartment-management works
Project Overview and Type
• This is a full‐stack apartment management application with a mobile UI built in Flutter and a backend built using Flask.
• The app is designed to manage apartment aspects such as authentication, fee management, residents, rooms, payments, and news/notifications.
Main Components
A. Frontend (Mobile and Web – Flutter)
• Flutter Mobile Application: Displays multiple screens such as authentication (login, register, password reset), home/dashboard, management panels for fees, residents, rooms, vehicles, notifications, and payment interfaces (integration with vnpay).
• Support for Web (optional) and platform-specific directories for Android and iOS.
• UI Layer: Organized under "frontend/lib/view" that separates authentication, home, and management related screens.
• Utilizes models (e.g., account_info, contribution_fee_info, etc.) and services (fetching data from backend endpoints).
B. Backend (Flask API)
• API Layer: Found under "backend/api" with submodules for admin, auth, news, pay, and user.
• Admin Endpoints: Administrative tasks (e.g., dashboard management).
• Auth Endpoints: Authentication processes.
• News Module: Handles news, crawling, data extraction, and testing.
• Payment Endpoints: Implements payment logic likely coordinating with vnpay.
• User Endpoints: Manages user-related functionalities.
• Middleware and Extensions: Custom middlewares (e.g., authentication, logging), and extensions that enhance or configure Flask’s capabilities.
• Services Layer: Contains business logic split into various service files (e.g., fee_service, resident_service, transaction_service). They encapsulate integration with external services like Cloudinary (via cloudinary_service) and possibly handle fee contributions, household data, etc.
• Models and Database: The "backend/models" directory includes SQL initialization scripts (init.sql) and a schema defined in models.py.
• External Integrations: Payment integration (“vnpay” directory) and cloud-related media service using Cloudinary.
C. Supporting Components:
• Configuration files (backend/config.py, environment.yml, requirements.txt) for setting up the environment.
• Deployment and CI artifacts, such as GitHub workflows in backend/github/workflows.
• Static assets for API documentation or front-facing content (swagger.yaml, styles.css, transaction_success.html).
Relationships and Interactions
• Frontend sends HTTP(S) requests (RESTful API calls) to the Flask backend.
• The Backend API layer handles client requests and routes them to the appropriate controllers (e.g., auth, user, news, payment).
• Business logic in the Services layer processes the requests and communicates with the Database (models) for persistent data storage.
• External Services: The backend interacts with third-party services (e.g., payment system via vnpay, Cloudinary for media management).
• Middleware applies common logic across requests before hitting the endpoint logic (e.g., user authentication, logging, error handling).
Architectural Patterns and Design Principles
• Separation of Concerns: Clear separation between API routing, business logic (services), and data access (models).
• Modularization: Both backend and frontend are organized into modules (e.g., multiple API submodules and distinct Flutter views/services).
• Client-Server Interaction: The Flutter frontend communicates asynchronously with the Flask backend via RESTful endpoints.
• Integration with External Services: Payment processing (vnpay) and cloud storage (Cloudinary) are encapsulated in service classes.