# FastAPI REST API Service A fully-featured REST API service built with FastAPI and SQLite. ## Features - RESTful API design - SQLite database with SQLAlchemy ORM - Database migrations with Alembic - Pydantic data validation - CRUD operations for items - Health check endpoint - API documentation with Swagger UI and ReDoc ## Project Structure ``` . ├── alembic.ini # Alembic configuration ├── app # Main application package │ ├── api # API endpoints │ │ ├── api.py # API router │ │ ├── deps.py # API dependencies │ │ └── endpoints # API endpoint modules │ │ └── items.py # Items endpoints │ ├── core # Core modules │ │ └── config.py # Application settings │ ├── crud # CRUD operations │ │ ├── base.py # Base CRUD class │ │ └── crud_item.py # Item CRUD operations │ ├── db # Database │ │ ├── base.py # Import all models for Alembic │ │ ├── base_class.py # Base model class │ │ ├── migrations # Alembic migrations │ │ └── session.py # Database session │ ├── models # SQLAlchemy models │ │ └── item.py # Item model │ └── schemas # Pydantic schemas │ └── item.py # Item schemas ├── main.py # Application entry point ├── pyproject.toml # Ruff linting configuration └── requirements.txt # Python dependencies ``` ## Setup 1. Clone the repository 2. Install the dependencies: ```bash pip install -r requirements.txt ``` 3. Run the application: ```bash uvicorn main:app --reload ``` ## API Endpoints - **GET /api/v1/items**: Get all items - **POST /api/v1/items**: Create a new item - **GET /api/v1/items/{id}**: Get a specific item - **PUT /api/v1/items/{id}**: Update a specific item - **DELETE /api/v1/items/{id}**: Delete a specific item - **GET /health**: Health check endpoint ## API Documentation API documentation is available at: - Swagger UI: `/docs` - ReDoc: `/redoc` ## Database The application uses SQLite as the database: - Database location: `/app/storage/db/db.sqlite` - Database models are defined in the `app/models` directory - Database migrations are managed with Alembic in the `app/db/migrations` directory ## Development - Code linting: `ruff check .` - Code formatting: `ruff format .` - Run migrations: `alembic upgrade head`