KKIMS on-site docs
Local rehearsal

Run the CMS, worker and website locally

Prepare the website's content snapshot and images, start the CMS on 3101, the website dev server on 3100 and the worker, sign in with the test users, and check each one.

The three apps run straight on your machine, against the services from Services:

App Address Reads
CMS http://localhost:3101 The database, Keycloak and the assets bucket
Website dev server http://localhost:3100 (pages under /bengaluru/...) A snapshot of the published content and the resized images, not the database
Worker No port The jobs table: it runs publishing, media resizing, translation and site build triggers

The worker is easy to forget. Without it, the CMS's Publish button only queues the job and nothing is published, and uploaded images never get their sizes.

#Before you start

  • The services are up and the database is loaded: Services, Database and content.
  • Nothing else uses ports 3100 and 3101 (an earlier copy of the apps, for example).
  • On Windows: Application Control allows the Next.js compiler (@next/swc-win32-x64-msvc). See Windows notes.

#Quick way

Run from <KIMS_FOLDER>:

bash
node deployment-steps/scripts/deploy.mjs local apps prepare
node deployment-steps/scripts/deploy.mjs local apps start
bash
node deployment-steps/scripts/deploy.mjs local apps prepare
node deployment-steps/scripts/deploy.mjs local apps start
powershell
node deployment-steps/scripts/deploy.mjs local apps prepare
node deployment-steps/scripts/deploy.mjs local apps start

apps prepare does steps 1 to 3 below and ends OK: the website's content and images are ready. About 10 seconds once the images are copied.

apps start starts all three in the one window. Each line of output starts [cms], [website] or [worker]. After a minute or two:

text
  cms      ready at http://localhost:3101
  website  ready at http://localhost:3100/bengaluru/doctors/
  worker   ready (running)

OK: cms, website, worker running. Press Ctrl+C to stop.

It runs until Ctrl+C, which stops all three. If one of them stops, it stops the others. apps start cms worker starts only those two. It refuses to start if a port is taken.

Note

apps start was tested on Windows (Git Bash, 2026-11-28). On Linux and macOS it stops the apps with a plain SIGTERM to each Node process rather than Windows' taskkill /T. If a port is still taken after Ctrl+C, find and stop the leftover process: Port already in use.

#Prepare the website's content

The website dev server reads a snapshot of the published content and the resized images. These three outputs are all gitignored.

#1. Export the published content

Run from the repo:

bash
npm run content:export -- --out .local-content --clean
bash
npm run content:export -- --out .local-content --clean
powershell
npm run content:export -- --out .local-content --clean

It writes the newest published version as JSON under .local-content/content (2,750 files after the first load). --version <n> exports another version.

#2. Write the media manifest

bash
npm run media:manifest -- --out apps/website/media-manifest.json
bash
npm run media:manifest -- --out apps/website/media-manifest.json
powershell
npm run media:manifest -- --out apps/website/media-manifest.json

The list of images the website uses, with their sizes.

#3. Copy the resized images

The dev server serves images from apps/website/public/media. They come from the bundle's assets/derived folder: 10,173 files, about 330 MB. (In a real deploy, the site build copies them from the assets bucket instead.) Run from the repo:

