Automated Action 848c5b628b Fix app module import in Alembic configuration
- Added improved Python path handling in env.py
- Added fallback import method for app.models
- Ensured database URL consistency

generated with BackendIM... (backend.im)
2025-05-13 16:05:11 +00:00

Generic REST API Service

A RESTful API service built with FastAPI and SQLite, providing standard CRUD operations with a clean architecture.

Features

  • FastAPI framework for high performance
  • SQLite database with SQLAlchemy ORM
  • Alembic for database migrations
  • RESTful API endpoints
  • Input validation with Pydantic
  • Error handling
  • Health check endpoint
  • Interactive API documentation with Swagger

Project Structure

├── alembic/              # Database migrations
│   └── versions/         # Migration scripts
├── app/                  # Application code
│   ├── api/              # API endpoints
│   │   ├── endpoints/    # Individual API route handlers
│   │   └── routes.py     # API router setup
│   ├── database.py       # Database connection setup
│   ├── errors.py         # Error handling
│   ├── models.py         # SQLAlchemy models
│   └── schemas.py        # Pydantic schemas
├── main.py               # Application entry point
├── alembic.ini           # Alembic configuration
└── requirements.txt      # Project dependencies

Installation

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

Usage

Run the application:

uvicorn main:app --reload

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

API Documentation

API Endpoints

Health Check

  • GET /health - Check API health status

Items

  • GET /items - List all items (with optional filtering)
  • POST /items - Create a new item
  • GET /items/{item_id} - Get a specific item
  • PUT /items/{item_id} - Update an item
  • DELETE /items/{item_id} - Delete an item

Database Management

This project uses Alembic for database migrations:

# Apply migrations
alembic upgrade head

# Create a new migration
alembic revision -m "description"

The SQLite database is stored at /app/storage/db/db.sqlite.

Description
Project: Generic REST API Service
Readme 43 KiB
Languages
Python 96%
Mako 4%