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

# Get your code

> Download your Newly project's code to your computer with the newly CLI.

You can download your app's code from Newly (app.newly.app) to your own computer. The fastest way is the **Download source** button in the project's Settings: it saves a ZIP of the complete project — the React Native / TypeScript app, configuration files, assets and your Newly backend code — packed from the released branch (`main`). For a specific branch, an empty-folder checkout the CLI keeps linked to the project, or an automated script, use the `newly` command-line tool (CLI) below.

## Download a ZIP from Settings

**1. Open the project**

Open the project in Newly.

**2. Open Settings**

Choose **Settings** in the sidebar.

**3. Download source**

Under **Project**, press **Download ZIP** on the **Download source** row. Your browser gets a `<project>-source-main.zip`.

The ZIP is everything Newly builds your app from, minus the folders a fresh `npm install` recreates (`.git`, `node_modules`, build output). It always comes from `main`, the released copy. To download the draft your chats are working on instead, use `newly pull` below (`dev` is its default).

> [!NOTE]
>
> One chat's live workspace — including changes not yet committed to any branch — is a different export: open the chat's **⋯** menu and choose **Download session files**.

## Download your project with the CLI

You'll need a computer with Node.js 20 or later and a terminal.

**1. Install the CLI**

```bash theme={null}
npm i -g @newly/cli
```

**2. Sign in**

Sign in with your Newly account:

```bash theme={null}
newly login --email
```

Or use `newly login --google` or `newly login --github`. With `--email`, Newly sends you a code to type into the terminal.

**3. Find your project ID**

Open the project in the web app. The ID is the last part of the address: app.newly.app/projects/`<project-id>`.

**4. Pull the code**

Create an empty folder, open it in your terminal, and run:

```bash theme={null}
newly pull <project-id>
```

The CLI downloads the project's app and backend code into that folder.

### Which branch you get

By default, `newly pull` downloads the `dev` branch, which is where your chats work. If the project has no `dev` branch, it downloads `main`. See [Where your code lives](https://docs.newly.app/code/where-your-code-lives.md) for how the two branches differ.

### Options

| Option | What it does |
| - | - |
| `--branch <name>` | Download a specific branch, for example `--branch main`. |
| `--force` | Download into a folder that isn't empty. This replaces local changes, and removes top-level files and folders that aren't in the project. It keeps `.git`, `node_modules` and `.env`. |

Very large projects may be too big to download this way. If `newly pull` refuses a project for its size, [contact support](https://docs.newly.app/help/getting-help.md).

### Other useful commands

* `newly whoami` shows which account you're signed in with.
* `newly logout` signs you out.

## What you can and can't do with the code

* **You can** open the code in your own editor, read it and keep a backup.
* To send external code changes back to Newly, use a linked repository through [Connect GitHub](https://docs.newly.app/code/github.md). Downloading a ZIP or running `newly pull` is a download, not an upload or a sync connection.

The CLI can also deploy your Newly Backend and manage its secrets, for dev and production. See [Production and secrets](https://docs.newly.app/backend/production-and-secrets.md).

## GitHub

Open **Integrations**, then **GitHub**, to connect your GitHub account. Then create a new repository for this project, or link one you already have. The linked repository syncs changes in both directions. See [Connect GitHub](https://docs.newly.app/code/github.md) for branches, collaborators and conflicts.

You can also download the source and push it to a repository manually. That manual copy does not establish automatic sync.

### The "GitHub to Mobile App" starter

The **GitHub to Mobile App** starter on the Home screen starts a new project from a GitHub repository. After **Check repo**, choose **Use as reference** (Newly reads the repository and never commits to it) or **Use this repo** (Newly works in the repository and pushes every commit made in Newly to it). See [Start from your Lovable or GitHub app](https://docs.newly.app/get-started/start-from-your-app.md).

## Related pages

> [card] [Where your code lives](https://docs.newly.app/code/where-your-code-lives.md)
>
> Saved versions, branches and updating main.

> [card] [Production and secrets](https://docs.newly.app/backend/production-and-secrets.md)
>
> Deploy your backend and set secrets with the CLI.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.