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.
| 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 |
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
| 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 |
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 | β |
| 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 |
- 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
- User registration & login
- JWT token generation and validation
- Role-based access control (ADMIN, WAREHOUSE, UNIT, COURIER)
- Security filter configuration
- 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)
- Warehouse stock entries and exits
- Weekly distribution planning per unit
- Portioning registration (Alpha & Beta units)
- Delivery confirmation per unit
- Daily chicken stock control (per unit)
- Urgent product transfers between units
- Supplier payment registration with invoice photo
- Operations history and audit trail
- Unit tests with JUnit 5 + Mockito
- Integration tests
- Full Swagger / OpenAPI documentation
- API usage examples
- Global exception handling
- Input validation on all endpoints
- System logging
- Security review
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
- Java 21
- Docker + Docker Compose
- Maven 3.x
1. Clone the repository
git clone https://github.com/CLopes86/flowchain-api.git
cd flowchain-api2. Start the database
docker compose up -d3. Run the application
./mvnw spring-boot:run4. Access Swagger UI
http://localhost:8080/swagger-ui/index.html
| 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 |
Full project documentation is available in the /docs folder:
- π Requirements Analysis
- ποΈ Data Model
- ποΈ Architecture Diagram
- π Use Case Diagram
Cesaltino Lopes Computer Science Student @ IPCB β Castelo Branco, Portugal
This project is under active development. New features are added progressively following the roadmap above.
