StockFlow is an inventory and order management application built with Java 21 and Spring Boot. It helps businesses manage products, track stock levels, process customer orders, generate invoices, record payments, and monitor key business metrics from a single dashboard.
The application implements a real-world order workflow where stock is reserved when an order is created, updated as the order progresses, and automatically restored if the order is cancelled.
- Add and manage products with name, category, price, and stock quantity
- Filter products by category
- Restock products directly from the dashboard
- Automatically load starter products when the database is empty
- Highlight products with low inventory
- Quick restock controls
- Low-stock counts displayed in dashboard analytics
- Create customer orders from available products
- Reserve stock automatically
- Search orders by customer name
- Filter orders by status
RESERVED → PAID → INVOICED
RESERVED → CANCELLED
- Revenue
- Total orders
- Average order value
- Best-selling product
- Low-stock products
- Order counts by status
- Products
- Orders
- Payments
- Invoices
- Notifications
- Analytics
- Java 21
- Spring Boot 3.3.5
- Spring Web
- Spring Data JPA
- Hibernate
- Jakarta Validation
- Maven
- H2 Database (default)
- PostgreSQL (optional)
- Docker Compose
- HTML5
- CSS3
- Vanilla JavaScript
- Fetch API
- JUnit 5
- Spring Boot Test
- IntelliJ IDEA / VS Code
- Git
- GitHub
StockFlow/
├── src/main/java/com/portfolio/stockflow/
│ ├── controllers/
│ ├── services/
│ ├── entities/
│ ├── repositories/
│ ├── request/
│ └── response/
├── src/main/resources/
│ ├── static/
│ │ ├── index.html
│ │ ├── app.js
│ │ └── styles.css
│ ├── application.properties
│ └── application-postgres.properties
├── src/test/
├── docker-compose.yml
├── pom.xml
└── README.md
- Product – Stores product information and stock levels
- CustomerOrder – Represents customer orders and workflow status
- OrderItem – Individual products within an order
- Payment – Payment records for orders
- Invoice – Generated invoices
- Notification – Order-related notifications
- Java 21 or newer
- Maven
- Optional: Docker (for PostgreSQL)
mvn spring-boot:runOpen:
- Application:
http://localhost:8080 - H2 Console:
http://localhost:8080/h2-console
docker compose up -d
mvn spring-boot:run -Dspring-boot.run.profiles=postgresmvn testGET /api/productsPOST /api/productsPOST /api/products/{id}/restock
GET /api/ordersPOST /api/ordersPOST /api/orders/{id}/payPOST /api/orders/{id}/invoicePOST /api/orders/{id}/cancel
GET /api/analytics/dashboard
- Stock is reserved when an order is created
- Orders cannot exceed available stock
- Only reserved orders can be paid or cancelled
- Only paid orders can be invoiced
- Cancelling an order restores reserved stock
- Authentication and user roles
- PDF invoice export
- Sales charts and reporting
- Pagination
- Docker deployment
Alsedi Berdufi