Production-ready Inventory & Order Management API built using:
- FastAPI
- PostgreSQL
- SQLAlchemy
- Alembic
- Docker
This service manages Products and Orders with transactional stock handling and concurrency safety.
Ensure the following are installed:
- Python 3.10+
- PostgreSQL (if running locally without Docker)
- Docker
- Docker Compose
git clone https://github.com/abdulghaffarnba/inventory-order-mgt-services.git
cd inventory-order-mgt-servicespython -m venv venvmacOS / Linux:
source venv/bin/activateWindows:
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the root directory.
ENVIRONMENT=local
LOG_LEVEL=INFO
PSQL_HOST_SERVER=localhost
PSQL_USER=postgres
PSQL_PASSWORD=postgres
PSQL_DATABASE=logistics
PSQL_PORT=5432Ensure the PostgreSQL database logistics exists if running locally.
alembic upgrade headuvicorn application:application --reload --port 8000curl http://localhost:8000/healthExpected response:
{
"message":"local API is working!"
}Docker setup will:
- Start PostgreSQL
- Create the database
- Run Alembic migrations
- Start the API
docker compose up --buildBase URL:
http://localhost:8000
Health check:
curl http://localhost:8000/healthdocker compose downTo reset the database:
docker compose down -vpytestSwagger UI:
http://localhost:8000/docs
ReDoc:
http://localhost:8000/redoc
OpenAPI JSON:
http://localhost:8000/openapi.json
gunicorn -k uvicorn.workers.UvicornWorker application:applicationRecommended for production:
- Managed PostgreSQL
- Secure secret management
- Container orchestration (ECS/Kubernetes)
- Auth
GET /health
Used for monitoring and readiness checks.