See what's launched

The next gen Gatsby is here Performance, developer velocity, and scaling to meet Enterprise needs - See what’s launched

Sign Up for Free
Community Plugin
View plugin on GitHub


Plugin for setting up the userbase object globally in gatsby projects


You’ll need dotenv for environment variables

Install userbase:

npm install userbase-js gatsby-plugin-userbase


yarn add userbase-js gatsby-plugin-userbase

Set up your environment variables:

.env.development and .env.production


Now go to gatsby-config.js and add gatsby-plugin-userbase to the plugins array with the following options:

  path: `.env.${process.env.NODE_ENV}`,

module.exports = {
  plugins: [
      resolve: "gatsby-plugin-userbase",
      options: {
        APP_ID: process.env.USERBASE_APP_ID,


run gatsby develop

You should have access to the userbase object globally from the browser

© 2022 Gatsby, Inc.