This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
EveSynapse front end
How the browser side of EveSynapse works, for anyone changing it. The short version: the server renders finished HTML, JavaScript only ever enhances it, and there is no build step. If you are looking for the framework, this document is it: the conventions below are the framework, and the test suite enforces the load- bearing ones.
The model
- Server-rendered, always. Go templates produce complete
pages. With JavaScript disabled the site still works: the nav
is
<details>-driven, forms submit, panels are simply unfolded. Every script is progressive enhancement, never a requirement. - No framework, no bundler, no TypeScript, no npm. This is deliberate and settled. The deploy artifact is one Go binary with its core assets embedded (scheme wallpapers and landing videos can come from the asset CDN), and nothing in the deploy path may depend on a Node toolchain or a package registry. CI runs Node only to execute the JS tests. For more info on why, see the bottom of this page.
- Precompute at ingest, never at render applies to the front end too: pages read stored results and ship them as HTML or as a JSON payload. Client code formats and interacts; it does not go back to the server for data the render already had.
The files (internal/app/static/)
boot.js: a plain script in<head>, not deferred, so a saved theme/nav state applies before first paint. Dependency-free and tiny on purpose: every byte here delays first paint.swap.js: the persistent shell. Intercepts navigation, fetches the next page, replaces#main-content, and fires the lifecycle events below. The sidebar, top bar and shell survive across pages.app.js: shell behavior that binds once (quick jump, theme toggle, search suggestions, the modal implementation, the content-ready bus itself) plus the generic widget kit.- Per-surface files, loaded only where they belong (base.html
gates them on section/page):
fit.js(fitting),plan.js(build planner),pi.js(PI planner),push.js(notification settings),map.js(the universe map: a canvas drawn from the stored, content-hashed payload at/map/universe.json, its colors read frommap.csstokens and the legend's.sec-Nswatches), and the surface files split out of app.js. A page script gated to one page loads after the shell's firstcontent-ready, so it runs once for the document as it stands and subscribes withonReadyfor later swaps (plan.jsandmap.jsshow the shape). sw.js: the service worker.- CSS:
layout.css(the layout framework: where page regions go and how they collapse; see "Layout" below),style.css(the core; it is at the practical size ceiling, so a feature with substantial styles gets its own file, linked in base.html afterplan.css: seeplan.css,tradeideas.css),bg.css(wallpaper). Both themes are one stylesheet: dark by default, light underhtml[data-theme="light"]. - Every asset URL carries
?v={{.AssetVersion}}. Cache-busting depends on it; never link a static file without it.
Why no HTMX, or Alpine.js,etc?
It's a fair question and the decision comes with real tradeoffs, but ultimately the choice is clear.
- Performance & Memory Overhead: Alpine parses the DOM on every swap and wraps state in JavaScript Proxy objects, while HTMX adds a ~14KB runtime to parse custom attributes and manage XHR lifecycles. Our custom made, purpose built swap.js + app.js setup runs directly against native DOM APIs (querySelectorAll, hidden, dataset) inside EveSynapseContent.onReady(root) in microseconds with zero external dependencies.
- Strict CSP Compliance: Alpine’s standard build requires unsafe-eval (because it evaluates JS expressions inside HTML strings like x-show="tab === 'price'"). Our architecture uses clean data-* attributes (data-tabs, data-fold, data-wmore) and type="application/json" payloads, keeping our Content Security Policy completely locked down with zero inline JS execution. This is by design.
- Built-in Progressive Enhancement & Test Enforcement: Neither HTMX nor Alpine enforces our no-JS fallback contract or container-driven responsive rules (TestFrameworkPageSheetsMeasureTheirOwnSpace). Our [data-tabs] and [data-fold] widgets in app.js already guarantee that if JS fails or hasn't run yet, every panel renders cleanly as a stacked document with headings intact.
- The real trade off (and why it doesn't apply to us): Those libraries shine for teams that want to avoid writing custom DOM-bridging code from scratch, or for apps with complex, deeply nested client-side form state (like a 20-step wizard where 15 inputs dynamically recalculate each other before hitting the server). Because our Go in-memory index can render and swap an entire regional view, for instance, faster than a client framework can diff a virtual DOM, this is the cleanest possible setup.
So while, yes, this does make it harder to learn and extend initially, the design goals demand it. Trading familiarity and development speed over the user experience and actual performance is a backwards way to approach a project like this, in my view.
Why no Tailwind, etc?
Again, a fair question, and with a similar reasoning but also some specific ones that we feel are superior for the type of layout this complex of an app requires (or at least the solution we landed on).
- Container-Driven Responsiveness vs. Blind @media Breakpoints: Tailwind relies on viewport breakpoints (md:grid-cols-2, xl:grid-cols-4) that only know the width of the browser window, not the actual space left inside the page shell after sidebars, split panes, or foldable drawers open. Our primitives (.l-switcher, .l-tiles, .l-cluster, and your app.js table-to-card measurement) measure the actual container width. Whether a table is full-width or tucked inside a half-width split pane, it adapts automatically without brittle @media overrides.
- No Ragged KPI Rows/Contaiers (.l-tiles vs. grid-cols-*): With Tailwind, a 4-card or 6-card KPI row using sm:grid-cols-2 lg:grid-cols-3 will inevitably leave a single orphan card dangling on its own row at intermediate widths. Our .l-tiles primitive enforces symmetric stepping (4 → 2 → 1 or 6 → 3 → 2 → 1) based on child count and available space, guaranteeing that widgets, market KPI strips, and other similar UI elements stay flush at every width.
- Clean Go Templates & Smaller Swap Payloads: Tailwind bloats HTML with repetitive 15-class strings on every and (e.g., class="py-2 px-3 text-right font-mono text-xs border-b border-amber-900/20"). Because swap.js sends rendered HTML over the wire on navigation and our order books can hold hundreds of rows, semantic classes (.l-page, .l-panel, .l-spread) keep our Go templates readable and cut raw HTML payload sizes significantly.
- Enforced Architectural Contracts via Go Tests: Because our layout rules live in a unified, predictable stylesheet rather than thousands of ad-hoc inline utilities, our Go test suite (like TestFrameworkPageSheetsMeasureTheirOwnSpace) can statically verify that every page obeys your layout invariants before code ever ships.
As above, I acknowledge that this has a learning curve when wanting to extend or modify a page, but the tradeoff philosophy is consistent here and applies cleanly. We have made every effort to keep code understandable with plain English names and kept idioms to a minimum, or used common ones where possible.
The rest of this document has its own pages: