subZero Auth library can be used to create a self-standing API service for handling user registration and authentication for Jamstack projects.

It's based on OAuth2 and JWT and will handle user signup, authentication and custom user data.

The features are:

  • Issuing JWTs
  • User management
  • Sign in with email, password, magic link, phone number
  • Sign in with external providers (Google, Apple, Facebook, Discord, ...)

Internally the library is mostly a wrapper around GoTrue to compile it to WASM in order to expose the functionality to Node.js.

The library behavior is customizable through environment variables.

For a full list of environment variables, see here


In a typical setting you would not interact directly with the functions exposed by the underlying library but rather use the generated code that wraps these functions and exposes a higher level API in the form of a express route handler.


import auth, { init as authInit, isAuthenticated } from './auth';


await authInit(app); // app is an express app

Handling requests

// A GoTrue - compatible API for user authentication
router.use('/auth/v1', auth);
Add a new data model