How b0llu/stories-backend works
Project type and purpose
• This is a backend-only, RESTful API service built with FastAPI.
• Its primary role is to provide CRUD operations for “stories” along with user authentication and management.
• Key use cases: user signup/login, creating/updating/deleting stories, listing stories, handling media uploads via Cloudinary.
File structure
• Top-level:
• alembic/ & alembic.ini – database migration tooling (SQLAlchemy + Alembic)
• app/ – main application code
• run.py – entry point that boots the FastAPI server
• requirements.txt – Python dependencies
• app/ submodules:
• main.py – creates FastAPI instance, attaches routers and middleware
• database.py – session/engine setup for PostgreSQL
• models.py & schemas.py – SQLAlchemy models and Pydantic schemas
• routers/ – REST endpoints grouped by domain (auth, users, stories)
• auth/ – authentication logic, JWT handling (in utils.py)
• middleware/ – request-level middleware (auth enforcement)
• utils/cloudinary.py – wrapper around Cloudinary for media uploads
README for additional insights
• Tech stack: Python 3.8+, FastAPI, PostgreSQL, SQLAlchemy, Alembic, Pydantic, Cloudinary.
• Runtime: run.py launches Uvicorn/Starlette server with auto-docs at /docs and /redoc.
• Database workflow: Alembic for versioned migrations invoked via CLI.
Detail but avoid over-segmenting
• Related routers under a single “API Endpoints” block if desired, but call out auth vs. stories vs. users.
• Both persistent state (DB) and external state (Cloudinary).
• Offline migration process distinctly from the live request flow.