Express

This quickstart explains how to add a login page and authentication to a website hosted with Express. You'll begin with a simple Express app that allows visitors to edit a file. Then, you'll add authentication to the app with a FusionAuth instance. Finally, you'll extend the app to handle multiple independent users with user data provided by FusionAuth.

This tutorial should take between 5 and 15 minutes; less if you already have prerequisites like Docker installed.

Prerequisites#

This Quickstart requires:

  • Node.js 22 or later
  • Docker 23 or later
  • On macOS and Windows, one of the following container management tools:
    • Docker desktop
    • OrbStack (to use Orbstack for docker compose commands after install, run docker context use orbstack)
    • Podman (in the commands below, replace docker with podman)

Be sure to open your container management tool to configure and install any dependencies needed by that tool, including Rosetta and Developer Tools on macOS.

Create a Simple Express App#

For this QuickStart, we'll use an Express app that reads and writes data to a text file:

Install and Run FusionAuth#

Before we can add authentication to our Express app, we need a local FusionAuth instance:

Add FusionAuth to the Express App#

Now that you have a working instance of FusionAuth and a working Express app, let's use FusionAuth to add login to your Express app:

Add Independent Notes for Each User#

To see a more realistic example of FusionAuth usage, we can improve the app even more, so every user gets a unique note to edit. To accomplish this, we'll use FusionAuth's user data:

Next steps#

This was a quick introduction to using FusionAuth for user authentication. To learn more about integrating FusionAuth with your product, see Get Started.

FusionAuth has many features (including Social Login, Single Sign-On, Passwordless, Multi-factor Authentication), most of which are free. This example app is a great starting point for learning about FusionAuth features.