
Features: - Project structure setup - Database configuration with SQLAlchemy - Item model and CRUD operations - API endpoints for items - Alembic migrations - Health check endpoint - Comprehensive documentation generated with BackendIM... (backend.im)
1.6 KiB
1.6 KiB
Generic REST API Service
A modern REST API service built with FastAPI and SQLite, providing a clean architecture and RESTful endpoints.
Features
- Fast and efficient API with FastAPI
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- Pydantic schemas for validation
- Health check endpoint
- Full CRUD operations for items
- OpenAPI documentation
Project Structure
.
├── app # Application package
│ ├── database.py # Database configuration
│ ├── models # SQLAlchemy models
│ ├── routes # API routes and endpoints
│ └── schemas # Pydantic schemas
├── migrations # Alembic migrations
├── alembic.ini # Alembic configuration
├── main.py # Application entry point
└── requirements.txt # Project dependencies
API Endpoints
GET /health
- Health check endpointGET /api/v1/items
- List all itemsGET /api/v1/items/{item_id}
- Get a specific itemPOST /api/v1/items
- Create a new itemPUT /api/v1/items/{item_id}
- Update an itemDELETE /api/v1/items/{item_id}
- Delete an item
API Documentation
Once the application is running, you can access the API documentation:
- Swagger UI -
/docs
- ReDoc -
/redoc
Development
Requirements
- Python 3.8+
- SQLite
Setup
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000.