Add better static file handling#391
Merged
Merged
Conversation
binaryoverload
previously approved these changes
Mar 1, 2026
binaryoverload
previously approved these changes
Mar 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR refactors static asset delivery in juxt-web by replacing custom per-file routers with an express.static()-based router, and reorganizing asset URLs under /assets while keeping a small set of global files at the domain root.
Changes:
- Introduces
staticRouter(express.static) for/assetsand root-global files (/robots.txt,/manifest.json,/favicon.ico), and adds anentrypointRouterfor/ -> /titles/show. - Updates web/portal/ctr React views to reference the new
/assets/<platform>/...asset paths and the root/manifest.json. - Updates build output copying to include
webfiles/global/*indist/.
Reviewed changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/juxtaposition-ui/webfiles/global/robots.txt | Adds new global robots.txt content. |
| apps/juxtaposition-ui/webfiles/global/manifest.json | Updates icon URLs to new /assets/web/... paths. |
| apps/juxtaposition-ui/tsup.config.ts | Adjusts build-time asset copying (server + global webfiles). |
| apps/juxtaposition-ui/src/services/juxt-web/views/web/userPageView.tsx | Updates banner image path to /assets/web/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/web/root.tsx | Switches manifest to /manifest.json and updates CSS/JS URLs to /assets/web/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/web/messageThread.tsx | Updates painting JS URL to /assets/web/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/web/login.tsx | Updates favicon/icon references and CSS/JS URLs to /assets/web/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/web/firstRunView.tsx | Updates CSS URL to /assets/web/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/portal/userPageView.tsx | Updates banner image path to /assets/portal/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/portal/root.tsx | Updates CSS/JS URLs to /assets/portal/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/portal/newPostView.tsx | Updates “no image” preview path to /assets/portal/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/portal/firstRunView.tsx | Updates CSS/JS URLs to /assets/portal/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/portal/errorView.tsx | Updates error image path to /assets/portal/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/ctr/root.tsx | Updates CSS/JS URLs to /assets/ctr/.... |
| apps/juxtaposition-ui/src/services/juxt-web/views/ctr/firstRunView.tsx | Updates CSS/JS URLs to /assets/ctr/.... |
| apps/juxtaposition-ui/src/services/juxt-web/routes/web/robots.ts | Removes old robots router. |
| apps/juxtaposition-ui/src/services/juxt-web/routes/web/pwa.ts | Removes old PWA router. |
| apps/juxtaposition-ui/src/services/juxt-web/routes/index.ts | Replaces old route exports with STATIC + ENTRYPOINT. |
| apps/juxtaposition-ui/src/services/juxt-web/routes/console/web.ts | Removes old bespoke static-file router. |
| apps/juxtaposition-ui/src/services/juxt-web/routes/console/static.ts | Adds new express.static()-based static file routing. |
| apps/juxtaposition-ui/src/services/juxt-web/routes/console/entrypoint.ts | Adds router for / redirect to /titles/show. |
| apps/juxtaposition-ui/src/services/juxt-web/index.ts | Mounts new static + entrypoint routers before discovery/subdomain routing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Contributor
Author
|
Looks good. I'm fine with letting esbuild handle the background.png bundling. Still want to have @ashquarky's input on the platform namespacing before it gets merged |
ashquarky
requested changes
Mar 1, 2026
ashquarky
left a comment
Member
There was a problem hiding this comment.
Partial review from in bed ^^;
1 task
ashquarky
previously approved these changes
Mar 5, 2026
mrjvs
enabled auto-merge
March 5, 2026 08:29
mrjvs
disabled auto-merge
March 5, 2026 08:29
Merged
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.
Changes:
web/robots.ts,console/web.tsandweb/pwa.tswith a static file router:console/static.tsexpress.static(). This will give us better caching and will make cloudflare more speedy./assets. Example for portal:/assets/portal/css/juxt.cssNotes:
/assets/my-file) or done statically (/assets/ctr/my-file)/webfiles). It also doesn't rely on the domain as cache key (so maybe we can do path based routing on dev at some point)Resolves #367