Skip to main content

2. Backend config

1) Install supertokens package#

npm i supertokens-node

2) Create a configuration file (config/supertokensConfig.js)#

  • Create a config folder in the root directory of your project.
  • Create a supertokensConfig.js inside the config folder.
  • An example of this file can be found here.

3) Create a backend config function#

Your app's name:*
Information about the question
This is the name of your application
API Domain:*
Information about the question
This is the URL of your app's API server.
API Base Path:
Information about the question
SuperTokens will expose it's APIs scoped by this base API path.
Website Domain:*
Information about the question
This is the URL of your website.
Website Base Path:
Information about the question
The path where the login UI will be rendered
Submit form
/config/supertokensConfig.ts
import Session from 'supertokens-node/recipe/session'

function getBackendConfig() {
return {
framework: "awsLambda",
supertokens: {
connectionURI: "",
apiKey: "",
},
appInfo: {
// learn more about this on https://supertokens.com/docs/session/appinfo
appName: "<YOUR_APP_NAME>",
apiDomain: "<YOUR_API_DOMAIN>",
websiteDomain: "<YOUR_WEBSITE_DOMAIN>",
apiBasePath: "/.netlify/functions/auth",
websiteBasePath: "/auth"
},
recipeList: [
Session.init()
],
isInServerlessEnv: true,
}
}

module.exports.getBackendConfig = getBackendConfig;