Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

use next public

Bill Yangc63334675649
diff --git a/client/next.config.js b/client/next.config.js
index a98bb0717..58c2edfed 100644
--- a/client/next.config.js
+++ b/client/next.config.js
@@ -2,7 +2,7 @@
const nextConfig = {
output: "standalone",
env: {
- BACKEND_URL: process.env.BACKEND_URL,
+ NEXT_PUBLIC_BACKEND_URL: process.env.NEXT_PUBLIC_BACKEND_URL,
},
};
diff --git a/client/src/app/components/Header/Header.tsx b/client/src/app/components/Header/Header.tsx
index 705ff15b2..bb493ca78 100644
--- a/client/src/app/components/Header/Header.tsx
+++ b/client/src/app/components/Header/Header.tsx
@@ -11,8 +11,8 @@ export function Header() {
const { data } = useQuery<{ count: number }>({
queryKey: ["active-sessions"],
queryFn: () =>
- fetch(`${process.env.BACKEND_URL}/live-user-count`).then((res) =>
- res.json()
+ fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/live-user-count`).then(
+ (res) => res.json()
),
});
diff --git a/client/src/hooks/api.ts b/client/src/hooks/api.ts
index 0c136fe31..f4eed9b68 100644
--- a/client/src/hooks/api.ts
+++ b/client/src/hooks/api.ts
@@ -22,7 +22,7 @@ export function useGenericQuery<T>(
queryFn: () => {
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
return fetch(
- `${process.env.BACKEND_URL}/${endpoint}?startDate=${startDate}&endDate=${endDate}&timezone=${timezone}`
+ `${process.env.NEXT_PUBLIC_BACKEND_URL}/${endpoint}?startDate=${startDate}&endDate=${endDate}&timezone=${timezone}`
).then((res) => res.json());
},
staleTime: Infinity,
@@ -106,7 +106,7 @@ export function useGetPageviews(): UseQueryResult<
queryFn: () => {
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
return fetch(
- `${process.env.BACKEND_URL}/pageviews?startDate=${startDate}&endDate=${endDate}&timezone=${timezone}&bucket=${bucket}`
+ `${process.env.NEXT_PUBLIC_BACKEND_URL}/pageviews?startDate=${startDate}&endDate=${endDate}&timezone=${timezone}&bucket=${bucket}`
).then((res) => res.json());
},
placeholderData: keepPreviousData,
diff --git a/docker-compose.yml b/docker-compose.yml
index 4ee8985b0..837a1a3d4 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -59,7 +59,7 @@ services:
- NODE_ENV=production
- CLICKHOUSE_HOST=http://clickhouse:8123
- CLICKHOUSE_DB=analytics
- - BACKEND_URL=${BASE_URL}
+ - NEXT_PUBLIC_BACKEND_URL=${BASE_URL}
depends_on:
- backend