Note: This is a work in progress. The system is currently undergoing migration from a legacy PHP platform to a modern microservices architecture with Angular frontend and Spring Boot backend. The
developbranch contains the new implementation, whilemainmay point to legacy code or placeholders.
Procurement System is a comprehensive Enterprise Resource Planning (ERP) solution designed to streamline procurement processes, inventory management, and vendor relations. It features a modern, modular architecture built with:
- Frontend: Angular 22 with TypeScript and PrimeNG
- Backend: Java 21 with Spring Boot and Spring Security
- Database: PostgreSQL 16 with Spring Data JPA
- Cache/Messaging: Redis
- Infrastructure: Docker, GitHub Container Registry (GHCR), AWS ECS
┌──────────────────────────────────────────────────────────────────────────┐
│ Production Environment │
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ AWS ECS Cluster │ │
│ │ │ │
│ │ ┌────────────────────┐ ┌────────────────────┐ │ │
│ │ │ Backend Service │ │ Frontend Service │ │ │
│ │ │ (Spring Boot) │ │ (Angular) │ │ │
│ │ │ │ │ │ │ │
│ │ │ Task Definition │ │ Task Definition │ │ │
│ │ │ - Image: │ │ - Image: │ │ │
│ │ │ ghcr.io/ │ │ ghcr.io/ │ │ │
│ │ │ company/backend │ │ company/frontend│ │ │
│ │ │ Config: │ │ Config: │ │ │
│ │ │ - DB: Postgres │ │ - API: │ │ │
│ │ │ - Redis │ │ https://api... │ │ │
│ │ │ - Profile: prod │ │ - Profile: prod │ │ │
│ │ └────────────────────┘ └────────────────────┘ │ │
│ │ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ GitHub Container Registry │ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ Backend │ │ Frontend │ │ Common │ │ │
│ │ │ Image: │ │ Image: │ │ Image: │ │ │
│ │ │ repo/backend│ │ repo/frontend│ │ repo/common │ │ │
│ │ │ - Tags: │ │ - Tags: │ │ - Tags: │ │ │
│ │ │ sha-xxxx │ │ sha-xxxx │ │ sha-xxxx │ │ │
│ │ │ main │ │ main │ │ main │ │ │
│ │ │ latest │ │ latest │ │ latest │ │ │
│ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────┘
Features:
- Authentication & Authorization (JWT-based)
- Multi-tenancy (multi-company, multi-branch)
- Role-based access control (RBAC)
- RESTful APIs with Swagger/OpenAPI documentation
Key Components:
AuthService: User registration, login, JWT generationCompanyService: Company creation and managementBranchService: Branch management within companiesUserService: User management and profileProductService: Product and category managementInventoryService: Inventory tracking and stock management
Endpoints:
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get JWT tokenGET /api/users/profile- Get user profileGET /api/companies- List companies (admin)POST /api/companies- Create new companyGET /api/branches- List branches (tenant)POST /api/branches- Create new branchGET /api/products- List productsPOST /api/products- Create new productGET /api/inventory- Inventory stock detailsPOST /api/inventory/stock-in- Receive stockPOST /api/inventory/stock-out- Issue stock
Build Configuration:
# Build and test
./mvnw clean install
# Build Docker image
./mvnw spring-boot:build-imageFeatures:
- Modern dashboard with PrimeNG components
- Responsive design with PrimeFlex
- Route-based lazy loading
- Authentication guards
- Company/branch selector
- Role-specific views
Key Components:
AuthService: Login, register, token managementAuthGuard: Route protection based on authenticationNoAuthGuard: Prevent access to auth pages when logged inTopbarComponent: User info, notifications, branch selectorDashboardComponent: Role-specific analyticsCompanyListComponent: Company managementBranchListComponent: Branch managementProductListComponent: Product catalogInventoryListComponent: Stock levels and movements
Build Configuration:
# Build production
npm run build -- --configuration=production
# Build Docker image
npm run build:dockerReusable TypeScript code shared between frontend and backend.
Contents:
// package: @procure/common
{
// Models
"auth/models": { "AuthResponse", "LoginRequest", "RegisterRequest" },
"company/models": { "Company", "CompanyCreateRequest", "CompanyResponse" },
"branch/models": { "Branch", "BranchCreateRequest", "BranchResponse" },
"product/models": { "Product", "ProductCreateRequest", "ProductResponse" },
"inventory/models": { "InventoryItem", "StockInRequest", "StockOutRequest" },
"user/models": { "UserInfo", "UserProfileUpdate" }
}The system uses GitHub Container Registry for storing Docker images and AWS ECS for deployment.
Backend Image:
# Build
docker build -t ghcr.io/company/backend:sha-xxxx .
# Push
docker push ghcr.io/company/backend:sha-xxxxFrontend Image:
# Build
docker build -t ghcr.io/company/frontend:sha-xxxx .
# Push
docker push ghcr.io/company/frontend:sha-xxxxFrontend ECS Task Definition:
# procure-frontend task definition example
family: procure-frontend
containerDefinitions:
- name: procure-frontend
image: ghcr.io/company/frontend:sha-xxxx
portMappings:
- containerPort: 80
protocol: tcp
environment:
- name: API_URL
value: https://api.procure.com/api
logConfiguration:
logDriver: awslogs
options:
awslogs-group: /ecs/procure-frontend
awslogs-region: us-east-1Backend ECS Task Definition:
#