A FastAPI application with two main features:
- Item Management API: Create, update, delete items
- Item Browser API: Browse and search items
fastapi-items/
├── app/
│ ├── __init__.py
│ ├── main.py # Main FastAPI app
│ ├── data.py # Dummy data
│ ├── schemas.py # Pydantic models
│ ├── management/
│ │ ├── __init__.py
│ │ └── routes.py # Item management endpoints
│ └── browser/
│ ├── __init__.py
│ └── routes.py # Item browsing/search endpoints
├── requirements.txt
└── README.md
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt --only-binary greenlet
# Run server
python -m uvicorn app.main:app --reload --port 8000Note: The
--only-binary greenletflag is used to install pre-built greenlet binaries, which avoids compilation issues on macOS with missing Xcode developer tools.
GET /items- List all itemsPOST /items- Create new itemGET /items/{id}- Get item detailsPUT /items/{id}- Update itemDELETE /items/{id}- Delete item
GET /items- Browse all itemsGET /items/search?q=keyword- Search itemsGET /items/category?category=name- Filter by category
- API Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- This app uses passlib's
argon2for password hashing (strong, modern, and no 72-byte limit). - You can safely use long passphrases; no manual truncation is required.