stack/apps/dashboard/src/stack.tsx
2025-02-20 00:48:05 +01:00

24 lines
1.1 KiB
TypeScript

import { StackServerApp } from '@stackframe/stack';
import { getPublicEnvVar } from "@/lib/env";
import { throwErr } from '@stackframe/stack-shared/dist/utils/errors';
import './polyfills';
if (getPublicEnvVar("NEXT_PUBLIC_STACK_PROJECT_ID") !== "internal") {
throw new Error("This project is not configured correctly. stack-dashboard must always use the internal project.");
}
export const stackServerApp = new StackServerApp<"nextjs-cookie", true, 'internal'>({
baseUrl: {
browser: getPublicEnvVar("NEXT_PUBLIC_BROWSER_STACK_API_URL") ?? getPublicEnvVar("NEXT_PUBLIC_STACK_API_URL") ?? throwErr("NEXT_PUBLIC_BROWSER_STACK_API_URL is not set"),
server: getPublicEnvVar("NEXT_PUBLIC_SERVER_STACK_API_URL") ?? getPublicEnvVar("NEXT_PUBLIC_STACK_API_URL") ?? throwErr("NEXT_PUBLIC_SERVER_STACK_API_URL is not set"),
},
projectId: "internal",
publishableClientKey: getPublicEnvVar("NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY"),
tokenStore: "nextjs-cookie",
urls: {
afterSignIn: "/projects",
afterSignUp: "/new-project",
afterSignOut: "/",
}
});