Automated Action 109d0c91b8 Create FastAPI application with basic CRUD functionality
- Set up project structure with FastAPI app
- Implement items CRUD API endpoints
- Configure SQLite database with SQLAlchemy
- Set up Alembic migrations
- Add health check endpoint
- Enable CORS middleware
- Create README with documentation
2025-06-06 09:44:58 +00:00
2025-06-06 09:40:30 +00:00

Quick API Service

A simple FastAPI application that provides a quick working API with basic CRUD operations.

Features

  • RESTful API with FastAPI
  • SQLite database with SQLAlchemy ORM
  • Alembic migrations for database versioning
  • CORS middleware enabled
  • Health check endpoint
  • Swagger documentation at /docs
  • ReDoc documentation at /redoc

Project Structure

.
├── app
│   ├── api
│   │   └── v1
│   │       ├── api.py
│   │       └── endpoints
│   │           └── items.py
│   ├── core
│   │   └── config.py
│   ├── crud
│   │   └── item.py
│   ├── db
│   │   ├── base.py
│   │   └── session.py
│   ├── models
│   │   └── item.py
│   ├── schemas
│   │   └── item.py
│   └── storage
│       └── db
├── migrations
│   ├── env.py
│   ├── README
│   ├── script.py.mako
│   └── versions
│       └── 53b8c3f67ecb_create_items_table.py
├── alembic.ini
├── main.py
├── README.md
└── requirements.txt

Installation

  1. Clone the repository:
git clone <repository-url>
cd quickapiservice
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the migrations:
alembic upgrade head
  1. Start the application:
uvicorn main:app --reload

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

API Endpoints

  • GET /: Root endpoint with basic information
  • GET /health: Health check endpoint
  • GET /docs: Swagger documentation
  • GET /redoc: ReDoc documentation

Items API

  • GET /api/v1/items: Get all items
  • POST /api/v1/items: Create a new item
  • GET /api/v1/items/{item_id}: Get an item by ID
  • PUT /api/v1/items/{item_id}: Update an item
  • DELETE /api/v1/items/{item_id}: Delete an item

Example API Usage

Create an Item

curl -X 'POST' \
  'http://localhost:8000/api/v1/items/' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Example Item",
  "description": "This is an example item"
}'

Get All Items

curl -X 'GET' 'http://localhost:8000/api/v1/items/'

Development

The application uses SQLite for the database, which is stored at /app/storage/db/db.sqlite.

To apply new migrations:

alembic revision --autogenerate -m "description"
alembic upgrade head

License

This project is licensed under the MIT License.

Description
Project: Quick API Service
Readme 39 KiB
Languages
Python 95.1%
Mako 4.9%