> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rocket.new/llms.txt
> Use this file to discover all available pages before exploring further.

# View and edit code

> Browse project files and make direct edits inside the Rocket.new Build editor.

export const LlmsDirective = () => <blockquote className="llms-directive">
    For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
    For a lightweight markdown version of this page, append .md to the URL.
  </blockquote>;

<LlmsDirective />

Code view lets you browse your project's source files, make direct edits, view live build logs, and download or push your code. All without leaving the Rocket editor.

<Divider />

## When to use code view

| Use code view when                          | Use chat instead when                    |
| :------------------------------------------ | :--------------------------------------- |
| You need to edit a specific line of code    | You want to add new features or pages    |
| Managing API keys and environment variables | You want to change design or layout      |
| Debugging with build logs                   | You need broad changes across many files |
| Reviewing what Rocket generated             | You are not sure what to change          |

<Divider />

## How to open

Click the **`</> Code`** button in the top toolbar - the same bar as **Preview** and **Full screen**. This switches the main panel to code view.

<Divider />

<Tabs>
  <Tab title="Web Browser">
    <Frame caption="Code view overview">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/web-browser/code-view-light.webp?fit=max&auto=format&n=q2IAjGMuqh78nicx&q=85&s=603075118c70a3322110af12683c66a2" alt="Rocket code editor with file explorer and output panel visible." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/code-view-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/web-browser/code-view-dark.webp?fit=max&auto=format&n=q2IAjGMuqh78nicx&q=85&s=9ff38131e0fa390726f2e990e93256b6" alt="Rocket code editor with file explorer and output panel visible." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/code-view-dark.webp" />
    </Frame>

    ### Browse your files

    The **Explorer** panel on the left shows your full project file tree. Click any file to open it in the editor.

    * Use the **Search files...** bar at the top of the Explorer to find files by name - results filter as you type
    * Collapse the Explorer using the **collapse icon** in the top-right corner of the panel

    <Frame caption="File explorer panel">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/SjTE8D-vvYrzhPjv/images/build-docs/editor/code-view/web-browser/file-explorer-light.webp?fit=max&auto=format&n=SjTE8D-vvYrzhPjv&q=85&s=2be10b35aaa0611ccf1b73da6b979709" alt="File tree expanded in Rocket code view." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/file-explorer-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/SjTE8D-vvYrzhPjv/images/build-docs/editor/code-view/web-browser/file-explorer-dark.webp?fit=max&auto=format&n=SjTE8D-vvYrzhPjv&q=85&s=123cad8f02b235a868623b5e5d39c65b" alt="File tree expanded in Rocket code view." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/file-explorer-dark.webp" />
    </Frame>

    ### Edit and save a file

    Click a file to open it in the editor. Make your changes, then use the **save bar** at the bottom:

    * Click **Save** to apply changes
    * Click **Discard** to undo them

    <Frame caption="Editor with save and discard options">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/SjTE8D-vvYrzhPjv/images/build-docs/editor/code-view/web-browser/edit-code-message-light.webp?fit=max&auto=format&n=SjTE8D-vvYrzhPjv&q=85&s=8946226320edf3ae5b452d5efd792835" alt="Rocket editor with unsaved changes and save/discard options." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/edit-code-message-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/web-browser/edit-code-message-dark.webp?fit=max&auto=format&n=q2IAjGMuqh78nicx&q=85&s=f8d246b0eff70d77a070b4693a650605" alt="Rocket editor with unsaved changes and save/discard options." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/edit-code-message-dark.webp" />
    </Frame>

    <Note>
      Editing configuration files like `tailwind.config.js` or `package.json` can affect how your app compiles or behaves. If something breaks after a config edit, you can [roll back to a previous version](/build/editor/versions).
    </Note>

    ### Environment variables

    Your environment files store sensitive values like API keys:

    * **Web apps** use `.env`
    * **Mobile apps** use `env.json`

    You can edit these files directly in code view. For a full guide on adding and managing variables:

    <Card icon="key" horizontal arrow="true" href="/build/editor/env-variables">
      Manage environment variables
    </Card>

    ### Build logs

    The **Logs** panel at the bottom of the screen shows live output as you edit and save. It has a collapse arrow on the right to hide it when you need more editor space. Logs update automatically - no commands needed.

    Use the logs to:

    * Monitor builds in real time
    * Catch and diagnose errors
    * Confirm that a save was applied successfully

    <Frame caption="Live build logs">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/SjTE8D-vvYrzhPjv/images/build-docs/editor/code-view/web-browser/log-terminal-light.webp?fit=max&auto=format&n=SjTE8D-vvYrzhPjv&q=85&s=78096f9c2f07bf518ad2ca187c272450" alt="Live log output in Rocket showing build events and errors." className="theme-image light-image" width="2042" height="361" data-path="images/build-docs/editor/code-view/web-browser/log-terminal-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/SjTE8D-vvYrzhPjv/images/build-docs/editor/code-view/web-browser/log-terminal-dark.webp?fit=max&auto=format&n=SjTE8D-vvYrzhPjv&q=85&s=2f6ec42e9ccb8b144269b58f4395ab5f" alt="Live log output in Rocket showing build events and errors." className="theme-image dark-image" width="2040" height="358" data-path="images/build-docs/editor/code-view/web-browser/log-terminal-dark.webp" />
    </Frame>

    ### Toolbar actions

    The top-right of the code view toolbar has quick actions:

    * **Refresh** - Reload the editor and file tree
    * **Download** - Export your app as a `.zip` file to open locally (paid plan required)
    * **GitHub** - Push your project to a GitHub repository

    <Card icon="github" horizontal arrow="true" href="/build/connectors/github/overview">
      Set up GitHub and learn about two-way code sync
    </Card>
  </Tab>

  <Tab title="Mobile App">
    <Note>
      The mobile app supports browsing files and GitHub integration. Editing files, managing environment variables, viewing build logs, and downloading code are only available on the web browser.
    </Note>

    <Frame caption="Code tab on mobile">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/mobile-app/mobile-app-code-views-in-rocket-app.webp?fit=max&auto=format&n=q2IAjGMuqh78nicx&q=85&s=a551b166a0a2056794e6d70fcfa4cfdd" alt="Rocket code editor on mobile." className="theme-mobile-image" width="422" height="908" data-path="images/build-docs/editor/code-view/mobile-app/mobile-app-code-views-in-rocket-app.webp" />
    </Frame>

    ### Browse your files

    Tap the **current file name** at the top of the screen to open the file picker. Browse all folders and files in your project and tap any file to switch to it.

    <Frame caption="File explorer on mobile">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/mobile-app/browse-files-in-mobile-app.gif?s=1aac0ae32b27ed445b52f84a64a9d174" alt="Browsing files in Rocket code view on mobile." className="theme-mobile-image" width="344" height="720" data-path="images/build-docs/editor/code-view/mobile-app/browse-files-in-mobile-app.gif" />
    </Frame>

    ### Refresh

    Tap the **Refresh** button in the top-right corner to reload the editor and file tree.

    <Frame caption="Editor toolbar on mobile">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/q2IAjGMuqh78nicx/images/build-docs/editor/code-view/mobile-app/refresh-and-github-option-in-rocket-app.webp?fit=max&auto=format&n=q2IAjGMuqh78nicx&q=85&s=edf60132164388c1d693a67159558c08" alt="Toolbar showing refresh and GitHub icons." className="theme-mobile-image" width="422" height="908" data-path="images/build-docs/editor/code-view/mobile-app/refresh-and-github-option-in-rocket-app.webp" />
    </Frame>

    ### Push to GitHub

    Tap the **GitHub** button in the top-right toolbar to push your project to a GitHub repository. After the initial push, use **Update** to push new changes.
  </Tab>
</Tabs>

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="Chat with Rocket" icon="messages" href="/build/editor/chat">
    Use chat to make broader changes across your project.
  </Card>

  <Card title="Environment variables" icon="key" href="/build/editor/env-variables">
    Store API keys and secrets your app needs at runtime.
  </Card>

  <Card title="Add custom code" icon="file-code" href="/build/editor/custom-code">
    Bring in external scripts, embeds, and components.
  </Card>

  <Card title="Connect APIs" icon="plug" href="/build/editor/apis">
    Import and integrate API endpoints into your app.
  </Card>
</CardGroup>
