Skip to content

Commit 0226c2d

Browse files
committed
remove web and add ssr in api
1 parent e9dcbd0 commit 0226c2d

34 files changed

+405
-2405
lines changed

.github/workflows/web_cd.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

apps/api/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# prod
22
dist/
3+
dist-server/
34

45
# dev
56
.yarn/

apps/api/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"name": "@hypr/api",
33
"type": "module",
44
"scripts": {
5-
"dev": "wrangler dev",
6-
"deploy": "wrangler deploy --minify",
5+
"dev": "vite",
6+
"build": "vite build",
7+
"preview": "$npm_execpath run build && vite preview",
8+
"deploy": "$npm_execpath run build && wrangler deploy",
79
"cf-typegen": "wrangler types --env-interface CloudflareBindings"
810
},
911
"dependencies": {
@@ -14,6 +16,9 @@
1416
"zod": "^4.1.12"
1517
},
1618
"devDependencies": {
17-
"wrangler": "^4.42.0"
19+
"@cloudflare/vite-plugin": "^1.2.3",
20+
"vite": "^6.3.5",
21+
"vite-ssr-components": "^0.5.1",
22+
"wrangler": "^4.17.0"
1823
}
1924
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ const app = new Hono<Env>();
1111
app.use("/v1", supabaseMiddleware());
1212

1313
app.get("/health", (c) => c.text("OK"));
14+
app.get("/", (c) => {
15+
const allParams = c.req.query();
16+
17+
return c.render(
18+
<pre>{JSON.stringify(allParams, null, 2)}</pre>,
19+
);
20+
});
1421

1522
app.post(
1623
"/v1/write",

apps/api/src/renderer.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { jsxRenderer } from "hono/jsx-renderer";
2+
import { Link, ViteClient } from "vite-ssr-components/hono";
3+
4+
export const renderer = jsxRenderer(({ children }) => {
5+
return (
6+
<html>
7+
<head>
8+
<ViteClient />
9+
<Link href="/src/style.css" rel="stylesheet" />
10+
</head>
11+
<body>{children}</body>
12+
</html>
13+
);
14+
});

apps/api/src/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1 {
2+
font-family: Arial, Helvetica, sans-serif;
3+
}

apps/api/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"lib": [
99
"ESNext"
1010
],
11+
"types": ["vite/client"],
1112
"jsx": "react-jsx",
1213
"jsxImportSource": "hono/jsx"
1314
}

apps/api/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { cloudflare } from "@cloudflare/vite-plugin";
2+
import { defineConfig } from "vite";
3+
import ssrPlugin from "vite-ssr-components/plugin";
4+
5+
export default defineConfig({
6+
plugins: [cloudflare(), ssrPlugin()],
7+
});

apps/api/wrangler.jsonc

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
11
{
22
"$schema": "node_modules/wrangler/config-schema.json",
33
"name": "api",
4-
"main": "src/index.ts",
5-
"compatibility_date": "2025-10-06",
6-
// "compatibility_flags": [
7-
// "nodejs_compat"
8-
// ],
9-
// "vars": {
10-
// "MY_VAR": "my-variable"
11-
// },
12-
// "kv_namespaces": [
13-
// {
14-
// "binding": "MY_KV_NAMESPACE",
15-
// "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
16-
// }
17-
// ],
18-
// "r2_buckets": [
19-
// {
20-
// "binding": "MY_BUCKET",
21-
// "bucket_name": "my-bucket"
22-
// }
23-
// ],
24-
// "d1_databases": [
25-
// {
26-
// "binding": "MY_DB",
27-
// "database_name": "my-database",
28-
// "database_id": ""
29-
// }
30-
// ],
31-
// "ai": {
32-
// "binding": "AI"
33-
// },
34-
// "observability": {
35-
// "enabled": true,
36-
// "head_sampling_rate": 1
37-
// }
4+
"main": "src/index.tsx",
5+
6+
"compatibility_date": "2025-10-01",
7+
"compatibility_flags": [
8+
"nodejs_compat",
9+
],
3810
}

apps/web/.cursorrules

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)