This app allows you to create JWTs for hasura. And have a minimal signup process via email. It is small (Image size ~10MB) tool written in golang and minimal dependencies.
- 🧑🤝🧑 Users are stored in Postgres and accessed via GraphQL
- ✨ Integrates with GraphQL and Hasura Permissions
- 🔑 JWT tokens.
- ✉️ Emails sent via SMTP.
- 👨💻 Written 100% in Golang.
- 📦 Easy to deploy with Docker.
There are several ways to deploy this project. There is a ready-made container image on GitHub Packages. 📦
You can use it in your environment.
There is a Docker Compose File for developers, here the Hasura must be adapted.
There is also a template for Kubernetes. Here you can see how to roll out this app there.
And last but not least, since it is written in golang, you can export the project to almost all platforms. (If a platform is explicitly desired, I can create a Github action for it, let me know in an issue)
HASURA_URL
- Must be set to the URL of your Hasura instance (e.g.http://localhost:8080/v1/graphql
is also the default value for development).HASURA_SECRET
- Must be set to the admin secret of your Hasura instance.JWT_KEY
- Must be set to a secret key for signing JWTs.EMAIL_VERIFICATION
- Must be set tofalse
if you want to disable email verification. Default istrue
. It requires the following SMTP settings.APP_URL
- The URL of the app. It is used for creating the email verification link. Must be reachable from outside. If you are using a reverse proxy, it should be the URL of the reverse proxy. In otherwise it must have:3000
in the end.SMTP_HOST
- The SMTP host to use for sending emails.SMTP_PORT
- The SMTP port to use for sending emails. The default is587
.SMTP_USER
- The username to use for authenticating with the SMTP server. It is used as from email address.SMTP_PASSWORD
- The password to use for authenticating with the SMTP server.
JWT_URL
- Must be set to the URL of your Hasura JWT instance (e.g.http://localhost:3000
).HASURA_GRAPHQL_UNAUTHORIZED_ROLE
- Set toanonymous
to get access to the public schema without a token, and also for login and signup mutations.
You can map a volume with the certificates to /etc/ssl/certs/
in the container.
This helps by problems with the SMTP Authentication. Certificates from the
Alpine package ca-certificates
are supported by default.
Please take a look at the GitHub Wiki tab there are sequence diagrams for the process (sign up, login) and a database model.
There is are similar project like this:
- Hasura Auth - It offers more features but is written in Typescript.
- Backend-Quickstart - It's written in Java, but the last commit was 2 years ago.
- Hasura Docs - It's a Blog post from official Hasura Documentation, there is described how to create JWT with Python and Flask.