# REST API Service A RESTful API service built with FastAPI and SQLite. ## Features - FastAPI framework for efficient API development - SQLite database for data storage - Alembic for database migrations - Pydantic for data validation - SQLAlchemy ORM for database interactions - OpenAPI documentation (Swagger UI and ReDoc) - Health endpoint for application monitoring ## Project Structure ``` . ├── alembic.ini # Alembic configuration ├── app/ # Application package │ ├── api/ # API endpoints │ │ ├── endpoints/ # Route handlers │ │ └── api.py # API router │ ├── core/ # Core modules │ │ └── config.py # Application settings │ ├── db/ # Database modules │ │ ├── base.py # Import all models for Alembic │ │ ├── base_class.py # SQLAlchemy Base class │ │ └── session.py # Database session management │ ├── models/ # SQLAlchemy models │ ├── schemas/ # Pydantic schemas │ └── services/ # Business logic ├── main.py # Application entry point ├── migrations/ # Alembic migrations │ └── versions/ # Migration scripts ├── requirements.txt # Project dependencies └── tests/ # Test modules ``` ## API Endpoints - `/api/v1/users` - User CRUD operations - `/api/v1/items` - Item CRUD operations - `/health` - Health check endpoint - `/docs` - Swagger UI documentation - `/redoc` - ReDoc documentation ## Installation 1. Clone the repository: ```bash git clone https://github.com/yourusername/restapiservice.git cd restapiservice ``` 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Run database migrations: ```bash alembic upgrade head ``` 4. Start the server: ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000. ## Development ### Database Migrations To create a new migration after modifying models: ```bash alembic revision --autogenerate -m "Description of changes" ``` To apply migrations: ```bash alembic upgrade head ``` ### Linting The project uses Ruff for linting and formatting: ```bash ruff check . ruff format . ``` ## API Documentation Once the server is running, you can access: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## License This project is licensed under the MIT License.