feat: setup SSR rendering for improved SEO#619
Open
Conversation
- Add entry-server.tsx for server-side rendering entry point - Add server.ts with Express SSR server implementation - Update vite.config.ts to support SSR build mode - Add build:client, build:ssr, and server scripts to package.json - Add express and @types/express dependencies - Update Dockerfile to use SSR server instead of nginx - Add SSR_SETUP.md documentation This enables SEO-friendly rendering of threads and profiles by pre-rendering pages on the server before sending to the client. Closes v0l#616
v0l
requested changes
Mar 31, 2026
Owner
v0l
left a comment
There was a problem hiding this comment.
Use Bun for prod server, make sure to setup some data loading with correct hydration path using react router
Take a look at https://github.com/LNVPS/web for reference
| import path from "node:path" | ||
| import { fileURLToPath } from "node:url" | ||
|
|
||
| import express from "express" |
- Replace Express server with Bun.serve() for production - Add server/prod.ts for high-performance Bun-based serving - Add server/ssr-render.ts for shared SSR render logic - Update entry-server.tsx to use React Router's createStaticHandler for proper data loading with route loaders - Add entry-client.tsx for client-side hydration with SSR locale/messages - Update index.html with SSR placeholders (<!--ssr-cache-->) - Add server:prod script for production serving with Bun - Proper hydration path: locale and messages passed via window.__SSR_LOCALE__ and window.__SSR_MESSAGES__ for correct client hydration This follows the reference implementation pattern for improved SEO and faster initial page loads.
Contributor
Author
|
Hey @v0l! 👋 I've updated the SSR setup with Bun for the production server and proper React Router data loading with correct hydration. Here's what was done: Changes made1. Bun Production Server (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR sets up Server-Side Rendering (SSR) for the Snort application to improve SEO by rendering threads and profiles from the server side.
Changes made
entry-server.tsx- SSR entry point usingrenderToStringandStaticRouterserver.ts- Express-based SSR server implementationvite.config.ts- Added SSR mode detection and separate build outputspackage.json- Addedbuild:client,build:ssr, andserverscriptsexpressand@types/expressdependenciesDockerfile- Changed from nginx to Express SSR serverSSR_SETUP.md- Documentation for SSR setup and deploymentHow it works
build/client/build/server/Benefits
Deployment
Closes #616