The Urban Model Builder is a collaborative webtool for creating and sharing simulation models. It is based on the Node.js simulation library and comes with a full frontend, backend and Keycloak as an authentication and authorization management system.
Run the setup script:
npm run setup
Start the database:
docker compose up
Start the backend:
cd hcu-urban-model-builder-backend && npm run migrate && npm run dev
Start the client:
cd hcu-urban-model-builder-client && npm run start
Publish a new Feathers Client Version:
npm run feathers-client:version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
The Arguments for the npm script feathers-client:version are the same as npm version.
To deploy the latest version, run the following script on the server:
./scripts/deploy.shTo apply the latest database migrations, execute the following script on the server:
./scripts/deploy.shThe admin endpoints are protected by a token-based authentication system. The token is stored as a hash in the environment variable ADMIN_TOKEN in the backend configuration.
To create a new admin token hash, run the following command:
npm run hash-password <password>This will generate a new hash for the given password. Store it in the ADMIN_TOKEN environment variable in your backend environment configuration.
The token is used as a bearer token for authenticating requests to the /admin endpoints. When making requests to admin endpoints:
- Use the original unhashed password in your Authorization header
- Format the header as
Authorization: Bearer <your-unhashed-password>
Example using curl:
curl -H "Authorization: Bearer your_admin_password" https://your-api-url/admin/endpointThe system will hash the provided token and compare it with the stored ADMIN_TOKEN hash to authenticate administrative requests.