Automated Action 93c528a258 Create FastAPI REST API with SQLite
- Set up project structure and dependencies
- Create database models with SQLAlchemy
- Implement API endpoints for CRUD operations
- Set up Alembic for database migrations
- Add health check endpoint
- Configure Ruff for linting
- Update documentation in README
2025-05-29 10:18:27 +00:00
2025-05-29 10:18:27 +00:00
2025-05-29 10:13:42 +00:00
2025-05-29 10:18:27 +00:00
2025-05-29 10:18:27 +00:00

QuickRestAPI

A simple REST API built with FastAPI and SQLite.

Features

  • FastAPI framework for high performance
  • SQLite database with SQLAlchemy ORM
  • Alembic database migrations
  • Pydantic for data validation
  • RESTful CRUD operations on items
  • Health check endpoint
  • OpenAPI documentation

Project Structure

/
├── app/
│   ├── api/
│   │   └── v1/
│   │       ├── endpoints/
│   │       │   └── items.py
│   │       └── api.py
│   ├── core/
│   │   └── config.py
│   ├── db/
│   │   ├── base.py
│   │   ├── base_class.py
│   │   └── session.py
│   ├── models/
│   │   └── item.py
│   ├── schemas/
│   │   └── item.py
│   └── storage/
│       └── db/
├── migrations/
│   └── versions/
│       └── initial_migration.py
├── alembic.ini
├── main.py
└── requirements.txt

Installation

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

Running the Application

uvicorn main:app --reload

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

API Documentation

Once the application is running, you can access:

API Endpoints

Method URL Description
GET /health Health check
GET /api/v1/items List 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

Database Migrations

Initialize the database:

alembic upgrade head

Development

Create a new migration after modifying models:

alembic revision --autogenerate -m "Description of changes"

Apply migrations:

alembic upgrade head
Description
Project: Quick REST API
Readme 40 KiB
Languages
Python 95.5%
Mako 4.5%