How kabirul/python-fastapi-postgresql-crud-example works
Project type and purpose
• This is a standalone backend microservice built with Python’s FastAPI framework.
• It exposes a RESTful CRUD API for managing “blogs” (notes), backed by a PostgreSQL database.
• It also auto-generates OpenAPI docs (Swagger at /docs, Redoc at /redoc).
File structure
• Top-level files:
• requirements.txt – Python dependencies (FastAPI, SQLAlchemy/Databases, Uvicorn, etc.).
• README.md – run instructions and endpoints.
• app/main.py – the FastAPI application instantiation and server setup.
• app/db.py – database connection, session management, Base model metadata.
• app/api/api.py – FastAPI router(s) registration.
• app/api/models/blog.py – ORM/Pydantic schemas for the Blog entity.
• app/api/crud/blog.py – data-access layer: create/read/update/delete operations.
• app/api/endpoints/blogs.py – HTTP endpoint handlers wiring routes to CRUD functions.
README for additional insights
• Shows the base API URL: http://localhost:8000/api/blogs.
• Mentions docs at /docs and /redoc.
• Launch via Uvicorn with hot-reload, single worker.