# Edit files

Edit any file in a [project](/docs/concepts/project-lifecycle.md#projects) from Studio or with `veryfront files`. Studio saves to the branch you are on.

## Before you start

You need a project. See [Create a project](/docs/projects/create-project.md).

## Edit a file

**Code**

If the project is in a folder on your machine, edit the file there and run `npx veryfront push`. See [Work locally](/docs/projects/local.md). Otherwise:

1. Set `SLUG` to your project's slug, from its **Settings** page: `export SLUG=<slug>`.
2. Download the file:

```bash
npx veryfront files get app/page.tsx --project $SLUG --output app/page.tsx
```

3. Change the heading in your editor, from "Welcome to Veryfront" to "Support desk".
4. Upload it:

```bash
npx veryfront files put app/page.tsx --project $SLUG --from app/page.tsx
```

5. Read the file back. You should now see the heading read "Support desk":

```bash
npx veryfront files get app/page.tsx --project $SLUG
```

### Try it in a sandbox

```playground
step: The project the page assumes | npm create -y veryfront@latest support-desk -- --template minimal --yes && cd support-desk && npx veryfront push --yes && cd ..
step: Set SLUG | export SLUG=$VERYFRONT_PROJECT_REFERENCE
step: Download the file | npx veryfront files get app/page.tsx --project $SLUG --output app/page.tsx
step: Change the heading | sed -i 's/Welcome to Veryfront/Support desk/' app/page.tsx
step: Upload it | npx veryfront files put app/page.tsx --project $SLUG --from app/page.tsx
check: npx veryfront files get app/page.tsx --project $SLUG
expect: Support desk
```

### Troubleshooting

**If you see "Project … not found"** with the name of your folder, the command ran without `--project`, so it took the folder's name as the slug. Add `--project $SLUG`.

**Studio**

1. Open **Files**.
2. Expand the `app` folder.
3. Click `page.tsx`.
4. Click at the end of the heading.
5. Change "Welcome to Veryfront" to "Support desk".
6. Open **Editor actions**.
7. Click **Save**. You should now see "File saved" and no unsaved dot on the tab.

## Find and replace

**Studio**

1. Click **Search**.
2. Enter "Documentation" in **Search**.
3. Click **Show replace**.
4. Enter "Help center" in **Replace**.
5. Click **Replace all**.
6. Click **Replace**. You should now see "Replacements complete" and the link read "Help center". The file stays unsaved until you save it.

## With MCP

1. Call `veryfront__get_file` with `{ "project_reference": "my-project", "file_path": "app/page.tsx" }`. The project reference is its slug or its ID. Without `ref` it reads `main`.
2. Call `veryfront__update_file` with the same `project_reference` and `file_path`, and `"str_replace": { "old_string": "Welcome to Veryfront", "new_string": "Support desk" }`. The old text must match exactly once.
3. Call `veryfront__get_file` again. It worked when `content` has the heading "Support desk".

## Next steps

* [Preview changes](/docs/projects/preview.md)
* [Create a branch](/docs/projects/create-branch.md)
