Automated Action 629ba0ee1c Create REST API with FastAPI and SQLite
- Set up project structure with FastAPI app
- Implement SQLAlchemy models and async database connection
- Create CRUD endpoints for items resource
- Add health endpoint for monitoring
- Configure Alembic for database migrations
- Create comprehensive documentation

generated with BackendIM... (backend.im)
2025-05-15 15:49:28 +00:00

Generic REST API Service

A RESTful API service built with FastAPI and SQLite for database storage.

Features

  • RESTful API endpoints for CRUD operations on items
  • Async SQLAlchemy with SQLite database
  • Database migrations with Alembic
  • Health check endpoint
  • Pydantic schemas for validation
  • Comprehensive API documentation

Project Structure

├── alembic/             # Database migration files
├── app/                 # Application package
│   ├── api/             # API endpoints and routes
│   ├── db/              # Database connection and utilities
│   ├── models/          # SQLAlchemy ORM models
│   └── schemas/         # Pydantic schemas for validation and serialization
├── main.py              # Application entry point
├── requirements.txt     # Project dependencies
└── README.md            # This file

API Endpoints

  • GET /health: Check API health status
  • GET /api/items: List all items
  • GET /api/items/{item_id}: Get a specific item
  • POST /api/items: Create a new item
  • PUT /api/items/{item_id}: Update an existing item
  • DELETE /api/items/{item_id}: Delete an item

Getting Started

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the application:

    uvicorn main:app --reload
    
  3. Access the API documentation:

Database Migrations

Database migrations are managed with Alembic:

# Apply migrations
alembic upgrade head

# Create a new migration
alembic revision --autogenerate -m "description"
Description
Project: Generic REST API Service
Readme 40 KiB
Languages
Python 95.5%
Mako 4.5%