Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Python FastAPI Implementation

This is a FastAPI implementation of the Simple Social Media Application API.

Setup

  1. Create and activate virtual environment:

    uv venv .venv
    .venv\Scripts\activate  # Windows
  2. Install dependencies:

    uv pip install fastapi uvicorn sqlalchemy python-multipart

Running the Application

From the workspace root directory, activate the virtual environment and run:

python\.venv\Scripts\activate
uvicorn main:app --host 0.0.0.0 --port 8000 --reload

API Documentationc

Database

  • Uses SQLite database: sns_api.db (created in workspace root)
  • Database is automatically initialized on startup
  • Tables are created based on SQLAlchemy models

Features

  • ✅ All 12 API endpoints from OpenAPI specification
  • ✅ CORS enabled for all origins
  • ✅ SQLite database with automatic initialization
  • ✅ Swagger UI documentation
  • ✅ OpenAPI JSON specification
  • ✅ Input validation with Pydantic
  • ✅ Proper HTTP status codes
  • ✅ Error handling

Files

  • main.py - FastAPI application with all endpoints
  • models.py - SQLAlchemy database models
  • schemas.py - Pydantic schemas for request/response validation