1import { RegistryProvider } from "@effect/atom-react";
2import {
3 HeadContent,
4 Outlet,
5 Scripts,
6 createRootRoute,
7} from "@tanstack/react-router";
8import type { ReactNode } from "react";
9
10export const Route = createRootRoute({
11 head: () => ({
12 meta: [
13 { charSet: "utf-8" },
14 { name: "viewport", content: "width=device-width, initial-scale=1" },
15 { title: "TanStack Start + Effect RPC + Drizzle" },
16 ],
17 }),
18 component: RootComponent,
19});
20
21function RootComponent() {
22 return (
23 <Document>
24 {/* One AtomRegistry for the whole app — every AtomRpc query/mutation
25 atom resolves against this registry. */}
26 <RegistryProvider>
27 <Outlet />
28 </RegistryProvider>
29 </Document>
30 );
31}
32
33function Document(props: Readonly<{ children: ReactNode }>) {
34 return (
35 <html lang="en">
36 <head>
37 <HeadContent />
38 </head>
39 <body
40 style={{
41 margin: 0,
42 fontFamily: "ui-sans-serif, system-ui, sans-serif",
43 background: "#f8fafc",
44 color: "#0f172a",
45 }}
46 >
47 {props.children}
48 <Scripts />
49 </body>
50 </html>
51 );
52}