> ## 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

> Open the file tree in the Rocket.new Build editor to inspect project source, tweak components, and make direct code edits alongside AI changes.

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/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/code-view-light.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=ffd969b7a209470e455d21755b91889d" 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/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/code-view-dark.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=0fc47a21c5d5ed6d665ac13ed2cda952" 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/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/edit-code-message-light.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=58a57f323ebb57ae21dda09252aa5b47" 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/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/edit-code-message-dark.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=7ecb53e86d233992f7b785b74b55447a" 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>

    ### Download your code

    Export your entire project as a `.zip` archive so you can open it in your own IDE, run it locally, run tests, or hand it off to another developer.

    <Frame caption="Code download interface">
      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PJu20_J-ZQRYN4zE/images/build-docs/editor/code-view/web-browser/code-download-light.webp?fit=max&auto=format&n=PJu20_J-ZQRYN4zE&q=85&s=866fe1642b64575b97b7ceb832df98c6" alt="Rocket code editor showing download button in toolbar." className="theme-image light-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/code-download-light.webp" />

      <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/PJu20_J-ZQRYN4zE/images/build-docs/editor/code-view/web-browser/code-download-dark.webp?fit=max&auto=format&n=PJu20_J-ZQRYN4zE&q=85&s=6fecf5ffa8a95f39cf61fa9634f0ff10" alt="Rocket code editor showing download button in toolbar." className="theme-image dark-image" width="2880" height="1624" data-path="images/build-docs/editor/code-view/web-browser/code-download-dark.webp" />
    </Frame>

    <Note>
      Downloading source code requires a **paid plan (Pro or above)** and is only available on the web browser. Mobile app users can browse files and push to GitHub, but code download is not supported.
    </Note>

    <Steps>
      <Step title="Open Code view">
        Open your task in the Build editor and click the **`</> Code`** button in the top toolbar (the same bar as **Preview** and **Full screen**). The main panel switches to code view.

        <Frame caption="Code view toolbar button">
          <img src="https://mintcdn.com/dhiwisepvtltd-5e04e6a4/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/code-view-light.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=ffd969b7a209470e455d21755b91889d" 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/Pv1xS2a1Y3tpMudK/images/build-docs/editor/code-view/web-browser/code-view-dark.webp?fit=max&auto=format&n=Pv1xS2a1Y3tpMudK&q=85&s=0fc47a21c5d5ed6d665ac13ed2cda952" 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>
      </Step>

      <Step title="Click Download in the toolbar">
        Click the **Download** icon in the top-right of the code view toolbar. Rocket packages your full project - source files, configuration, and environment variable templates - into a single `.zip` archive.

        If you are on the Free plan, the button prompts you to upgrade. See [Pricing](/getting-started/pricing) for plan details.
      </Step>

      <Step title="Wait for the export to finish">
        A short progress indicator shows the export status. For large projects this can take up to a minute. Once complete, the `.zip` file is saved to your browser's default download folder.
      </Step>

      <Step title="Extract the archive">
        Locate the downloaded `.zip` file and extract it to a folder on your computer:

        * **macOS**: Double-click the `.zip` file in Finder, or run `unzip project-name.zip` in Terminal
        * **Windows**: Right-click the `.zip` and choose **Extract All**, or run `Expand-Archive project-name.zip` in PowerShell

        The extracted folder contains your full project structure.
      </Step>

      <Step title="Install dependencies and run locally">
        Open the extracted folder in your IDE or terminal and install dependencies.

        <Tabs>
          <Tab title="Next.js (web app)">
            ```bash theme={null}
            npm install
            npm run dev
            ```

            The app starts on `http://localhost:3000`. See the [Next.js getting started guide](https://nextjs.org/docs/getting-started) for more.
          </Tab>

          <Tab title="Flutter (mobile app)">
            ```bash theme={null}
            flutter pub get
            flutter run
            ```

            Choose a connected device or emulator when prompted. See the [Flutter install guide](https://docs.flutter.dev/get-started/install) for setup help.
          </Tab>
        </Tabs>
      </Step>

      <Step title="Add your environment variables">
        Rocket exports an environment template (`.env` for web apps, `env.json` for mobile apps) with placeholder values. Fill in your own API keys and secrets before running the app locally.

        <Card icon="key" horizontal arrow="true" href="/build/editor/env-variables">
          View and manage environment variables
        </Card>
      </Step>
    </Steps>

    <Tip>
      **What to do after downloading:**

      * **Run locally** for testing, automated tests, or custom build steps
      * **Push to a new GitHub repository** to version-control your code and trigger CI/CD pipelines. Use [GitHub integration](/build/connectors/github/overview) for ongoing two-way sync (Next.js TypeScript), or clone the extracted repo and push manually
      * **Continue iterating in Rocket** - anytime you change the app in Rocket, click **Download** again to export the latest version
    </Tip>

    <Warning>
      Downloaded `.zip` archives reflect the project state at the moment of export. They do **not** auto-sync with later changes made in Rocket. To keep a repository up to date automatically, use [GitHub integration](/build/connectors/github/overview) instead of manual downloads.
    </Warning>
  </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>
