---
title: "Set up your secret store"
description: "Create your Infisical projects, connect your machine to them, and add the credentials your project needs."
canonical_url: "https://nuxtstart.com/docs/configuration/secret-store"
---

> Index of every page on this site: [llms.txt](https://nuxtstart.com/llms.txt)

Your project needs credentials to run: a session signing key, OAuth client secrets, a payments
token. None of them can live in Git, so NuxtStart keeps them in
[Infisical](https://infisical.com) and reads them when the applications start.

Follow this page once. Afterwards, configuring a new deployment is a folder you fill in.

New to Infisical? You don't need to learn the product first. Three of its concepts map onto
NuxtStart, and the steps below use only those three:

- A **project** is one application. You create two: one for `apps/web`, one for `apps/site`.
- An **environment** is a secret tier. You get `development`, `staging`, and `production`.
- A **folder** is one runtime context. Local development reads `/local`.

[Environment values](https://nuxtstart.com/docs/reference/environment-values) explains why it's arranged that way. You
don't need it to finish this page.

## Prerequisites

- An Infisical account. The free plan covers everything here.
- Your project cloned, so you can edit `apps/web/.env.infisical` and `apps/site/.env.infisical`.

## Create your projects

<steps level="3">

### Create two projects

Create one project for `apps/web` and one for `apps/site`. Name them so you can tell them apart. See
[Infisical projects](https://infisical.com/docs/documentation/platform/project).

### Rename the environment slugs

A new Infisical project ships with the slugs `dev`, `staging`, and `prod`. NuxtStart asks for
`development`, `staging`, and `production`. In each project, go to **Project** > **Settings** >
**Environments** and rename the slugs:

<table>
<thead>
  <tr>
    <th>
      Ships as
    </th>
    
    <th>
      Rename the slug to
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        dev
      </code>
    </td>
    
    <td>
      <code>
        development
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        staging
      </code>
    </td>
    
    <td>
      <code>
        staging
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        prod
      </code>
    </td>
    
    <td>
      <code>
        production
      </code>
    </td>
  </tr>
</tbody>
</table>

The slug is the part everything addresses. The display name beside it is yours. Renaming edits the
environment in place, so any secrets already in it survive.

Do this before anything else. A project still on `dev` is asked for an environment it doesn't have,
and every command that reads a secret then fails there instead of failing on what you were changing.

### Copy each project ID into your repository

Go to **Project** > **Settings** > **General** and copy the **Project ID**. Then paste it after
`projectId=` in that application's `.env.infisical`, where it ships empty:

```env-spec [apps/web/.env.infisical]
# @initInfisical(
#   projectId=<your apps/web project ID>,
```

Do the same for `apps/site/.env.infisical` with the other project's ID.

A project ID names a project without granting access to it, which is why it's committed.

### Create the folders

Go to **Project** > **Secrets** in the `apps/web` project and select the `development` environment.
Select the chevron next to **Add Secret**, then **Add Folder**, and create three folders: `local`,
`preview`, and `development`. See
[Infisical folders](https://infisical.com/docs/documentation/platform/folder).

Nothing else needs folders. The `staging` and `production` environments keep their secrets at the
root, and `apps/site` stores no secrets at all.

### Create a machine identity for your machine

Your machine signs in to Infisical as a machine identity, using a client ID and client secret pair.
[Machine identities](https://nuxtstart.com/docs/configuration/machine-identities) creates it and adds it to both
projects — one identity per person, reused by every project you own.

Come back here with its **Client ID** and **Client Secret**.

### Connect your machine

Create a gitignored `.env.local` in each application and paste the pair into both files:

```env [.env.local]
INFISICAL_CLIENT_ID=<your client ID>
INFISICAL_CLIENT_SECRET=<your client secret>
```

Both applications sign in separately, so both files need the values.

### Add the credentials

Go to **Project** > **Secrets** in the `apps/web` project, select the `development` environment,
open the `local` folder, and add every key from the table below.

</steps>

## What to put in the `/local` folder

All of these belong to `apps/web`. **Needed for** names the feature each key serves and the layer
that feature comes from, so you can tell which keys you need today.

<table>
<thead>
  <tr>
    <th>
      Key
    </th>
    
    <th>
      Comes from
    </th>
    
    <th>
      Needed for
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        NUXT_APP_SECRET
      </code>
    </td>
    
    <td>
      <code>
        openssl rand -base64 32
      </code>
    </td>
    
    <td>
      Every sign-in (<code>
        @app/layer-auth
      </code>
      
      ). Rotating it ends every session
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GOOGLE_CLIENT_SECRET
      </code>
    </td>
    
    <td>
      Your Google OAuth client
    </td>
    
    <td>
      Google sign-in (<code>
        @app/layer-auth
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        GITHUB_CLIENT_SECRET
      </code>
    </td>
    
    <td>
      Your GitHub OAuth app
    </td>
    
    <td>
      GitHub sign-in (<code>
        @app/layer-auth
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POLAR_ACCESS_TOKEN
      </code>
    </td>
    
    <td>
      Your Polar organization
    </td>
    
    <td>
      Payments (<code>
        @app/layer-payments
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        POLAR_WEBHOOK_SECRET
      </code>
    </td>
    
    <td>
      Your Polar webhook
    </td>
    
    <td>
      Payments (<code>
        @app/layer-payments
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        NUXT_EMAIL_PLATFORM_ADMIN_EMAILS
      </code>
    </td>
    
    <td>
      Addresses you choose
    </td>
    
    <td>
      Platform alerts (<code>
        @app/layer-email
      </code>
      
      ). Optional — leave it empty to turn them off
    </td>
  </tr>
</tbody>
</table>

[Set up sign-in and payments](https://nuxtstart.com/docs/configuration/provider-accounts) creates the Google, GitHub, and
Polar side of these.

<note>

Skipping a feature for now? Every key here except `NUXT_EMAIL_PLATFORM_ADMIN_EMAILS` has to hold a
value before `apps/web` installs or starts, so put a stand-in such as `unused` in the ones you're
skipping. The product starts, and only the feature that reads the key fails when you first use it. A
deployed context's folder behaves the same way: the deploy succeeds, and the feature fails at its
first use there.

</note>

Two values that look like they belong here don't:

- `DATABASE_URL` is per checkout locally: `pnpm dev:web` hands the server its checkout's Postgres, so no file holds it.
- `GOOGLE_CLIENT_ID` and `GITHUB_CLIENT_ID` go in the committed `apps/web/.env.development`.
[Environment values](https://nuxtstart.com/docs/reference/environment-values#why-some-credentials-are-committed)
explains why an OAuth client ID isn't a secret.

## Setting up a deployed context

Everything above is the same for `preview`, `development`, `staging`, and `production`. Only two
things change: which folder you fill in, and how the build signs in. `/preview` also holds
`NEON_API_KEY`, `SEED_PLATFORM_ADMIN_EMAIL`, and `SEED_PLATFORM_ADMIN_PASSWORD`, which
[Adding pull request previews](https://nuxtstart.com/docs/getting-started/adding-pull-request-previews) has you set.

A GitHub Actions runner never uses your client ID and secret. It signs in with OIDC, as one of two
identities bound to your repository.

- [Machine identities](https://nuxtstart.com/docs/configuration/machine-identities) creates those two, with the subject
and audience each one needs
- [Which folder each context reads](https://nuxtstart.com/docs/reference/environment-values#how-the-secret-store-is-organised)

## Troubleshooting

<table>
<thead>
  <tr>
    <th>
      What you see
    </th>
    
    <th>
      What to fix
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Infisical authentication is required
      </code>
    </td>
    
    <td>
      The client ID and secret in that application's <code>
        .env.local
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        projectId is required
      </code>
    </td>
    
    <td>
      The project ID in that application's <code>
        .env.infisical
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      An error naming an environment
    </td>
    
    <td>
      The environment slugs aren't renamed yet
    </td>
  </tr>
  
  <tr>
    <td>
      An error naming a single key
    </td>
    
    <td>
      That key is missing from the folder for the context you're running
    </td>
  </tr>
  
  <tr>
    <td>
      Secrets resolve, but they're the wrong ones
    </td>
    
    <td>
      You're running in a different context than you expected
    </td>
  </tr>
</tbody>
</table>

## Next steps

- [Set up sign-in and payments](https://nuxtstart.com/docs/configuration/provider-accounts) — create the credentials this
page asks for
- [Local setup](https://nuxtstart.com/docs/getting-started/local-setup) — the guide that sends you here
- [Environment values](https://nuxtstart.com/docs/reference/environment-values) — why the store is arranged this way

## Sitemap

See the full [sitemap](https://nuxtstart.com/sitemap.md) for all pages.
