Explore the docs »
View Demo
·
Report Bug
·
Request Feature
This is an example authentication backend using the Supertokens.io Node.js SDK with Docker.
The code is basically a TypeScript port of the official Supertokens.io Quickstart, but with a self-hosted Postgres database. Check the docker-compose.yml
if you're interested.
The project is only used for development and needs to be adjusted for production. For Docker, see:
- BretFisher/node-docker-good-defaults
- 10 best practices to containerize Node.js web applications with Docker
- Node.js
- TypeScript
- Docker/docker-compose
- Supertokens.io
To get a local copy up and running follow these steps.
You'll need:
- Docker, docker compose CLI v2
- GNU make
-
Clone the repo
git clone https://github.com/sophiabrandt/supertokens-example-nodejs.git
Start all docker containers via Makefile:
make run
Alternatively, copy the necessary commands from the Makefile
.
Example Signup with curlie:
curlie post -H "Accept: application/json" -d '{"formFields": [{"id": "email", "value": "test@test.com"}, {"id": "password", "value": "AbcDef678990"}]}' http://localhost:7000/auth/signup
Example json
for logging in:
{
"formFields": [
{
"id ": "email",
"value ": "test@test.com "
},
{
"id ": "password ",
"value ": "12334AbCd"
}
]
}
The Node.js server implements the EmailPassword recipe and Session recipe from Supertokens.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
Please update tests if necessary.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache 2.0 License. See LICENSE
for more information.
Sophia Brandt - @hisophiabrandt
Project Link: https://github.com/sophiabrandt/supertokens-example-nodejs