How mohamedsaid5/fci-graduation-renting-system-api works
Project Type and Purpose
• This is a full-stack apartment rental platform with:
• A Django REST Framework backend (in the RentingSystem/, accounts/, apartments/ directories)
• A React single-page frontend (in Renting-System-Frontend/)
• A lightweight SQLite database (in db.sqlite3) for development
• Media storage for user avatars and apartment photos
• Optional mobile client integration (Flutter demo)
File Structure Analysis
• Top‐level directories:
• accounts/ – Custom user model, authentication endpoints, tokens, password reset
• apartments/ – Apartment CRUD, photo uploads, filters, saved apartments
• RentingSystem/ – Django settings (settings.py), URL routing, WSGI/ASGI
• Renting-System-Frontend/ – React app with components, context, hooks, assets
• media/ – Uploaded files (avatars, apartment_photos)
• locale/ – Translation files (Arabic/English)
• Config & scripts:
• requirements.txt – Python dependencies
• package.json (backend and frontend) – npm dependencies
• manage.py – Django CLI entry point
• server.js – Local Express server to serve React assets (if used)
README‐Derived Insights
• REST API documented via Swagger/ReDoc at /api/docs/
• Token‐based auth for all protected endpoints
• CORS enabled for mobile and web clients
• Multilingual support using Django’s i18n
a. Main Components:
1. React Frontend (SPA)
2. Django REST API Backend
3. Relational Database (SQLite in dev / pluggable to Postgres for production)
4. Media Storage (file system or S3 in production)
5. External Services:
– Email provider for password resets
– (Optionally) CDN for static assets
– Third‐party map or payment APIs (if extended)
6. Mobile Client (Flutter) – optional
b. Relationships & Data Flows:
– The React SPA interacts with the Django API over HTTPS (HTTP calls to /api/*).
– The API reads/writes to the database and saves media files to disk or external object storage.
– The API uses token‐based authentication; tokens are stored in the React app’s localStorage.
– Email service is invoked by the API (e.g., for password reset).
– CORS configuration allows both web and mobile origins.
c. Architectural Patterns & Principles:
– Separation of Concerns: UI layer (React) vs. business/data layer (Django).
– MVC-ish layering in Django (Models in models.py, Serializers, Views, URLs).
– Context & hooks for global state in React (src/context/Auth.jsx, src/hooks/useAuth.jsx).
– RESTful resource design: /api/auth/, /api/apartments/, /api/profile/, etc.
– Pagination, filtering, internationalization built into DRF.
– Token‐based stateless authentication.
d. Technology Stack Callouts:
– Frontend: React, React Router (public/private routes), Context API, Fetch helpers
– Backend: Django 5.0, Django REST Framework, Django translations, DRF auto-docs
– Database: SQLite (dev), swappable to Postgres in production
– Media: Django MEDIA_ROOT for avatars & photos
– Build & Deployment: npm/yarn for frontend, python manage.py for backend