Skip to content

Commit 9d98aff

Browse files
refactor(infra): use non-static builds for frontends (#444)
Co-authored-by: Cursor Agent <[email protected]>
1 parent 734215d commit 9d98aff

File tree

88 files changed

+862
-736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+862
-736
lines changed

.env.example

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ DOCS_PORT=3005
4040
UI_URL=http://localhost:3002
4141
API_URL=http://localhost:4002
4242
ORIGIN_URL=http://localhost:3002
43-
VITE_API_URL=http://localhost:4002
44-
VITE_DOCS_URL=http://localhost:3005
43+
DOCS_URL=http://localhost:3005
4544

4645
# Passkey configuration (update for your domain)
4746
PASSKEY_RP_ID=localhost
@@ -88,12 +87,12 @@ TOGETHER_AI_API_KEY=your_together_ai_key_here
8887
# PostHog analytics - remove if you don't want analytics
8988

9089
# frontend & api
91-
VITE_POSTHOG_KEY=your_posthog_project_key
92-
VITE_POSTHOG_HOST=https://app.posthog.com
90+
POSTHOG_KEY=your_posthog_project_key
91+
POSTHOG_HOST=https://app.posthog.com
9392

9493
# docs
95-
NEXT_PUBLIC_POSTHOG_KEY=your_posthog_project_key
96-
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
94+
POSTHOG_KEY=your_posthog_project_key
95+
POSTHOG_HOST=https://app.posthog.com
9796

9897
# =============================================================================
9998
# PAYMENT PROCESSING (OPTIONAL)

.env.unified.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ TOGETHER_AI_API_KEY=your_together_ai_key_here
5959
# =============================================================================
6060
# PostHog analytics - remove if you don't want analytics
6161

62-
VITE_POSTHOG_KEY=your_posthog_project_key
63-
VITE_POSTHOG_HOST=https://app.posthog.com
62+
POSTHOG_KEY=your_posthog_project_key
63+
POSTHOG_HOST=https://app.posthog.com
6464

6565
# =============================================================================
6666
# PAYMENT PROCESSING (OPTIONAL)

.github/workflows/images.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ jobs:
7373
cache-to: type=gha,mode=max,scope=${{ matrix.app }}
7474
build-args: |
7575
APP_VERSION=${{ needs.setup.outputs.image_tag }}
76-
VITE_API_URL=${{ secrets.API_URL }}
77-
VITE_DOCS_URL=${{ secrets.DOCS_URL }}
78-
VITE_CRISP_ID=${{ secrets.CRISP_ID }}
79-
VITE_POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
80-
VITE_POSTHOG_KEY=${{ secrets.POSTHOG_KEY }}
81-
NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
82-
NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.POSTHOG_KEY }}
8376
8477
push-unified:
8578
needs: setup

apps/api/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ STRIPE_WEBHOOK_SECRET=whsec_123
33
STRIPE_PRO_MONTHLY_PRICE_ID=price_12345678
44
STRIPE_PRO_YEARLY_PRICE_ID=price_12345678
55

6-
VITE_POSTHOG_KEY=phc_123
7-
VITE_POSTHOG_HOST=https://app.posthog.com
6+
POSTHOG_KEY=phc_123
7+
POSTHOG_HOST=https://app.posthog.com
88

99
UI_URL=https://llmgateway.io
1010

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dist/"
88
],
99
"scripts": {
10-
"build": "tsc && tsup",
10+
"build": "tsc && tsup && pnpm run generate",
1111
"dev": "nodemon -e ts,json --exec 'tsx src/serve.ts'",
1212
"generate": "tsx ./src/scripts/generate-openapi.ts",
1313
"start": "node dist/serve.js"

apps/api/src/posthog.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { PostHog } from "posthog-node";
22

3-
export const posthog = new PostHog(process.env.VITE_POSTHOG_KEY || "key", {
4-
host: process.env.VITE_POSTHOG_HOST || "key",
3+
export const posthog = new PostHog(process.env.POSTHOG_KEY || "key", {
4+
host: process.env.POSTHOG_HOST || "key",
55
});

apps/docs/.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
NEXT_PUBLIC_POSTHOG_KEY=
2-
NEXT_PUBLIC_POSTHOG_HOST=
1+
POSTHOG_KEY=
2+
POSTHOG_HOST=

apps/docs/app/(home)/[[...slug]]/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ export async function generateMetadata({
2626
const image = ["/docs-og", ...slug, "image.png"].join("/");
2727

2828
return {
29-
metadataBase: new URL(
30-
process.env.VITE_DOCS_URL || "https://docs.llmgateway.io",
31-
),
29+
metadataBase: new URL(process.env.DOCS_URL || "https://docs.llmgateway.io"),
3230
title: page.data.title,
3331
description: page.data.description,
3432
openGraph: {

apps/docs/app/api/search/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@ import { createFromSource } from "fumadocs-core/search/server";
22

33
import { source } from "@/lib/source";
44

5-
export const dynamic = "force-static";
6-
7-
export const { staticGET: GET } = createFromSource(source);
5+
export const { GET } = createFromSource(source);

apps/docs/app/layout.tsx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { RootProvider } from "fumadocs-ui/provider";
22
import { Inter } from "next/font/google";
33

44
import "./global.css";
5+
import { ConfigProvider } from "@/lib/context";
56
import { PostHogProvider } from "@/lib/providers";
67

78
import type { ReactNode } from "react";
@@ -11,20 +12,18 @@ const inter = Inter({
1112
});
1213

1314
export default function Layout({ children }: { children: ReactNode }) {
15+
// Access environment variables directly on the server
16+
const posthogKey = process.env.POSTHOG_KEY || "";
17+
const posthogHost = process.env.POSTHOG_HOST || "";
18+
1419
return (
1520
<html lang="en" className={inter.className} suppressHydrationWarning>
1621
<body className="flex flex-col min-h-screen">
17-
<PostHogProvider>
18-
<RootProvider
19-
search={{
20-
options: {
21-
type: "static",
22-
},
23-
}}
24-
>
25-
{children}
26-
</RootProvider>
27-
</PostHogProvider>
22+
<ConfigProvider posthogKey={posthogKey} posthogHost={posthogHost}>
23+
<PostHogProvider>
24+
<RootProvider>{children}</RootProvider>
25+
</PostHogProvider>
26+
</ConfigProvider>
2827
</body>
2928
</html>
3029
);

0 commit comments

Comments
 (0)