Skip to main content

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

  1. Move into the repository folder:
cd registration
  1. Build the JAR (tests skipped for faster builds):
mvn clean package -DskipTests

The JAR will be created in:

target/registration-2.0.0.jar
  1. 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:

  1. Database
  2. Registration Service
  3. Authorization Server (token-generator)
  4. Reverse Proxy
  5. Resource Server (nidam)
  6. 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

  1. Download Nginx for Windows from https://nginx.org/ and extract it to e.g., C:\nginx
  2. Copy the contents of the build/ folder into:
C:\nginx\html\react-ui\

Make sure the path contains index.html directly inside react-ui.

  1. Edit C:\nginx\conf\nginx.conf and replace the server { ... } 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";.

  1. Start Nginx:
cd C:\nginx
C:\nginx> .\nginx.exe
  1. 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.