# Get started with Secrets

This guide takes you from nothing to an app that reads its secrets from Mocco, locally and on Vercel. It takes about ten minutes.

## 1. Turn on Secrets

Workspace owners and admins open the workspace's **Products** page and turn on **Secrets**.

![Secrets on the Products page, turned on](https://fi-workers-mocco-storage.s3.ap-northeast-2.amazonaws.com/pub/w/93e11fe8-0494-4e3d-b1cb-fe4dffd3ee7e/p/d64785b8-9a23-4fa1-a81d-550af30e203a/helpcenter/83da9444-ba6a-45f8-96cf-759487274077/secrets-start-products.png)

Every project in the workspace now has a **Secrets** page. The first time someone opens it, the project gets three environments: **Development**, **Staging** and **Production**.

## 2. Add your first secrets

Open the project's **Secrets** page and pick an environment. Choose **Add secret** for one value, or **Import .env** to paste a `.env` file. Import shows what it will add and change before it writes anything.

![The Secrets page with a few secrets in Production, their values masked](https://fi-workers-mocco-storage.s3.ap-northeast-2.amazonaws.com/pub/w/93e11fe8-0494-4e3d-b1cb-fe4dffd3ee7e/p/d64785b8-9a23-4fa1-a81d-550af30e203a/helpcenter/239a1579-4edf-4f0f-87cb-6b0891c51943/secrets-start-secrets.png)

Values stay masked until someone reveals them, and every reveal is recorded in the audit log. To keep values for different parts of your app apart, add folders such as `/web` and `/worker`. See [Manage secrets](https://www.mocco.club/docs/en/articles/yebc3m-manage-secrets) for tags, versions and the overview across environments.

## 3. Run your app with them

Install the Mocco CLI, sign in once and link your project:

```sh
npm install -g @mocco/cli --@mocco:registry=https://packages.mocco.club/api/packages/fi-workers/npm/
mocco login
mocco link --workspace <workspace-uuid> --project <project-uuid> --env development --path /
mocco secrets run -- yarn dev
```

`mocco secrets run` starts your command with the folder's values as environment variables. Nothing is written to disk. Copy the workspace and project UUIDs from the console's URL. More options, such as `--strict` and `.env` export, are in [Use secrets from the terminal](https://www.mocco.club/docs/en/articles/s5yv78-cli).

A server can also read its secrets at boot with `@mocco/node`; see [Load secrets in a Node server](https://www.mocco.club/docs/en/articles/axppfb-node-sdk). GitHub Actions jobs can read them without any stored key; see [Read secrets in GitHub Actions without a key](https://www.mocco.club/docs/en/articles/329hic-github-actions).

## 4. Sync them to Vercel

On the **Secrets** page, choose **Syncs**. Connect Vercel with an access token, then choose **Sync a folder**: pick the folder, the Vercel project and the Vercel environments to write.

![A folder synced to a Vercel project, with its recent runs](https://fi-workers-mocco-storage.s3.ap-northeast-2.amazonaws.com/pub/w/93e11fe8-0494-4e3d-b1cb-fe4dffd3ee7e/p/d64785b8-9a23-4fa1-a81d-550af30e203a/helpcenter/31363512-bd8f-48e8-801e-4d00cdc2e268/secrets-sync-list.png)

Select **Preview** to see which variables the sync would create, update and delete in Vercel, then **Run now**. From then on, every change you make in Mocco reaches Vercel within seconds. [Sync secrets to Vercel](https://www.mocco.club/docs/en/articles/nh53nr-sync-to-vercel) explains key names, deleting and what a sync never touches.

## 5. Change a value safely

Edit a secret in the console, or run `mocco secrets set`. Every change is a commit in the folder's **History**, and you can revert one commit or roll the folder back to an earlier point. A rollback is synced to Vercel like any other change. See [History and rollback](https://www.mocco.club/docs/en/articles/jpcykc-history-and-rollback).

To hear about changes, add the **Mocco** preset to a Discord channel under **Notifications**: it includes secret changes, rollbacks and failed syncs, with keys and fingerprints but never values.

## Who can do what

Workspace owners and admins can do everything here. They can also give members access per environment or folder on the **Access** tab, for example letting developers read Development but only describe Production. See [Secrets overview](https://www.mocco.club/docs/en/articles/8yrkb2-overview).
