Skip to content

CLopes86/flowchain-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FlowChain API

Internal operations management system for multi-unit restaurant chains.

FlowChain replaces manual WhatsApp and Excel-based workflows with a structured, traceable, and role-based REST API β€” covering weekly supply orders, warehouse stock control, distribution planning, daily chicken stock tracking, urgent inter-unit transfers, and supplier payment registration.


πŸš€ Tech Stack

Technology Version Purpose
Java 21 (LTS) Programming language
Spring Boot 3.5.13 Main framework
Spring Security + JWT Latest Authentication & authorization
Spring Data JPA + Hibernate 3.x Database ORM
PostgreSQL 16 Relational database
Docker + Docker Compose Latest Containerization
Maven 3.x Build & dependency management
JUnit 5 + Mockito Latest Unit & integration testing
Swagger / OpenAPI 2.8.8 API documentation
Lombok Latest Boilerplate reduction

πŸ—οΈ Architecture

The system follows a Layered Architecture with clear separation of concerns:

Client (Mobile App / Browser)
        ↓ HTTP Request + JWT
Spring Security Filter
        ↓ Authorized
Controller Layer     ← Receives HTTP requests, validates DTOs
        ↓
Service Layer        ← Business logic, validations, aggregations
        ↓
Repository Layer     ← Spring Data JPA, database communication
        ↓
PostgreSQL Database

πŸ‘₯ System Roles

Role Description
ADMIN Full access β€” consolidated lists, all units, user management
WAREHOUSE Stock management, distributions, delivery confirmation
UNIT Weekly orders, daily chicken stock, payment registration
COURIER Urgent transfers between units

πŸͺ Operational Units

The system manages 7 operational units:

Unit Type Special Role
Alpha Restaurant Portioning center β€” bacalhau & entrecosto
Beta Restaurant + Take Away Operations hub β€” soups, rice, prepared dishes + courier base
Gamma Restaurant + Take Away β€”
Delta Restaurant + Take Away β€”
Epsilon Take Away β€”
Zeta Take Away β€”
Eta Take Away β€”

πŸ“… Weekly Operational Calendar

Day Operation Responsible
Monday Charcoal distribution Warehouse
Tuesday Warehouse products distribution Warehouse
Thursday External supplier purchases + distribution Admin + Warehouse
Friday Meats & prepared dishes distribution Warehouse
Daily Chicken stock control Each Unit
Any time Urgent transfers between units Courier

πŸ—ΊοΈ Project Roadmap

βœ… Phase 1 β€” Setup & Foundations (Completed)

  • Requirements analysis
  • Data model design (12 entities)
  • System architecture diagram
  • Spring Boot 3.x project setup
  • GitHub repository initialization
  • Docker Compose β€” PostgreSQL + pgAdmin
  • Project folder structure
  • Unit entity with JPA mappings
  • UnitRepository, UnitService, UnitController
  • First REST endpoint β€” GET /api/units
  • Swagger UI integration

πŸ”„ Phase 2 β€” Authentication (In Progress)

  • User registration & login
  • JWT token generation and validation
  • Role-based access control (ADMIN, WAREHOUSE, UNIT, COURIER)
  • Security filter configuration

⏳ Phase 3 β€” Order Management

  • Weekly order submission per unit (Supplier, Warehouse, Beira Sumos)
  • Prepared dishes order (soup, rice, bacalhau, etc.)
  • Automatic consolidated order list per supplier
  • Order status tracking (PENDING β†’ CONFIRMED β†’ DELIVERED)

⏳ Phase 4 β€” Warehouse & Stock Management

  • Warehouse stock entries and exits
  • Weekly distribution planning per unit
  • Portioning registration (Alpha & Beta units)
  • Delivery confirmation per unit

⏳ Phase 5 β€” Daily Operations

  • Daily chicken stock control (per unit)
  • Urgent product transfers between units
  • Supplier payment registration with invoice photo
  • Operations history and audit trail

⏳ Phase 6 β€” Testing & Documentation

  • Unit tests with JUnit 5 + Mockito
  • Integration tests
  • Full Swagger / OpenAPI documentation
  • API usage examples

⏳ Phase 7 β€” Security & Quality

  • Global exception handling
  • Input validation on all endpoints
  • System logging
  • Security review

πŸ“ Project Structure

flowchain-api/
β”œβ”€β”€ docs/                          # Project documentation (PDF)
β”‚   β”œβ”€β”€ FlowChain_Analise_Requisitos.pdf
β”‚   β”œβ”€β”€ FlowChain_Modelo_Dados.pdf
β”‚   β”œβ”€β”€ FlowChain_Arquitetura.pdf
β”‚   └── FlowChain_UseCases.html
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/flowchain/api/
β”‚   β”‚   β”‚   β”œβ”€β”€ controller/        # REST Controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ service/           # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ repository/        # Spring Data JPA repositories
β”‚   β”‚   β”‚   β”œβ”€β”€ entity/            # JPA entities (database tables)
β”‚   β”‚   β”‚   β”œβ”€β”€ dto/               # Data Transfer Objects
β”‚   β”‚   β”‚   β”œβ”€β”€ security/          # JWT & Spring Security config
β”‚   β”‚   β”‚   └── exception/         # Global exception handling
β”‚   β”‚   └── resources/
β”‚   β”‚       └── application.yml    # App configuration
β”‚   └── test/                      # Unit & integration tests
β”œβ”€β”€ docker-compose.yml             # PostgreSQL + pgAdmin containers
β”œβ”€β”€ pom.xml                        # Maven dependencies
└── README.md

🐳 Running Locally

Prerequisites

  • Java 21
  • Docker + Docker Compose
  • Maven 3.x

Steps

1. Clone the repository

git clone https://github.com/CLopes86/flowchain-api.git
cd flowchain-api

2. Start the database

docker compose up -d

3. Run the application

./mvnw spring-boot:run

4. Access Swagger UI

http://localhost:8080/swagger-ui/index.html

πŸ“‹ Main API Endpoints (Work in Progress)

Method Endpoint Role Description
GET /api/units All List all units
GET /api/units/{id} All Get unit by ID
POST /api/units ADMIN Create new unit
DELETE /api/units/{id} ADMIN Delete unit
POST /api/auth/login All User login
POST /api/orders UNIT Submit weekly order
GET /api/orders/consolidated ADMIN, WAREHOUSE Consolidated order list
POST /api/warehouse/stock WAREHOUSE Register stock movement
POST /api/distributions WAREHOUSE Create distribution
PUT /api/distributions/{id}/confirm WAREHOUSE Confirm delivery
POST /api/chicken-stock UNIT Daily chicken stock
POST /api/transfers COURIER Register urgent transfer
POST /api/payments UNIT Register supplier payment

πŸ“„ Documentation

Full project documentation is available in the /docs folder:


πŸ‘¨β€πŸ’» Author

Cesaltino Lopes

Cesaltino Lopes Computer Science Student @ IPCB β€” Castelo Branco, Portugal

GitHub LinkedIn Email


This project is under active development. New features are added progressively following the roadmap above.

About

Internal operations management system for restaurant chains

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages