How anami283/legacy-demo-erp works
Purpose and runtime
Legacy ERP is an internal Java application for sales, inventory, and billing. It is packaged with Maven and containerized for local deployment via Docker Compose. The executable application entry point is src/main/java/com/northstar/erp/LegacyErpApplication.java; deployment artifacts are Dockerfile and docker-compose.yml.
Application boundary
The web-facing sales boundary is src/main/java/com/northstar/erp/web/SalesController.java. It accepts sales-oriented requests and delegates business work to domain services rather than directly managing storage. The README identifies a default admin/admin user, implying authentication is part of the deployed application or container configuration, though no auth source appears in the tree.
Sales-order domain
Order creation and lifecycle are centered on src/main/java/com/northstar/erp/orders/OrderService.java, with aggregate/request structures in:
• src/main/java/com/northstar/erp/orders/SalesOrder.java
• src/main/java/com/northstar/erp/orders/SalesOrderRequest.java
• src/main/java/com/northstar/erp/orders/OrderLine.java
Orders are persisted behind src/main/java/com/northstar/erp/orders/OrderRepository.java, currently implemented by src/main/java/com/northstar/erp/orders/InMemoryOrderRepository.java. This interface/implementation split is the main persistence replacement boundary.
Customer and inventory dependencies
Sales processing depends on customer lookup/management through src/main/java/com/northstar/erp/customers/CustomerService.java and src/main/java/com/northstar/erp/customers/CustomerRepository.java. Inventory availability and stock operations are owned by src/main/java/com/northstar/erp/inventory/InventoryService.java, backed by src/main/java/com/northstar/erp/inventory/InventoryRepository.java; products are represented by src/main/java/com/northstar/erp/inventory/Product.java.
The in-memory implementations (InMemoryCustomerRepository.java, InMemoryInventoryRepository.java) indicate process-local, non-durable state rather than an external database.
Billing and payment flow
Invoice generation/handling is isolated in src/main/java/com/northstar/erp/invoices/InvoiceProcessor.java, using Invoice.java and the InvoiceRepository abstraction. Payments are represented and processed separately by:
• src/main/java/com/northstar/erp/payments/Payment.java
• src/main/java/com/northstar/erp/payments/PaymentService.java
The likely control flow is sales request → order service → customer/inventory validation and stock changes → order persistence → invoice processing → payment handling. Invoice and payment concerns are distinct boundaries, enabling later integration with durable billing or payment services.
Shared domain contract
src/main/java/com/northstar/erp/shared/Money.java is the cross-domain monetary value type. Orders, invoices, and payments should exchange monetary amounts through this shared model rather than primitive numeric values, making it a key consistency boundary.
Infrastructure and extension points
No database, message broker, payment gateway, or other external service is visible in the repository tree. Runtime infrastructure is Docker/Docker Compose; persistence is presently in-memory. The repository interfaces in customers, inventory, orders, and invoices are the principal seams for introducing durable storage without changing service-level workflows.
Main entry points: OrderService.java Order service · InvoiceProcessor.java Invoice processor · InventoryService.java Inventory service · Money.java Money
Components 18
Runtime & deployment
- Docker Compose
docker-compose.yml - Application image
Dockerfile - Legacy ERP application
src/main/java/com/northstar/erp/LegacyErpApplication.java
Web boundary
- Sales controller · Accepts sales requests and delegates business work.
src/main/java/com/northstar/erp/web/SalesController.java
Sales orders
- Order service · Coordinates order creation and lifecycle.
src/main/java/com/northstar/erp/orders/OrderService.java - Sales order aggregate
src/main/java/com/northstar/erp/orders/SalesOrder.java - Order request & lines
src/main/java/com/northstar/erp/orders/SalesOrderRequest.java
Customer, inventory & billing
- Customer service
src/main/java/com/northstar/erp/customers/CustomerService.java - Inventory service · Validates availability and changes stock.
src/main/java/com/northstar/erp/inventory/InventoryService.java - Product
src/main/java/com/northstar/erp/inventory/Product.java - Invoice processor
src/main/java/com/northstar/erp/invoices/InvoiceProcessor.java - Payment service
src/main/java/com/northstar/erp/payments/PaymentService.java - Money · Cross-domain monetary contract.
src/main/java/com/northstar/erp/shared/Money.java
Persistence seams
Current repository implementations keep state in process memory.
- Order repository · Durable-storage replacement seam.
src/main/java/com/northstar/erp/orders/OrderRepository.java - In-memory orders · Process-local, non-durable order state.
src/main/java/com/northstar/erp/orders/InMemoryOrderRepository.java - Customer repository · Durable-storage replacement seam.
src/main/java/com/northstar/erp/customers/CustomerRepository.java - Inventory repository · Durable-storage replacement seam.
src/main/java/com/northstar/erp/inventory/InventoryRepository.java - Invoice repository · Billing persistence seam.
Connections 19
- Docker Compose → Application image: builds
- Application image → Legacy ERP application: packages
- Legacy ERP application → Sales controller: hosts
- Sales controller → Order service: delegates sales requests
- Order service → Order request & lines: accepts
- Order service → Sales order aggregate: creates and manages
- Order service → Customer service: validates customer
- Order service → Inventory service: checks and reserves stock
- Order service → Order repository: persists orders
- Order service → Invoice processor: triggers invoicing
- Invoice processor → Payment service: hands off payment handling
- Customer service → Customer repository: uses
- Inventory service → Inventory repository: uses
- Inventory service → Product: manages
- Invoice processor → Invoice repository: uses
- Order repository → In-memory orders: implemented by
- Sales order aggregate → Money: uses amounts
- Invoice processor → Money: uses amounts
- Payment service → Money: uses amounts