bash
mkdir -p apps/website/public/media
cp -R ../../KIMS-v2-handover-2026-11-24/data-bundle/assets/derived/. apps/website/public/media/
bash
mkdir -p apps/website/public/media
cp -R ../../KIMS-v2-handover-2026-11-24/data-bundle/assets/derived/. apps/website/public/media/
powershell
New-Item -ItemType Directory -Force apps/website/public/media
Copy-Item -Recurse -Force ../../KIMS-v2-handover-2026-11-24/data-bundle/assets/derived/* apps/website/public/media/

apps prepare copies only files that are missing or a different size, so running it again is quick.

#Start the apps by hand

Each app runs in its own terminal window. Leave each window open; Ctrl+C stops it.

Warning

npm run dev does not work on Windows: the repo's script starts npm and next in a way Windows can't run without a shell, and the website's dev script uses Unix-only VAR=value syntax. On Linux and macOS it works, but it starts only the CMS and the website (with the repo's test content, not the loaded content), not the worker. So use the commands below on every system, or the quick way.

#4. Start the CMS

Run from the repo. On Linux and macOS the shell loads .env.local into the environment; on Windows the PowerShell line does the same.

bash
cd apps/cms && set -a && . ../../.env.local && set +a && node ../../node_modules/next/dist/bin/next dev --port 3101
bash
cd apps/cms && set -a && . ../../.env.local && set +a && node ../../node_modules/next/dist/bin/next dev --port 3101
powershell
Set-Location apps/cms
Get-Content ../../.env.local | ForEach-Object { if ($_ -match '^([A-Za-z_][A-Za-z0-9_]*)=(.*)
    
Built 2026-11-29. Commands are shown for the system picked at the top; every block has all three.
) { Set-Item -Path "Env:$($Matches[1])" -Value $Matches[2] } } node ../../node_modules/next/dist/bin/next dev --port 3101

You should see Ready and Local: http://localhost:3101.

Note

On Windows the tested way is the Linux line, run in Git Bash, or the quick way. The PowerShell lines do the same and work in Constrained Language Mode, but were not tried on this project. Don't use node --env-file=... next dev: Next passes Node's flags to its workers through NODE_OPTIONS, which refuses --env-file.

#5. Start the website

In a second window, from the repo:

bash
cd apps/website && KIMS_INCLUDE_INTERNAL=1 KIMS_CONTENT_ROOT=../../.local-content node ../../node_modules/next/dist/bin/next dev --port 3100
bash
cd apps/website && KIMS_INCLUDE_INTERNAL=1 KIMS_CONTENT_ROOT=../../.local-content node ../../node_modules/next/dist/bin/next dev --port 3100
powershell
Set-Location apps/website
$env:KIMS_INCLUDE_INTERNAL = "1"
$env:KIMS_CONTENT_ROOT = "../../.local-content"
node ../../node_modules/next/dist/bin/next dev --port 3100

You should see Ready and Local: http://localhost:3100. KIMS_INCLUDE_INTERNAL=1 includes the internal preview pages; KIMS_CONTENT_ROOT points at the snapshot from step 1.

#6. Start the worker

In a third window, from the repo. The worker runs from apps/cms, with Node's react-server condition:

bash
cd apps/cms && node --env-file-if-exists=../../.env.local --conditions=react-server --import tsx ../worker/src/main.ts dev
bash
cd apps/cms && node --env-file-if-exists=../../.env.local --conditions=react-server --import tsx ../worker/src/main.ts dev
powershell
Set-Location apps/cms
node --env-file-if-exists=../../.env.local --conditions=react-server --import tsx ../worker/src/main.ts dev

You should see a line with "message":"worker started". In dev mode it also runs the scheduled tasks (scheduled publishing, translation, the build reaper, alerts, the reviews sync) from its own clock, which on KIMS are CronJobs.

#Sign in

#7. The first Admin, then everyone else

The bundle has no CMS people. Open http://localhost:3101 and sign in as admin@kims.local; the password is in local/keycloak/kims-realm.json. Because the CMS has no people yet, KIMS_BOOTSTRAP_ADMINS in .env.local makes that account its first Admin.

The Admin then adds others on the People screen, by email, with their CMS roles: for example editor@kims.local and reviewer@kims.local. Each person needs the cms-access role in Keycloak (the test users already have it, except outsider@kims.local) as well as a row on the People screen. There are no invitations or passwords in the CMS.

#Check

Check How You should see
The CMS is up and reaches the database curl -s "http://localhost:3101/api/health?check=ready" (Windows: curl.exe -s "...") {"status":"ready","database":"ok"}
Signing in works Sign in at http://localhost:3101 as admin@kims.local The dashboard, with the real content: 183 doctors, 72 specialties, 320 conditions, 1,331 treatments
The media library The CMS's Media screen Images show
People without the role are refused Sign out, sign in as outsider@kims.local /login?error=no-access
Signing out ends the Keycloak session Sign out, then open the CMS again The Keycloak sign-in page, not straight back in
The worker runs jobs Upload an image in the Media library Its sizes appear within a minute
The website Open http://localhost:3100/bengaluru/doctors/ The doctors page, with photos. /doctors on its own is a 404: pages live under /bengaluru/...

The acceptance checks for review and publishing are on Acceptance; you can run most of them here first.

#Seeing a CMS change on the local website

The dev website shows the snapshot from steps 1 to 3, not the database. To see a change:

  1. In the CMS, save the change and submit it for review. A different person approves it (nobody can approve their own change). Then publish it from the Publishing screen. The worker must be running.
  2. Run steps 1 to 3 again, or node deployment-steps/scripts/deploy.mjs local apps prepare.
  3. Restart the website: Ctrl+C in its window, then step 5 again.

The real, built website is made by the site build. After a publish, the worker also tries to start a build through Jenkins; without JENKINS_JOB_URL in .env.local the Builds screen says Jenkins is unavailable. See Jenkins.

#The emergency image blocks the first publish

One image never reached the old platform's storage: emergency_CoE.png, the hero of en/centres-of-excellence/emergency-critical-care. Until that page has an image that exists, every publish is refused, because the publish check looks at the whole site. Fix it here the same way you will on KIMS: upload an image in the Media library and choose it on that page, or choose another hero. See Website.

#If it goes wrong

What you see Likely cause What to do
apps start says port 3101 is already in use An earlier CMS is still running Stop it: Port already in use
An Application Control policy has blocked this file when Next starts (Windows) The Next.js compiler is blocked Windows notes
Can't start: the website's content snapshot isn't there Steps 1 to 3 not run local apps prepare
Signing in loops, or says access is unavailable Issuer, client secret or redirect doesn't match, or the account's email isn't verified Compare KEYCLOAK_ISSUER and KEYCLOAK_CLIENT_SECRET with local/.env.example; Keycloak troubleshooting
outsider@kims.local gets in KEYCLOAK_ACCESS_ROLE changed Remove it from .env.local
Signing out in Keycloak doesn't end the CMS session at once Keycloak can't reach the CMS for back-channel logout (CMS bound to [::1] only, or a firewall) Don't pass --hostname localhost to next dev; see Services. The session still ends within 5 minutes
The website shows pages without images Step 3 not run, or the manifest is old Steps 2 and 3, then restart the website
A published change doesn't show on the website The website shows a snapshot Seeing a CMS change on the local website
Publish does nothing The worker isn't running Step 6
Every publish is refused The emergency image The emergency image blocks the first publish
npm run dev fails (Windows) Not supported on Windows Quick way, or steps 4 to 6

#Sources

{{pager}}