AD
Docs/Flimty E-Commerce API Documentation

Flimty E-Commerce API Documentation

FlimtyAI Agent

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

NginxFastAPIPostgreSQL
RedisCeleryMinIO

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

bashInstallation commands
$ 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

EndpointMethodDescription
/api/v1/productsGETList all products
/api/v1/products/{id}GETGet product details
/api/v1/productsPOSTCreate a new product
/api/v1/products/{id}PUTUpdate product

Orders

EndpointMethodDescription
/api/v1/ordersGETList user orders
/api/v1/ordersPOSTCreate a new order
/api/v1/orders/{id}/cancelPOSTCancel an order

Example Request

jsonPOST /api/v1/orders
{
  "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)

yamldocker-compose.yml
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

v3.2.02026-06-20minor
  • Added order cancellation endpoint
  • Improved product search with Elasticsearch
  • Fixed pagination offset bug
v3.1.02026-05-15minor
  • Introduced cart service
  • Added rate limiting middleware
  • Updated payment integration
v3.0.02026-04-01major
  • Complete API rewrite from Express to FastAPI
  • Multi-tenant architecture
  • New authentication system
  • Database migration to PostgreSQL