Deployment Guide
This guide explains how to build and run all Nidam components in a production-like environment.
Spring Boot Microservices
All backend services in Nidam are standard Spring Boot applications. They are packaged as executable JAR files and run with java -jar
.
Example: Registration Service
- Move into the repository folder:
cd registration
- Build the JAR (tests skipped for faster builds):
mvn clean package -DskipTests
The JAR will be created in:
target/registration-2.0.0.jar
- Run the service:
java -jar target/registration-2.0.0.jar
Repeat the same steps for each service.
Build & Run Order
Because services depend on each other, start them in the following order:
- Database
- Registration Service
- Authorization Server (token-generator)
- Reverse Proxy
- Resource Server (nidam)
- BFF
React SPA
The frontend is a Create React App (CRA) project.
Build
From the SPA project root:
npm install
npm run build
This generates a static build/
directory.
Deployment Requirement
The SPA must always be served under the path:
/react-ui/*
Example: Nginx Configuration
- Download Nginx for Windows from https://nginx.org/ and extract it to e.g.,
C:\nginx
- Copy the contents of the
build/
folder into:
C:\nginx\html\react-ui\
Make sure the path contains index.html directly inside
react-ui
.
- Edit
C:\nginx\conf\nginx.conf
and replace theserver { ... }
block with the following:
server {
listen 4001;
server_name _;
# Serve files from here
root "C:/nginx/html";
# Debug header to confirm we hit this server
add_header X-Spa-Debug "nginx-react-ui" always;
# Exact: /react-ui (no trailing slash)
# Serve index.html directly, no redirect, no internal rewrite
location = /react-ui {
try_files /react-ui/index.html =404;
}
# Prefix: /react-ui/ (assets + SPA routes)
# Try static files, then fall back to SPA index
location ^~ /react-ui/ {
try_files $uri $uri/ /react-ui/index.html;
}
# Safety: don’t emit absolute Location headers for any internal rewrites
absolute_redirect off;
}
For Windows systems, you need to wrap the root path in double quotes and replace backslashes \
with forward slashes /
,
e.g., root "C:/nginx/html";
.
- Start Nginx:
cd C:\nginx
C:\nginx> .\nginx.exe
- Test the SPA Visit http://localhost:4001/react-ui. You should see your SPA. ✅
Note: Always access the SPA through the Nidam reverse proxy: http://localhost:7080/react-ui.
If you use a different SPA, follow its own deployment instructions.