Skip to content

Trojan-Dev-AFK/fastapi_application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Application

A minimal FastAPI app demonstrating CRUD, Pydantic models, custom exceptions, and rate limiting. Includes optional JWT auth and Dockerfile.

Run locally

python -m venv .venv
source .venv/bin/activate # or .\.venv\scripts\activate.ps1
pip install -r requirements.txt
uvicorn app.main:app --reload

Endpoints

Open -> http://127.0.0.1:8000/docs or http://127.0.0.1:8000/redoc

Rate Limiting

Global middleware: 5 requests / 60 seconds per IP. Exceeding returns 429 with { "detail": "Rate limit exceeded" }.

Tests

Automatic

Run below commands

cd fastapi_application
$env:TESTING="1"
pytest -v

Manual

  • Install API Dog -> https://apidog.com/download/.
  • Import collection json present inside apidog_collection folder into the application.
  • Make sure to add the access token (after using register and login endpoints) into the Auth section in collection folder settings.
  • Execute all the available test cases.

Docker

docker build -t fastapi_application .
docker run -p 8000:8000 fastapi_application