Avatar of Faraz PatankarFaraz Patankar

Deploy Authorizer on Railway

Authorizer is an open-source authentication and authorization solution that comes with easy to integrate frontend SDKs while also allowing you to bring your own database. You can think of it as a self-hosted alternative to Auth0.

Authorizer provides an onboarding experience that takes just 3 minutes so that you can spend all your valuable time staying focused on your product and not losing sleep worrying about security, authentication and authorization.

At Railway, we provide a free one-click deploy for Authorizer that is maintained by Lakhan Samani (the creator of Authorizer) himself. We also automatically provision the required PostgreSQL and Redis databases for you!

A brief overview of how Authorizer works

A brief overview of how Authorizer works

Once you set up your Authorizer instance using this guide, you get the following features straight out of the box:

  • Email and password based accounts
  • Password-less accounts with magic links
  • Social logins with Google, Github, Facebook
  • Secure session management
  • Email verification
  • APIs to update profile securely
  • Forgot password flow using email
  • Role-based access management
  • Built-in login page
  • Integrations for React, JavaScript with support for more languages and frameworks coming soon

To deploy Authorizer on Railway, you can simply click this button and follow the guide below. You can also visit Github to view the source code.

After you click the button, you will see the following screen:

Authorizer template page on Railway

Authorizer template page on Railway

To deploy your Authorizer instance, Railway needs to create a repo in your GitHub account which it will deploy for you. So if you haven’t already, give Railway access to your GitHub on this page.

By default, the repository created for you will be titled authorizer-railway but feel free to choose a different name. Just make sure another repository with that name doesn’t already exist.

  • The DATABASE_URL will be automatically configured for you by Railway when we provision the required PostgreSQL database for you.
  • The REDIS_URL will also automatically configured for you by Railway when we provision the required Redis database for you.
  • Some other required variables will already be prefilled but make sure you configure the ADMIN_SECRET and the JWT_SECRET.
  • Additionally, if you’d like to use social logins, you’d have to configure the client ID and client secret for those platforms.
Psst, we have a secret generator that you can use. Just hit CMD+K (or CTRL+K) and search for secret.

Once you’ve filled in all the required environment variables, just hit the deploy button on the page and you’ll be taken to your brand new project and your Authorizer instance will be deployed in a few minutes!

Optionally, if you’re using a React frontend, carry on reading for a guide on integrating Authorizer in your React application.

If you use NPM:

npm i --save @authorizerdev/authorizer-react

Or, if you use yarn, you can run:

yarn add @authorizerdev/authorizer-react

Make sure you replace the text RAILWAY_ENDPOINT with the actual endpoint that Railway gives you once your application is deployed.

import {
} from "@authorizerdev/authorizer-react";

const App = () => {
  return (
        authorizerURL: RAILWAY_ENDPOINT,
        redirectURL: window.location.origin,
      <LoginSignup />
      <Profile />

Authorizer provides a core component that can be used for your login, sign up, and forgot password flows with support for social logins.

import { Authorizer } from "@authorizerdev/authorizer-react";

const LoginPage = () => {
  return (
      <h1>Login / Signup</h1>
        onLogin={(loginResponse) => {}}
        onMagicLinkLogin={(magicLinkResponse) => {}}
        onSignup={(signupResponse) => {}}
        onForgotPassword={(forgotPasswordResponse = {})}

The Authorizer hook gives you access to the global state stored inside the Authorizer context with additional methods to update the state.

const Profile = () => {
  const { user } = useAuthorizer();

  if (user) {
    return <div>{user.email}</div>;

  return null;

And with that, you should have all the information you need to deploy your own Authorizer instance on Railway. You should be able to create new projects and add the Authorizer widget to your websites.

If you have any suggestions for more open-source self-hosted solutions you'd like to see guides for, let us know on Discord. Or even better, submit a pull request to our starters repository on Github!