Skip to content

Simplify SSR setup#1063

Merged
chrsamp merged 2 commits into
developfrom
dev-44-develop-boilerplate-new-appointment-booking-app
May 28, 2026
Merged

Simplify SSR setup#1063
chrsamp merged 2 commits into
developfrom
dev-44-develop-boilerplate-new-appointment-booking-app

Conversation

@veenupunyani
Copy link
Copy Markdown
Collaborator

  • Replace SSR setup with a client-side Vite React app and simplify runtime server.
  • Removed server-side entry and SSR rendering, renamed client entry to main.tsx using createRoot, and updated index.html to remove SSR outlet.
  • package.json scripts now use vite for dev and build.
  • server.js simplified to a static file server that serves dist files and exposes /config/runtime-config.json.
  • Dockerfile and compose.yaml adjusted to run the frontend image (added appointment-booking service in compose, exposed port 5173, and updated Postgres image/ports).
  • Documentation updated across README files to document the new React Vite app and dev/run instructions.

Replace SSR setup with a client-side Vite React app and simplify runtime server. Removed server-side entry and SSR rendering, renamed client entry to main.tsx using createRoot, and updated index.html to remove SSR outlet. package.json scripts now use vite for dev and build. server.js simplified to a static file server that serves dist files and exposes /config/runtime-config.json. Dockerfile and compose.yaml adjusted to run the frontend image (added appointment-booking service in compose, exposed port 5173, and updated Postgres image/ports). Documentation updated across README files to document the new React Vite app and dev/run instructions.
Copy link
Copy Markdown
Collaborator

@chrsamp chrsamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@veenupunyani, all the changes to remove SSR and switch to client-side rendering look good to me.

Now that SSR has been removed, server.js is only doing static file serving plus the config JSON endpoint. I don’t think we should be writing a custom Node HTTP server for that: it's a change from our existing nginx frontend pattern and isn't something we'd want in production.

Can we switch this to just build the Vite app and serve dist/ from nginx, as we do with the current Q frontend and appointment-frontend? If the runtime config is still required, let’s solve that explicitly with a generated/static config file as we currently do for both apps.

@josekudiyirippil should be able to help with the nginx Dockerfile, it's the same model we have for both frontends. That will also simplify his work going forward.

Suggested changes:

  • Remove server.js entirely in favour of using nginx to serve the client build from /dist
  • The static assets in src/assets/img are not being imported now that we are using the BCGov components and can be removed from the repo.
  • ci_output.txt should be removed and added to .gitignore.
  • Fix small typo on line 32 of README.md ("developement")

Switch  to nginx and serve built assets statically. Added nginx.conf and public/config/runtime-config.json, removed the custom Node server and in-image logos, and updated Dockerfile to copy dist into /app and run nginx on 8080. Updated package.json preview script to use vite preview, adjusted docker compose port mapping (5173:8080) and README instructions, and added ci_output.txt to .gitignore while deleting the file. Also expanded local CORS origins in api/config.py to include Vite ports 5173/5174.
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@chrsamp chrsamp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @veenupunyani!

FWIW, I know the existing app is also on nginx:1.25.3 and I get why we're also pinning that version, but we'll want to update this in a future sprint (it's way out of date). I've built and run the container, and both local dev and the Docker image are working locally, so I'll go ahead and merge.

@chrsamp chrsamp merged commit d0e2d3c into develop May 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants