Skip to main content

Self Hosted setup with Docker

Running the docker image ๐Ÿš€#

docker run -p 3567:3567 -d supertokens/supertokens-mysql
  • To see all the env variables available, please see the README file.
  • The above command will start the container with an in-memory database. This means you do not need to connect it to MySQL to test out SuperTokens.
  • When you are ready to connect it to your database, please visit the Database setup section

Testing that the service is running ๐Ÿคž#

Open a browser and visit http://localhost:3567/hello. If you see a page that says Hello back, then the container was started successfully!

If you are having issues with starting the docker image, please feel free to reach out to us over email or via Discord.

Connecting the backend SDK with SuperTokens ๐Ÿ”Œ#

  • The default port for SuperTokens is 3567. You can change this by binding a different port in the docker run command. For example, docker run -p 8080:3567 will run SuperTokens on port 8080 on your machine.
  • The connection info will go in the supertokens object in the init function on your backend:
let supertokens = require("supertokens-node");
supertokens.init({    supertokens: {        connectionURI: "http://localhost:3567",        apiKey: "someKey" | undefined    },    appInfo: {...},    recipeList: [...]});
Security

There is no API key by default. Visit the API keys section to see how to add one.