Skip to content

Repository files navigation

Retail Inventory API

Python FastAPI SQLModel Alembic PostgreSQL Supabase Docker pytest

Status

API Render Version Last Commit Commits License


About

A REST API for managing retail product inventory and variants. Built with FastAPI, SQLModel, and PostgreSQL, with structured JSON logging, centralised exception handling, and Docker support.

Live API: retail-inventory-api-yati.onrender.com/docs


Installation

Prerequisites

  • Python 3.11+
  • uv
  • Docker & Docker Compose

Clone

git clone https://github.com/chris-kechagias/retail-inventory-api.git
cd retail-inventory-api

Environment variables

Copy .env.example to .env and fill in the values:

cp .env.example .env
# Local Docker
DB_USERNAME=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=retail_inventory_db

# Supabase (Cloud) — Transaction pooler
# DB_USERNAME=postgres.<your-project-ref>
# DB_PASSWORD=your_supabase_password
# DB_HOST=aws-1-<region>.pooler.supabase.com
# DB_PORT=6543
# DB_NAME=postgres

Option 1: Local (uv)

Install uv if you don't have it:

pip install uv

Install dependencies and start the database:

uv sync
docker compose up -d db

Run the development server:

task dev
# or manually:
uv run uvicorn main:app --reload

Option 2: Full Docker

task build
# or manually:
docker compose up --build

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


Testing

Run the full test suite with:

uv run pytest -v

29 tests covering all endpoints: products, variants, analytics, and health check. Uses SQLite in-memory database — no external dependencies required.


Acknowledgements

Special thanks to qquorum, Senior Software Developer, for code reviews, architectural guidance, and mentorship throughout this project.


Author

Chris Kechagias

Medium Badge
GitHub
LinkedIn
dev.to

Transitioning from retail operations to AI engineering.

⭐ If you find this project helpful, consider giving it a star!

About

REST API for retail inventory management built while learning modern Python backend development. FastAPI + PostgreSQL + Docker deployment.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages