How renzomedina/realestate-api works
Project type and purpose
• This is a standalone, monolithic RESTful API (no bundled frontend) whose sole responsibility is exposing CRUD operations for real estate properties.
• Built with FastAPI (Python), it handles authentication via JWT, validates payloads with Pydantic, persists data in a relational database, and auto-documents endpoints with OpenAPI/Swagger. It’s containerized and uses GitHub Actions for CI/CD.
File structure
• Top-level CI config:
• .github/workflows/api-ci.yml → GitHub Actions pipeline (lint, test, build, push)
• App code:
• src/app.js (entry point for the FastAPI server – despite “.js”, README indicates Python; treat as the main application module)
• Tests:
• test/app.test.js → Pytest or Jest tests for endpoint coverage
• Package management:
• package.json / package-lock.json → dependencies, scripts (start, test, dockerize)
• Missing but implied:
• Dockerfile, requirements.txt / Pipfile (README calls for pip install -r requirements.txt)
README for additional insights
• Features: JWT auth, Pydantic validation, relational DB, Swagger auto-docs, Dockerized, GitHub Actions, pytest
• Tech stack: FastAPI, GitHub Actions
• Endpoints: /api/estates (GET, POST, PUT, DELETE)
Main components and interactions
a. Components:
• Clients (Web app / Mobile app / CURL)
• API Layer (FastAPI server)
– Routers (endpoints under /api/estates)
– Controllers/Services (business logic)
– Models (Pydantic schemas)
– Auth Module (JWT issuance & verification)
• Persistence Layer
– Relational Database (e.g., PostgreSQL)
– ORM or direct SQL driver
• Support Services
– Swagger/OpenAPI UI
– Docker Container & Image Registry
– CI/CD Pipeline (GitHub Actions)
b. Interactions:
1. Client → HTTP request → FastAPI router
2. Router → Auth middleware → verify JWT (or issue on login)
3. Controller/Service → Pydantic validation → prepare DB query
4. Service → Database connector → SQL operations
5. Database → returns data → Service → formats response → Client
6. CI/CD system → on git push → run tests → build Docker image → push to registry → deploy
c. Architectural patterns / principles:
• Layered architecture (Presentation/Controller → Service → Repository → DB)
• Modular design (separate auth, validation, business logic)
• 12-factor app approach (config via env vars, separate build and run)
d. Key technologies:
• FastAPI (ASGI web server)
• Pydantic (data validation)
• Uvicorn / Gunicorn (ASGI server)
• PostgreSQL (relational DB)
• Docker (containerization)
• GitHub Actions (CI/CD)
• Pytest (automated testing)
Key reminders
• Be exhaustive: break the service down into routers, middleware, services, repositories.
• External dependencies (DB, container registry, CI server).