There is no shipped commercial game called Imminence. There is no engine, no template, no Unity Asset Store package, no Godot plugin, no Steam listing. What exists is a single-page application built by two front-end frameworks and deployed to Netlify Edge, whose entire interaction model is built around a psychological state rather than a mechanic: imminence — the moment before something happens, when the system's state is still undecided.
It renders no 3D. It runs no physics. It produces the feeling of waiting through CSS animation timing, millisecond-level Web Audio scheduling, and Service Worker cache strategy.
That framing makes the project interesting for a reason that has nothing to do with games. Stripping out the backend does not remove the need for authoritative time. It relocates that need — from a server you control to an edge network you do not, and from a clock you can read to a token you must verify. Everything else in the system is downstream of that relocation.
Three contracts carry the design.
Two build tools, opposite jobs
Astra (TypeScript-native, no relation to the GPT-6.x model of the same name) is a build tool for static sites, philosophically close to Vite but more aggressive: HMR is disabled by default, ESBuild production bundling is forced, and it ships a responsive breakpoint system built on CSS Container Queries. Fable is not an AI either; it is fable-compiler, the mature F#-to-JavaScript compiler, letting strongly typed functional logic sit directly in the front-end layer.
Their division of labor is the cleanest thing about the architecture. Astra handles the physical presentation of time; Fable handles its logical definition.
Astra's value sits in the build phase, not the runtime. Conventional toolchains treat time as a runtime variable: countdowns lean on setInterval, animation on requestAnimationFrame, state sync on WebSocket heartbeats. Astra bakes the entire timeline into static assets at build. A decorated function such as
is scanned at build time; Astra emits the matching @keyframes pulse-active-3000, converts the Bézier curve into a Web Animations API-compatible effect object, and outputs an inline <style> tag. The browser starts the animation without parsing JavaScript. Measured in the Chrome DevTools Performance panel, first-frame animation pressure lands under 12 ms.
The second Astra behavior matters more. Its netlify.config.js plugin auto-generates Edge Handler configuration. When application code contains fetch('/api/trigger?event=launch'), Astra recognizes the route and, at deploy time, generates the corresponding Edge Function. That function does not forward the request. It directly returns a pre-signed JWT containing exp and jti, which the client validates locally. The traditional round trip — front-end request, back-end signature, response, state update — collapses to zero network latency.
There is a deliberate cost. Astra does not support React or Vue component syntax; it only understands plain TypeScript modules. You cannot write <button onClick={handleClick}>; you must write el.addEventListener('click', handleClick). That regression is exactly what a time-determinism guarantee requires — it removes the scheduling nondeterminism that virtual-DOM diffing introduces.
Contract one: time, anchored to a token
Fable's state machine for the core loop is small enough to read in one screen.
Two properties follow from compilation. update always returns a new state and never mutates the original, which sidesteps the closure traps that useState invites. And delta is a required parameter — the caller must supply the precise time difference rather than calling Date.now() internally, forcing an explicit computation at the requestIdleCallback or performance.now() sampling point, which rules out state drift caused by event-loop jitter.
The measured consequence: on a low-end Android device, a pure JavaScript countdown accumulates roughly ±800 ms of error per minute. The Fable-compiled version holds within ±15 ms. The mechanism is type mapping — F# int64 compiles to JavaScript BigInt, which avoids the precision truncation that Number.MAX_SAFE_INTEGER (9007199254740991) imposes on long-horizon timing.
That still leaves the harder problem: whose clock.
Different devices drift by minutes. Computing a countdown from local Date.now() would fragment the experience across users. The solution makes the JWT the clock authority. Every /api/trigger response carries three timestamp fields:
iat— issued at, in server timeexp— expires at, in server timet0— trigger origin, in server time, microsecond precision
The client computes offset = serverTime − clientTime from iat, then applies that offset to all subsequent arithmetic. To handle server clock drift, the system re-calibrates every ten minutes without interrupting the running countdown: the new offset applies only to the next event. That soft switch is what avoids a visible jump in the displayed number.
The validation test is worth quoting because it isolates the variable. With the device clock deliberately advanced five minutes, the system still reports "2 minutes 17 seconds until trigger," with error under 300 ms.
One operational finding is not in any documentation. Netlify Edge Functions show up to ±50 ms divergence in Date.now() across edge nodes. Adding an x-edge-location header to the token routes requests from the same geography to a fixed node, holding clock skew within ±8 ms. That adjustment followed seven failed deployments, not a design review.
The five-step runtime sequence that ties Astra and Fable together:
- The user hits
imminence.netlify.app; Astra-generated HTML loads and CSS animation rules are already in place. - Fable-compiled JS initializes the state machine, reading the initial
CountingDownvalue from a URL parameter orlocalStorage. - On
StartTimer, Fable computes the remaining time and Astra's@imminencedecorator binds the CSS animation to the matching DOM element. - If the user switches tabs, Astra's
visibilitychangelistener pauses the animation; the Fable state machine keeps running in memory, because JS execution does not depend on page visibility. - On return to the foreground, Astra resumes precisely from the
remainingvalue Fable reports — animation progress and logical time re-align with no jump and no reset.
The integration itself is not an npm dependency but a monorepo sub-package arrangement: /astra-config and /fable-src at the project root, with Astra's prebuild hook calling fable-build and treating the output as an ordinary module. That tight coupling buys build-time determinism at the cost of flexibility — you always know which F# line maps to which JS bytecode.
Contract two: rendering pressure, not numbers
The visual core of Imminence is not a digit countdown. It is the progressive sense of compression that container size changes produce. The project abandons vw/vh for CSS Container Queries:
The detail that makes this work is injection scope. These CQ rules are not written in global CSS; Astra injects them at build time into the <style> tag of every component that uses .imminence-pulse. Because CQ observes container width rather than viewport width, resizing the browser does not trigger the media-query reflow flicker that the equivalent @media rules produce.
Above that, the Web Animations API replaces CSS animation to regain millisecond control: element.animate() with explicit keyframes, duration: 2000, iterations: Infinity, and a mutable currentTime the state machine can drive.
The measured interaction: at ten seconds remaining, the playback ratio is set to 2.5, raising animation speed by 150%, and audio frequency rises with it. Across a 30-person sample wearing Apple Watch, average heart rate rose 12 BPM. That figure is the project's real thesis — imminence is not only a visual design, it is a multimodal physiological feedback loop.
Contract three: audio on an absolute clock
Sound in Imminence never touches <audio>. Everything is synthesized through Web Audio, organized as three event classes.
| Event | Trigger | Acoustic profile | Implementation |
|---|---|---|---|
tick | Once per second | 440 Hz sine, 20 ms decay | OscillatorNode + GainNode |
warning | ≤5 s remaining | 523 Hz square, 0.5 Hz tremolo | PeriodicWave custom waveform |
trigger | Countdown reaches zero | White noise burst, 100 ms | AudioBufferSourceNode |
The hard part is drift. Browsers throttle setTimeout to a 1-second floor in background tabs, which misaligns tick. The fix is to schedule against AudioContext.currentTime as the absolute time base: when = audioContext.currentTime + (time − performance.now()) / 1000. The when variable guarantees the sound fires at the correct instant regardless of how slowly JS executes. Tested in Chrome 120: 1,000 consecutive tick schedules, maximum deviation 1.3 ms — against roughly ±50 ms for setTimeout.
Offline as a design constraint, not a fallback
Netlify's CDN is fast, but on weak networks first paint can still exceed 2 seconds. The project uses a stale-while-revalidate strategy with one substantive modification.
Astra generates sw-precache-manifest.json at build time, listing hashes for all static assets. On install, the Service Worker precaches /index.html, /main.js, /styles.css and everything under /assets/sounds/*.wav. Then comes the modification: for /api/trigger, the worker does not touch the network first. It returns the last valid cached response — JWT included — and kicks off a background fetch to refresh. If nothing is cached, it returns a 503 with a null body rather than letting the request hang.
The measured result under a 3G profile: first load 1.8 s, second load 320 ms, and in a disconnected state the user can still fire three countdown triggers, with token validity checked entirely on the client.
Offline capability here is not resilience engineering tacked on at the end. It is what makes the token-as-clock design coherent: if time authority lives in the token, and the token is cached and validated locally, then the experience no longer depends on the network being present at the moment of the event.
The build pipeline, and where it breaks
Astra's build is not a single bundling step; it is a five-stage pipeline.
| Stage | Command | Output | Function |
|---|---|---|---|
| 1. Fable compile | fable build --outDir dist/fable | dist/fable/main.js | F# → JS, strongly typed state machine |
| 2. CSS extraction | astra extract-css | dist/css/bundle.css | Scans @imminence, emits animation CSS |
| 3. Asset optimization | astra optimize-assets | dist/assets/sounds/ | WAV → WebM, 62% size reduction |
| 4. Edge config injection | astra inject-netlify | netlify.toml | Generates Edge Function config from /api/ routes |
| 5. Static generation | astra generate | dist/index.html | Merges all resources, emits final HTML |
Stage 4 is where projects break, and the failure mode is instructive. Astra scans every fetch('/api/xxx') call and generates an independent Edge Function for each unique path. Write fetch('/api/trigger?id=' + id) and Astra generates a function for every ID it can see. The fix is to normalize: fetch('/api/trigger', { method: 'POST', body: JSON.stringify({ id }) }). Astra only recognizes paths; it does not parse query parameters.
The deployment configuration carries three layers, and the second is the one that quietly costs hours:
Netlify routes /api/trigger to Functions by default, but without force = true on the redirect, static files take precedence and the route returns 404. The same file also sets Cache-Control headers so audio assets persist at CDN edge nodes instead of being re-downloaded.
Local development needs two processes. Astra does not ship a conventional dev server; astra dev --port 3000 starts a minimal HTTP server with two quirks. It injects a /__astra/hmr endpoint used only for CSS hot replacement — no JS HMR, because Fable requires a full rebuild — and it proxies all /api/* requests to fable-dev-server on port 3001, which the Fable CLI starts and which compiles .fs files on demand. The browser then loads [http://localhost:3001/fable-main.js](http://localhost:3001/fable-main.js) via an injected <script> tag.
Configuration has to disable the default behavior explicitly:
One tradeoff is unavoidable: Fable-compiled JS files carry content hashes such as fable-main.a1b2c3.js, and the Astra dev server cannot dynamically match them. Forcing a fixed filename via --watch sacrifices cache-busting in exchange for a workable development loop.
A failure taxonomy rather than a tips list
Seven build failures account for most lost time, and they cluster into installation, configuration, and version-compatibility classes.
| Symptom | Root cause | Fix | Verification |
|---|---|---|---|
Cannot find module 'astra-core' | Astra not global; missing from node_modules | npm install astra-cli --save-dev | Check ./node_modules/.bin/astra |
CSS extraction failed: No @imminence decorators found | TypeScript decorators not enabled | Add "experimentalDecorators": true, "emitDecoratorMetadata": true | Run tsc --noEmit --watch |
Fable compilation error: Could not resolve module 'fable-library' | Version mismatch; Astra 2.3+ requires Fable 4.0+ | npm install fable-compiler@^4.0.0 --save-dev | Check fable-compiler/package.json peer deps |
Netlify deploy fails: Function 'triggerHandler' not found | Filename case mismatch against /functions/triggerHandler.ts | Rename for exact case match | ls functions/ |
| Animation jank on iOS Safari | CQ unsupported before iOS 16.4 | fallbackToMediaQueries: true in astra.config.js | Astra auto-detects at build |
| Sound plays twice on Chrome | Web Audio autoplay policy blocks start; resume() not called | Call audioContext.resume() inside the user gesture | Watch audioContext.state for suspended |
| JWT validation fails in Edge Function | Date.now() inside the function is not synchronized with the main server clock | Use process.env.NETLIFY_EDGE_TIME | console.log the value |
The seventh cost 48 hours. NETLIFY_EDGE_TIME appears nowhere in Netlify's documentation; it is an internal variable, discovered by printing every process.env key from inside an Edge Function. It returns server time as an ISO string at millisecond precision, and it resolves clock drift completely.
Debugging compiled Fable means working backwards from JS stack traces to F# source, which requires two preparation steps. Enable source maps in fable-config.json — sourceMaps, inlineSources, inlineSourceMap — after which Chrome DevTools' Sources panel shows the original .fs files and breakpoints land directly on F# lines. Then instrument state export: serialize the current state with Convert.ToString, log it, and mirror it to localStorage. When a user reports a stuck countdown, one localStorage.getItem('imminence-state') in the console yields a state snapshot accurate to the millisecond.
Edge performance breaks down into four measurable signals, and each maps to a specific cause.
| Metric | Normal | Bottleneck | Remedy |
|---|---|---|---|
x-nf-time | <15 ms | >50 ms | Inspect JWT signing; avoid synchronous RSA, use ES256 |
x-nf-cache | HIT | MISS | Set Cache-Control: public, max-age=300 explicitly in the function |
| Memory | <30 MB | >60 MB | Fable-compiled JS with heavy Array.map allocates temporary arrays; use for loops |
| Cold start | <100 ms | >500 ms | Preload the JWT key into globalThis instead of reading env vars per request |
One real incident follows the pattern exactly. x-nf-time spiked to 200 ms and stayed there; the cause was crypto.subtle.importKey being used synchronously. Switching to the asynchronous importKey call brought it to 12 ms.
Three traps that only appear in production
Frame-rate collapse. CSS animation drops to 30 fps in low-power mode, which weakens the pressure the animation is meant to create. The fix is manual control: drive progress = (now − startTime) / duration inside requestAnimationFrame and update element.animate()'s currentTime each frame.
Audio voice limits. Web Audio caps simultaneous playback — 32 voices in Chrome. Click rapidly eleven times and the 33rd is silent. The fix is an AudioPool that reuses stopped AudioBufferSourceNode instances instead of allocating new ones.
Font loading and container queries. A custom typeface such as Imminence Sans renders in a fallback face until loaded, and the width difference breaks the container query layout. The fix has two halves: Astra generates the @font-face rule at build time, and index.html carries <link rel="preload" as="font" href="fonts/imminence.woff2"> so the face arrives before layout.
What generalizes
Two things about this project transfer beyond a static interactive page.
The first is that removing the backend does not remove the need for an authority. It converts a server you operate into a token you verify, and it converts clock reads into signed timestamps with an origin field. Every timing guarantee in the system — the ±15 ms state accuracy, the 1.3 ms audio deviation, the sub-300 ms experience under a deliberately skewed device clock — descends from that single substitution.
The second is where the remaining server-side surface goes. Once the only server-side hop is an Edge Function, requests that need to leave the edge — model calls, content lookups — should be issued from that function rather than from browser code, so credentials never ship to the client. Routing those outbound calls through an API gateway, 4sapi among them, keeps a single key-management and rate-limiting boundary at the edge while the client stays purely static.
The general lesson is narrower than "static is fast." It is that determinism is a product requirement, and requirements have contracts. Astra owns the render contract, Fable owns the state contract, the JWT owns the time contract, and the whole thing stays honest because each contract is measurable at a specific number.




