Backend Folder Structure - FEUP-MEIC-DS-2025-26/madeinportugal.store GitHub Wiki

🚀 Backend Folder Structure

1. Overview

The backend folder is setup with the following structure:

backend/
├── requirements.txt
└── app/
    ├── main.py                   # FastAPI application entry point
    ├── api/
    │   ├── __init__.py
    │   └── routes.py             # API endpoints
    ├── clients/
    │   ├── __init__.py
    │   └── jumpseller_client.py  # Jumpseller API client
    ├── core/
    │   ├── __init__.py
    │   └── config.py             # Configuration management
    └── services/
        ├── __init__.py
        └── dashboard_service.py  # Business logic

2. Individual summary

Below are short explanations for the main backend files and folders shown above.

  • requirements.txt — Python dependencies required for the backend (FastAPI, uvicorn, httpx, sqlmodel, etc.).

  • app/main.py — FastAPI application entry: sets up middleware (CORS), mounts routers, serves the built frontend if present, and defines startup hooks such as DB initialization.

  • app/db.py — Database helpers (create tables, session provider). Provides get_session() dependency used by API endpoints.

  • app/api/ — API route modules. Important files:

    • routes.py — dashboard aggregation and health endpoints (e.g., GET /api/dashboard).
    • vendors.py — vendor registration endpoints (e.g., POST /api/vendors/register, listing, status updates).
  • app/clients/ — External API clients and HTTP wrappers:

    • jumpseller_client.py — client for calling the Jumpseller API (orders, products, store info). Abstracts HTTP calls and error handling.
  • app/core/ — Core configuration and settings:

    • config.py — application settings (env var loading, app name, debug flags, API keys). Uses pydantic-settings or dotenv.
  • app/models/ — Data models and schemas used by the backend:

    • vendor.pySQLModel models and Pydantic schemas for vendor requests (VendorRequest, VendorRequestCreate, VendorRequestUpdate, etc.).
  • app/services/ — Business logic and services that orchestrate data and clients:

    • dashboard_service.py — Aggregates data from the jumpseller_client (orders, products, store info) and shapes payloads for the frontend.