Skip to content

Commit 9d58e6c

Browse files
deriving client
1 parent a73da63 commit 9d58e6c

File tree

15 files changed

+1562
-9
lines changed

15 files changed

+1562
-9
lines changed

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
}
11+
}

apps/client/.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Local
2+
.DS_Store
3+
*.local
4+
*.log*
5+
6+
# Dist
7+
node_modules
8+
dist/
9+
.vinxi
10+
.output
11+
.vercel
12+
.netlify
13+
.wrangler
14+
15+
# IDE
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea

apps/client/index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>TanStack Router</title>
7+
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
8+
<style type="text/tailwindcss">
9+
html {
10+
color-scheme: light dark;
11+
}
12+
* {
13+
@apply border-gray-200 dark:border-gray-800;
14+
}
15+
body {
16+
@apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200;
17+
}
18+
</style>
19+
</head>
20+
21+
<body>
22+
<div id="app"></div>
23+
<script type="module" src="/src/main.tsx"></script>
24+
</body>
25+
</html>

apps/client/package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "client",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"typecheck": "tsc --noEmit",
8+
"dev": "vite --port=3001",
9+
"build": "vite build",
10+
"serve": "vite preview",
11+
"start": "vite"
12+
},
13+
"devDependencies": {
14+
"@tanstack/router-plugin": "^1.105.0",
15+
"@types/react": "^19.0.8",
16+
"@types/react-dom": "^19.0.3",
17+
"@vitejs/plugin-react": "^4.3.2",
18+
"vite": "^6.0.3"
19+
},
20+
"dependencies": {
21+
"@effect/platform": "^0.77.1",
22+
"@tanstack/react-router": "^1.105.0",
23+
"effect": "^3.13.1",
24+
"react": "^19.0.0",
25+
"react-dom": "^19.0.0",
26+
"@local/api": "workspace:*"
27+
}
28+
}

apps/client/src/lib/api-client.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { FetchHttpClient, HttpApiClient } from "@effect/platform";
2+
import { ServerApi } from "@local/api";
3+
import { Effect } from "effect";
4+
5+
export class ApiClient extends Effect.Service<ApiClient>()("ApiClient", {
6+
dependencies: [FetchHttpClient.layer],
7+
effect: Effect.gen(function* () {
8+
const client = yield* HttpApiClient.make(ServerApi, {
9+
baseUrl: "http://localhost:3000",
10+
});
11+
12+
return client;
13+
}),
14+
}) {}

apps/client/src/main.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { RouterProvider, createRouter } from "@tanstack/react-router";
2+
import ReactDOM from "react-dom/client";
3+
import { routeTree } from "./routeTree.gen";
4+
5+
// Set up a Router instance
6+
const router = createRouter({
7+
routeTree,
8+
defaultPreload: "intent",
9+
});
10+
11+
// Register things for typesafety
12+
declare module "@tanstack/react-router" {
13+
interface Register {
14+
router: typeof router;
15+
}
16+
}
17+
18+
const rootElement = document.getElementById("app")!;
19+
20+
if (!rootElement.innerHTML) {
21+
const root = ReactDOM.createRoot(rootElement);
22+
root.render(<RouterProvider router={router} />);
23+
}

apps/client/src/routeTree.gen.ts

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/* eslint-disable */
2+
3+
// @ts-nocheck
4+
5+
// noinspection JSUnusedGlobalSymbols
6+
7+
// This file was automatically generated by TanStack Router.
8+
// You should NOT make any changes in this file as it will be overwritten.
9+
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10+
11+
// Import Routes
12+
13+
import { Route as rootRoute } from './routes/__root'
14+
import { Route as AboutImport } from './routes/about'
15+
import { Route as IndexImport } from './routes/index'
16+
17+
// Create/Update Routes
18+
19+
const AboutRoute = AboutImport.update({
20+
id: '/about',
21+
path: '/about',
22+
getParentRoute: () => rootRoute,
23+
} as any)
24+
25+
const IndexRoute = IndexImport.update({
26+
id: '/',
27+
path: '/',
28+
getParentRoute: () => rootRoute,
29+
} as any)
30+
31+
// Populate the FileRoutesByPath interface
32+
33+
declare module '@tanstack/react-router' {
34+
interface FileRoutesByPath {
35+
'/': {
36+
id: '/'
37+
path: '/'
38+
fullPath: '/'
39+
preLoaderRoute: typeof IndexImport
40+
parentRoute: typeof rootRoute
41+
}
42+
'/about': {
43+
id: '/about'
44+
path: '/about'
45+
fullPath: '/about'
46+
preLoaderRoute: typeof AboutImport
47+
parentRoute: typeof rootRoute
48+
}
49+
}
50+
}
51+
52+
// Create and export the route tree
53+
54+
export interface FileRoutesByFullPath {
55+
'/': typeof IndexRoute
56+
'/about': typeof AboutRoute
57+
}
58+
59+
export interface FileRoutesByTo {
60+
'/': typeof IndexRoute
61+
'/about': typeof AboutRoute
62+
}
63+
64+
export interface FileRoutesById {
65+
__root__: typeof rootRoute
66+
'/': typeof IndexRoute
67+
'/about': typeof AboutRoute
68+
}
69+
70+
export interface FileRouteTypes {
71+
fileRoutesByFullPath: FileRoutesByFullPath
72+
fullPaths: '/' | '/about'
73+
fileRoutesByTo: FileRoutesByTo
74+
to: '/' | '/about'
75+
id: '__root__' | '/' | '/about'
76+
fileRoutesById: FileRoutesById
77+
}
78+
79+
export interface RootRouteChildren {
80+
IndexRoute: typeof IndexRoute
81+
AboutRoute: typeof AboutRoute
82+
}
83+
84+
const rootRouteChildren: RootRouteChildren = {
85+
IndexRoute: IndexRoute,
86+
AboutRoute: AboutRoute,
87+
}
88+
89+
export const routeTree = rootRoute
90+
._addFileChildren(rootRouteChildren)
91+
._addFileTypes<FileRouteTypes>()
92+
93+
/* ROUTE_MANIFEST_START
94+
{
95+
"routes": {
96+
"__root__": {
97+
"filePath": "__root.tsx",
98+
"children": [
99+
"/",
100+
"/about"
101+
]
102+
},
103+
"/": {
104+
"filePath": "index.tsx"
105+
},
106+
"/about": {
107+
"filePath": "about.tsx"
108+
}
109+
}
110+
}
111+
ROUTE_MANIFEST_END */

apps/client/src/routes/__root.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Outlet, createRootRoute } from "@tanstack/react-router";
2+
3+
export const Route = createRootRoute({ component: RootComponent });
4+
5+
function RootComponent() {
6+
return (
7+
<>
8+
<Outlet />
9+
</>
10+
);
11+
}

apps/client/src/routes/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createFileRoute } from "@tanstack/react-router";
2+
3+
export const Route = createFileRoute("/")({ component: HomeComponent });
4+
5+
function HomeComponent() {
6+
return <></>;
7+
}

apps/client/tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"strict": true,
4+
"esModuleInterop": true,
5+
"jsx": "react-jsx",
6+
"target": "ESNext",
7+
"module": "ESNext",
8+
"moduleResolution": "Bundler",
9+
"skipLibCheck": true
10+
}
11+
}

0 commit comments

Comments
 (0)