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

generated with BackendIM... (backend.im)
2025-05-14 01:20:38 +00:00

1.8 KiB

Quick REST API Service

A fast, lightweight REST API service built with FastAPI and SQLite.

Features

  • FastAPI Framework: High-performance async API framework
  • SQLite Database: Simple, file-based database with SQLAlchemy ORM
  • Async Support: Full async/await pattern for high concurrency
  • Migrations: Database versioning with Alembic
  • API Documentation: Auto-generated OpenAPI docs
  • Health Endpoint: Monitoring endpoint at /api/v1/health
  • CRUD Operations: Complete REST API for item resources

Project Structure

.
├── app
│   ├── api
│   │   └── v1
│   │       ├── __init__.py 
│   │       ├── health.py
│   │       └── items.py
│   ├── core
│   │   └── config.py
│   ├── db
│   │   ├── __init__.py
│   │   ├── base.py
│   │   ├── session.py
│   │   └── migrations/
│   ├── models
│   │   ├── __init__.py
│   │   └── item.py
│   └── schemas
│       ├── __init__.py
│       └── item.py
├── alembic.ini
├── main.py
├── requirements.txt
└── README.md

Installation

  1. Clone the repository
  2. Install dependencies:
    pip install -r requirements.txt
    

Running the Application

Start the server with:

uvicorn main:app --reload

The API will be available at http://localhost:8000.

API documentation is available at:

API Endpoints

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