How djneill/apartment_portal works
Main Components
a. Client-side (Frontend):
• React Application (in the “frontend” directory)
• Key modules: Pages (AdminDashboard, TenantDashboard, etc.), components (form components, navigation, cards, modals, etc.), services (axios-based API service, auth services), hooks (global state providers)
b. Server-side (Backend API):
• .NET API (in the “apartment_portal_api” directory)
• Controllers handling various resources: Users, Guests, Issues, LeaseAgreements, Notifications, Packages, Units, Statuses, Insights, etc.
• Abstractions and Interfaces (IRepository and IUnitOfWork) to enforce the repository pattern.
• Data Access Layer: Context (“PostgresContext”), repositories, migrations for entity changes
• Domain Models for business entities (Users, Units, Issues, LeaseAgreements, etc.)
• Services like AIService and auxiliary services such as AccessCodeGenerator and EmailValidator.
c. Database:
• Although not explicitly named, the migrations and context suggest a relational database (likely PostgreSQL) managed via Entity Framework migrations.
d. External Integrations:
• SSL certificate generation for secure HTTPS connections
• Possibly external AI/ML services integrated through the AIService.
Relationships and Interactions
• The Frontend communicates with the Backend using RESTful API calls via axios.
• The API controllers receive requests and delegate business logic to services and repositories.
• The Repository and UnitOfWork patterns encapsulate data access operations, interacting with the database (model changes are captured via migrations).
• The business logic is distributed between Controllers, Services (such as AIService), and Models.
• There exist clear boundaries between the presentation layer (frontend), business logic (backend controllers and services), and data/storage layer (database via EF migrations).
Important Architectural Patterns and Technologies
• MVC (or a variant) structure for the backend with Controllers, Models, and Services/Repositories.
• Repository pattern and UnitOfWork for data access.
• Separation of concerns between API and frontend.
• Use of environment configuration (.env files in the frontend) and secure HTTPS local development (certificate generation).
• For the frontend, modern React practices leveraging hooks and component-based architecture.
• Vite is used as the development/build tool in the frontend.
• Use clear labels for each component (e.g., “TenantDashboard (React Page)”, “UserController”, “IssueRepository”, “Postgres Database”).
• Frontend → Backend (HTTP/HTTPS calls)
• Within Backend: Controller → Service → Repository → Database.
• Rectangles for frontend components,
• Rounded rectangles or containers for backend controllers/services,
• Notes for external dependencies and configuration elements (e.g., SSL certificate setup note on the environment side).