Skip to content
Danny Alfandi
All work

case study · Full-Stack Engineering

Inventory & Sales Intelligence Platform

Inventory and sales platform: a Go/Gin REST API with role-based access control, a Flutter admin app and a Python forecasting service, verified by 1,613 automated tests and CI.

Role
Solo developer (personal project)
Timeline
October 2026
Type
Personal Project
Stack
Go · Gin · GORM · PostgreSQL · Redis · Flutter · Python · FastAPI · Docker
Screenshot of Inventory & Sales Intelligence Platform

Overview

A full-stack inventory and sales intelligence platform built to show how a small-business backend is designed and verified end to end. A Go (Gin, GORM) REST API backed by PostgreSQL and Redis handles authentication, role-based access control, products and stock, sales orders and analytics. A Flutter mobile app gives administrators and staff access to the dashboard, users and roles, and a Python (FastAPI) service produces demand forecasts and trend insights for the Go API.

The backend is built around correctness under real conditions. Permissions are checked per resource and action, and a guard ensures a user can only grant roles, and only edit users, whose permissions are a subset of their own. Refresh tokens rotate on every use, and a reused token revokes every session of that user. Stock changes are concurrency-safe, price and totals are snapshotted on each order, and the order status follows a strict state machine. The whole stack runs with one Docker Compose command, and GitHub Actions runs the backend, ML service, Flutter and Docker checks plus an end-to-end suite. The forecast currently uses a moving-average baseline (7-day window), designed so a trained regression model can replace it.

The project is covered by 1,613 automated tests (831 Go tests running against a real PostgreSQL database, 80 Python tests and 702 Flutter tests) and an end-to-end suite of 314 checks in CI. It was developed with the assistance of Claude Code; the idea, the technical decisions and the manual verification, including testing on a physical Android phone, are mine. Source code: https://github.com/dannyalfandi/AI-Powered-Inventory-Sales-Intelligence-System

The problem

A portfolio project to show how a small-business inventory and sales backend is designed and verified end to end: access control, stock that stays correct under concurrent orders, analytics and forecasting.

What I built

  • JWT authentication with refresh-token rotation and reuse detection
  • Role-based access control with 32 permissions and custom roles
  • Anti-privilege-escalation guard for granting roles and editing users
  • Product, category, customer and inventory management with stock movement history
  • Concurrency-safe stock deduction, verified with parallel requests
  • Sales order workflow (pending, confirmed, shipped, cancelled) with price snapshots and stock return on cancellation
  • Analytics: summary, sales trend, top products and category breakdown, cached in Redis
  • Demand forecast and trend insights from a Python FastAPI service
  • Flutter admin app for the dashboard, users and roles, in Indonesian and English
  • One-command Docker Compose stack, GitHub Actions CI and an end-to-end test suite

Architecture

// Request flow

  1. Flutter app
  2. REST API (Go · Gin · GORM)
  3. PostgreSQL + Redis cache

// Forecasting

  1. Go API
  2. forecast service (Python · FastAPI)
  3. demand forecast + trend insights

Key decisions

  • Permissions can only be passed down

    Permissions are checked per resource and action, and a guard ensures a user can only grant roles, and only edit users, whose permissions are a subset of their own.

  • Refresh tokens rotate on every use

    A reused refresh token revokes every session of that user, so a stolen token stops working as soon as either side uses it again.

  • Orders are consistent by design

    Stock changes are concurrency-safe, price and totals are snapshotted on each order, and order status follows a strict state machine.

  • A replaceable forecast baseline

    The forecast uses a moving-average baseline (7-day window), designed so a trained regression model can replace it.

Results & what I learned

1,613 automated tests (831 Go tests against a real PostgreSQL database, 80 Python tests and 702 Flutter tests) plus an end-to-end suite of 314 checks in CI. The whole stack starts with one Docker Compose command.

Screens

  • Dashboard.
  • Demand forecast and trend insights.
  • Sales order detail.
  • Inventory with low-stock items.
  • Role permissions.