feat: local dev setup with SSR fix and one-command dev script

- Add Next.js instrumentation.ts to polyfill Node.js v25+ broken localStorage
- Add dev-setup.sh for one-command local development setup
- Disable Supabase analytics in config.toml (avoids slow logflare image pull)
- Switch backend dev script to tsx watch for better DX

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Dennis
2026-03-06 22:31:11 +01:00
parent 1c545c93b4
commit 4607af8def
5 changed files with 656 additions and 4 deletions
@@ -0,0 +1,24 @@
/**
* Next.js instrumentation — runs before any other code on the server.
* Patches the broken Node.js v25+ localStorage (--localstorage-file not set).
*/
export async function register() {
if (typeof globalThis.localStorage !== "undefined") {
const ls = globalThis.localStorage;
if (typeof ls.getItem !== "function") {
const store = new Map<string, string>();
Object.defineProperty(globalThis, "localStorage", {
value: {
getItem: (key: string) => store.get(key) ?? null,
setItem: (key: string, val: string) => { store.set(key, val); },
removeItem: (key: string) => { store.delete(key); },
clear: () => { store.clear(); },
get length() { return store.size; },
key: (i: number) => Array.from(store.keys())[i] ?? null,
},
writable: true,
configurable: true,
});
}
}
}
@@ -315,7 +315,7 @@ deno_version = 1
# secret_key = "env(SECRET_VALUE)"
[analytics]
enabled = true
enabled = false
port = 54327
# Configure one of the supported backends: `postgres`, `bigquery`.
backend = "postgres"