Files
vibn-frontend/lib/supertokens/backendConfig.ts
Mark Henderson 44895f9c31 Fix SuperTokens build error with lazy initialization
- Move SuperTokens.init() to runtime (not build time)
- Add dynamic route config to prevent build-time evaluation
- Move appInfo inside backendConfig function
- Update default URLs to vibnai.com

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-16 17:22:41 -08:00

56 lines
1.6 KiB
TypeScript

import ThirdPartyNode from "supertokens-node/recipe/thirdparty";
import EmailPasswordNode from "supertokens-node/recipe/emailpassword";
import SessionNode from "supertokens-node/recipe/session";
import { TypeInput } from "supertokens-node/types";
import { AppInfoUserInput } from "supertokens-node/types";
export const backendConfig = (): TypeInput => {
const appUrl = process.env.NEXT_PUBLIC_APP_URL || "https://vibnai.com";
const appInfo: AppInfoUserInput = {
appName: "Vib'n",
apiDomain: appUrl,
websiteDomain: appUrl,
apiBasePath: "/api/auth",
websiteBasePath: "/auth",
};
return {
framework: "custom",
supertokens: {
connectionURI: process.env.SUPERTOKENS_CONNECTION_URI || "http://j04ckwg0k040o08gc04gs80o:3567",
apiKey: process.env.SUPERTOKENS_API_KEY || "",
},
appInfo,
recipeList: [
ThirdPartyNode.init({
signInAndUpFeature: {
providers: [
{
config: {
thirdPartyId: "google",
clients: [{
clientId: process.env.GOOGLE_CLIENT_ID || "",
clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
}],
},
},
{
config: {
thirdPartyId: "github",
clients: [{
clientId: process.env.GITHUB_CLIENT_ID || "",
clientSecret: process.env.GITHUB_CLIENT_SECRET || "",
}],
},
},
],
},
}),
EmailPasswordNode.init(),
SessionNode.init(),
],
isInServerlessEnv: true,
};
};