1. Overview
The Flimty E-Commerce API is a RESTful service powering the Flimty online marketplace platform. It provides endpoints for product catalog management, shopping cart operations, checkout flows, payment processing, and order tracking. Built with FastAPI and PostgreSQL, it serves as the backbone of the Flimty ecosystem.
Key Features
- Product catalog with real-time inventory tracking
- Multi-tenant architecture supporting vendor isolation
- JWT-based authentication with role-based access control
- Asynchronous task processing via Celery + Redis
- Comprehensive audit logging and event streaming
2. Architecture
The system follows a layered architecture pattern with clear separation between API gateway, application services, domain logic, and data access layers. All inter-service communication is asynchronous via message queues.
3. Setup
Prerequisites
- Python 3.11+
- PostgreSQL 15+
- Redis 7+
- Docker & Docker Compose (optional)
Installation
$ git clone https://github.com/aimi-org/flimty-ecommerce-api.git $ cd flimty-ecommerce-api $ python -m venv .venv $ source .venv/bin/activate $ pip install -r requirements.txt $ cp .env.example .env $ alembic upgrade head $ uvicorn app.main:app --reload
4. API Reference
Products
| Endpoint | Method | Description |
|---|---|---|
| /api/v1/products | GET | List all products |
| /api/v1/products/{id} | GET | Get product details |
| /api/v1/products | POST | Create a new product |
| /api/v1/products/{id} | PUT | Update product |
Orders
| Endpoint | Method | Description |
|---|---|---|
| /api/v1/orders | GET | List user orders |
| /api/v1/orders | POST | Create a new order |
| /api/v1/orders/{id}/cancel | POST | Cancel an order |
Example Request
{
"customer_id": "c_abc123",
"items": [
{ "product_id": "p_456", "quantity": 2 },
{ "product_id": "p_789", "quantity": 1 }
],
"shipping_address": {
"street": "123 Main St",
"city": "Jakarta",
"postal_code": "12345"
},
"payment_method": "credit_card"
}5. Deployment
The Flimty API is containerized using Docker and deployed via Kubernetes on AWS EKS. The CI/CD pipeline is managed through GitHub Actions, with staging deployments on every PR merge and production deployments triggered by release tags.
Docker Compose (Local)
version: '3.8'
services:
api:
build: .
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://user:pass@db:5432/flimty
- REDIS_URL=redis://redis:6379
depends_on:
- db
- redis
db:
image: postgres:15-alpine
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:7-alpine
volumes:
pgdata:6. Changelog
- Added order cancellation endpoint
- Improved product search with Elasticsearch
- Fixed pagination offset bug
- Introduced cart service
- Added rate limiting middleware
- Updated payment integration
- Complete API rewrite from Express to FastAPI
- Multi-tenant architecture
- New authentication system
- Database migration to PostgreSQL