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#

/config/supertokensConfig.ts

import EmailPassword from 'supertokens-node/recipe/emailpassword';
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/emailpassword/appinfo
appName: "<YOUR_APP_NAME>",
apiDomain: "<YOUR_API_DOMAIN>",
websiteDomain: "<YOUR_WEBSITE_DOMAIN>",
apiBasePath: "/auth",
websiteBasePath: "/auth",
},
recipeList: [
EmailPassword.init(),
Session.init(),
],
isInServerlessEnv: true,
}
}

module.exports.getBackendConfig = getBackendConfig;

Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI