This is a FastAPI implementation of the Simple Social Media Application API.
-
Create and activate virtual environment:
uv venv .venv .venv\Scripts\activate # Windows
-
Install dependencies:
uv pip install fastapi uvicorn sqlalchemy python-multipart
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- Swagger UI: http://localhost:8000/docs
- OpenAPI JSON: http://localhost:8000/openapi.json
- ReDoc: http://localhost:8000/redoc
- ReDoc: http://localhost:8000/redoc
- Uses SQLite database:
sns_api.db(created in workspace root) - Database is automatically initialized on startup
- Tables are created based on SQLAlchemy models
- ✅ 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
main.py- FastAPI application with all endpointsmodels.py- SQLAlchemy database modelsschemas.py- Pydantic schemas for request/response validation