A system that emulates a distributed manufacturing pipeline simulation system running on Kubernetes. It has a User Interface with authentication and authorization and provides real-time control and status monitoring. The system simulates the creation of a pipeline with multiple stages that can run sequentially or in parallel based on the user's choice. The backend is built using Go (Golang) and deployed on Kubernetes, utilizing REST and gRPC APIs for communication.
The backend is structured into modular components for scalability and maintainability. It consists of:
- Golang (Primary Backend Language)
- GORM (ORM for Database Management)
- Supabase (Managed Backend Platform using PostgreSQL)
- Gin Framework (REST API Development)
- gRPC (Google Remote Procedure Call for High-Performance API Communication)
- Pipeline Interface: Orchestrates multiple stages in either sequential or parallel execution.
- Stage Interface: Defines the structure of each pipeline stage, handling execution, error management, and rollback.
- Database Interface: Defines the database functions.
The system uses Supabase as the backend database, which internally runs on PostgreSQL. Supabase also provides authentication (user sign-up, login, and session management). The database is initialized in Golang using GORM, which migrates tables from the model.go file (structured as structs). The migrations include users, pipeline_executions, and execution_logs tables. The Supabase Go SDK is initialized to interact with authentication and database services. User authentication and metadata updates are handled via Supabase's Auth.
The frontend is built using React.js and serves as the user interface for interaction. It provides a seamless experience for users to authenticate, create pipelines, start pipelines, and monitor the status of stages and pipelines.
- React.js (Frontend framework)
- Axios (API Communication)
- Material UI (Styling)
- React Router (Navigation & Routing)
- SSE (Server-Sent Events for real-time updates)
- User Authentication: Users can register, log in, and manage sessions using Supabase authentication. Authentication is handled via JWT tokens, securely stored in the browser.
- Pipeline Management: Users can create pipelines, select the number of stages and execution type, and get real-time updates on pipeline status, logs, and execution progress.
- Install Docker Desktop: Download and verify with:
docker --version
- Enable Kubernetes from Docker Desktop and verify:
kubectl version --client kubectl get nodes
- Pull the Docker Images:
docker pull hsri/frontend:v1.0.0 docker pull hsri/rest-api:v1.0.0 docker pull hsri/grpc-server:v1.0.0
- Download deployment files from
distributed-manufacturing-pipeline/deploy/kubernetes/deployment. It contains:deployment-frontend.yamldeployment-rest.yamldeployment-grpc.yaml
- Create
config-db.yamlandsecret-db.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: supabase-config
data:
SUPABASE_DB: "XXXXXXXXXXX"apiVersion: v1
kind: Secret
metadata:
name: supabase-secrets
type: Opaque
data:
SUPABASE_URL: XXXXXXXXXXXXXXXXX
SUPABASE_API_KEY: XXXXXXXXXXXXXXX- Deploy all configurations:
kubectl apply -f config-db.yaml kubectl apply -f secret-db.yaml kubectl apply -f deployment-frontend.yaml kubectl apply -f deployment-rest.yaml kubectl apply -f deployment-grpc.yaml
- Verify Kubernetes pods and services:
kubectl get pods kubectl get svc
- Access the frontend via
http://localhost:30080and check logs with:kubectl logs -l app=rest-api -n default -f
- Golang (v1.21+): Download and verify:
Install dependencies:
go version
go mod tidy
- Node.js (v18+): Download or install via CLI:
Verify installation:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash \ "$HOME/.nvm/nvm.sh" nvm install 22
node -v # Should print "v22.14.0" npm -v # Should print "10.9.2"
- Install frontend dependencies:
cd web/frontend npm install
- Clone the repository:
git clone https://github.com/hsri-pf9/distributed-manufacturing-pipeline-simulation-system.git cd distributed-manufacturing-pipeline - Create a
.envfile in the root directory:SUPABASE_DB = XXXXXXXXXXXXXXX SUPABASE_URL = XXXXXXXXXXXXXX SUPABASE_API_KEY= XXXXXXXXXXXXXXX
- Modify
db.goandsupabase_client.goto use environment variables (see full instructions above). - Initialize the backend:
cd cmd/api-server go run main.go - Start the frontend:
cd web/frontend npm start - Access the UI at
http://localhost:3000
- Clone the repository:
git clone https://github.com/hsri-pf9/distributed-manufacturing-pipeline-simulation-system.git cd distributed-manufacturing-pipeline - Build
democtl:go build -o democtl ./cmd/democtl/main.go sudo mv democtl /usr/local/bin/
- Set environment variables:
export DEMOCTL_GRPC_URL=localhost:50051 - Forward gRPC service port:
kubectl port-forward svc/grpc-server 50051:50051
- Use
democtlcommands:democtl register --email --password democtl login --email --password democtl pipeline create --user --stages --parallel democtl pipeline start --pipeline-id "XXXXXX" --user-id "XXXXXX" --input "test_input" --parallel democtl pipeline status --pipeline-id "XXXXX" --parallel democtl pipeline cancel --pipeline-id "XXXXX" --user-id "XXXXXXX" --parallel
The backend REST API provides endpoints for user authentication, pipeline management, and real-time updates using Gin and SSE (Server-Sent Events). Below is a structured table of the available API endpoints.
| Method | Endpoint | Description | Auth Required | Request Body | Response |
|---|---|---|---|---|---|
| POST | /register | Register a new user | ❌ No | { "email": "user@example.com", "password": "password" } |
{ "message": "Check your email for verification" } |
| POST | /login | User login | ❌ No | { "email": "user@example.com", "password": "password" } |
{ "token": "jwt-token", "user_id": "uuid" } |
| GET | /user/:id | Fetch user profile | ✅ Yes | N/A | { "user_id": "uuid", "email": "user@example.com", "role": "worker" } |
| PUT | /user/:id | Update user profile | ✅ Yes | { "name": "New Name", "role": "admin" } |
{ "message": "User updated successfully" } |
| Method | Endpoint | Description | Auth Required | Request Body | Response |
|---|---|---|---|---|---|
| GET | /pipelines | Get all pipelines for a user | ✅ Yes | N/A | [ { "pipeline_id": "uuid", "status": "Running" } ] |
| GET | /pipelines/:id/stages | Get pipeline stages | ✅ Yes | N/A | { "stages": [ ... ] } |
| POST | /createpipelines | Create a new pipeline | ✅ Yes | { "user_id": "uuid", "stage_count": 5, "is_parallel": true } |
{ "pipeline_id": "uuid" } |
| POST | /pipelines/:id/start | Start a pipeline execution | ✅ Yes | { "user_id": "uuid" } |
{ "status": "Running" } |
| GET | /pipelines/:id/status | Get pipeline execution status | ✅ Yes | N/A | { "pipeline_id": "uuid", "status": "Running" } |
| POST | /pipelines/:id/cancel | Cancel a pipeline execution | ✅ Yes | { "user_id": "uuid" } |
{ "status": "Cancelled" } |
| Method | Endpoint | Description | Auth Required | Response |
|---|---|---|---|---|
| GET | /pipelines/:id/stream | Subscribe to real-time updates | ✅ Yes | Event Stream (SSE) |
The system consists of three main components, each running in a separate pod inside the Kubernetes cluster:
- Serves the user interface.
- Exposes port 80 via a NodePort service (
frontend-service). - Uses Nginx as a reverse proxy to forward API requests (
/api/) to the REST API.
- Handles authentication, user management, and pipeline execution.
- Exposes port 8080 via a NodePort service (
rest-api-service). - Calls the gRPC Server for specific operations.
- Uses Kubernetes ConfigMaps & Secrets for environment variables.
- Provides high-performance operations for internal use.
- Exposes port 50051 via a ClusterIP service (
grpc-server). - Only accessible within the cluster, meaning users cannot directly call it.
- Uses Kubernetes ConfigMaps & Secrets for configuration.
- The React app is served by Nginx.
- When a user performs an action (like logging in or starting a pipeline), Nginx forwards API requests to the REST API via /api/*.
- The REST API handles authentication, user management, and pipeline execution.
- It interacts directly with Supabase for database operations.
- The democtl CLI tool interacts with the gRPC Server via port 50051.
- The gRPC Server does not expose a NodePort, meaning it is not accessible externally.
- This design ensures better security and performance since gRPC is optimized for fast internal communication.
- Kubernetes ConfigMaps and Secrets store database connection details and API keys.
- Both REST API and gRPC Server pods use these environment variables for secure communication.
- Pod:
frontend-pod - Image:
hsri/frontend:v1.0.0 - Service Type: NodePort
- Port Exposed: 80 (external), mapped to
30080 - Reverse Proxy: Nginx forwards
/api/requests to the REST API.
- Pod:
rest-api-pod - Image:
hsri/rest-api:v1.0.0 - Service Type: NodePort
- Port Exposed: 8080, mapped to
30081 - Communicates with: gRPC Server for backend processing.
- Pod:
grpc-server-pod - Image:
hsri/grpc-server:v1.0.0 - Service Type: ClusterIP (only accessible within the cluster)
- Port Exposed: 50051
- Communicates with: REST API internally.
- ConfigMaps (
supabase-config)- Stores database connection details (
SUPABASE_DB).
- Stores database connection details (
- Secrets (
supabase-secrets)- Stores API keys (
SUPABASE_URL,SUPABASE_API_KEY). - Used by both REST API and gRPC Server.
- Stores API keys (
| Component | Pod Name | Service Type | Exposed Port | Purpose |
|---|---|---|---|---|
| Frontend | frontend-pod | NodePort | 80 → 30080 | Serves React UI via Nginx |
| REST API | rest-api-pod | NodePort | 8080 → 30081 | Handles API requests and business logic |
| gRPC Server | grpc-server-pod | ClusterIP | 50051 | Processes backend operations for REST API |
| ConfigMaps & Secrets | supabase-config & supabase-secrets | - | - | Stores database credentials and API keys |



