# Import an app from GitHub or a zip file

> Import an existing codebase into Draftbit from a GitHub repository or zip file

If you already have a codebase somewhere else, you don’t have to start over in Draftbit. You can import it directly from a GitHub repository or from a zip file, then keep building on it with the [AI-powered app builder](https://docs.draftbit.com/features/ai-app-builder).

To have Draftbit work in your own repository instead of a copy, [connect the repository](https://docs.draftbit.com/features/connect-github-repo) rather than importing it.

## Start the import

From the [Dashboard](https://next.draftbit.com/dashboard), click **Create New Project**, then select the **Import** option.

![Create New Project screen with Import selected, showing Private GitHub repo, Public GitHub repo, and Zip file source options](https://docs.draftbit.com/_astro/v2-github-import-create-project.CsnJbHdg_1KDJmc.webp)

Choose where your code lives:

* **Private GitHub repo**: connect your GitHub account to import a private repository.
* **Public GitHub repo**: paste the URL of any public repository.
* **Zip file**: upload your project as a zip archive. Zip the folder that contains your app’s `package.json`. A zip with more than one app in it can’t be imported.

Monorepos are supported too. For a GitHub repository, point Draftbit at the app’s folder in the next step. For a zip file, zip only that app’s folder. Draftbit imports only that folder, so it has to hold all of the app’s code. If the app uses shared packages from elsewhere in the repository, copy them into the app’s folder first.

Each import creates a new project, unless you start it with **Import app** on a project’s page. The Free plan includes up to 3 projects, and every plan limits how many apps a project can hold. If you’re at a limit, **Continue** opens an upgrade prompt on this first step. To make room without upgrading, delete a project or app you no longer need.

What can be imported

* JavaScript or TypeScript apps with a `package.json` file.
* Expo mobile apps, Vite web apps, Astro sites, and Hono APIs can use the full builder once you migrate them to Draftbit conventions.
* Other JavaScript frameworks, like Next.js, Remix, or SvelteKit, and Node.js backends, like Express or Fastify APIs, keep their setup and get chat, code editing, and preview.
* React Native apps that don’t use Expo import with your setup preserved, and you can convert them to Expo later.

What can’t be imported

* Native iOS (Swift) and Android (Kotlin or Java) apps.
* Electron desktop apps. If the app has a web version that runs on its own, import that instead.
* Capacitor apps that wrap a website without including the website’s code. Import the website instead.
* An app folder that uses code from outside it, such as shared packages elsewhere in a monorepo.
* Flutter, React Native for Windows or macOS, and other non-JavaScript stacks.
* Projects without a `package.json`, or repos with several apps and no folder chosen.

## Locate the repository

Paste the repository address. Draftbit checks that it holds an app it can import before you continue.

![Paste the address of your repository step](https://docs.draftbit.com/_astro/v2-github-import-locate-repo.CSN5EwU__HAPTf.webp)

If your app’s `package.json` isn’t at the top of the repository, as in a monorepo, set **App folder** to the folder that contains it, such as `apps/mobile`. Open **Advanced options** to import from a branch other than the default.

## Name your app and choose how to import it

Once your repository passes the checks, name the project and app, then choose how Draftbit should bring it in:

* **Import & migrate to Draftbit conventions** — an agent rewrites your code to fit Draftbit’s conventions, which unlocks the full builder. You approve the migration plan before anything changes. This option is only available when your app is detected as **Expo, Vite, Astro, or Hono** — Draftbit doesn’t yet have an automated migration path for other frameworks.
* **Import & preserve existing setup** — your code stays as it is, apart from a small preview setup that exports remove. Draftbit may also update `package.json` and `yarn.lock` so dependencies install. You still get chat, code editing, and preview, but without the full builder feature set.

![Name your app and choose how to import it step, with Import & migrate to Draftbit conventions selected](https://docs.draftbit.com/_astro/v2-github-import-options.BykbVJBO_Z1mRu2p.webp)

## Review and import

Check the details before importing — the source, repository, branch, detected framework, and import method. You can go back and change any of them.

![Ready to import summary screen showing project, source, repository, branch, detected framework, and import method](https://docs.draftbit.com/_astro/v2-github-import-ready.BhTOTQ2z_23t1df.webp)

Click **Import app** to start. Draftbit fetches your code, creates the app, and sets up your workspace — this usually takes under a minute.

![Importing your app progress screen, fetching code](https://docs.draftbit.com/_astro/v2-github-import-progress.BA8whUfz_Z2cYmao.webp)

## Running the migration

If you chose **Import & migrate to Draftbit conventions**, the agent starts the migration when the app opens in the builder. It reads your code and writes a migration plan, then stops. Nothing in your app changes until you approve the plan. Open the plan in the chat to read it, then click **Implement the plan.** to start, or send feedback to get a revised plan. Once you approve it, the agent works through the plan step by step, aligning routing, styling, and config, and fixing type and lint errors. You can keep chatting with it while the migration runs.

If your code uses [environment variables](https://docs.draftbit.com/features/environments) that have no value yet, a notice tells you how many when the migration or setup run starts. Click **Review** to see them and add the ones your app needs, ideally before you approve the plan.

If you chose **Import & preserve existing setup**, the agent starts a setup run when the app opens instead. It writes a plan to get your app running in Draftbit without changing its framework or structure. As with a migration, nothing changes until you approve the plan.

### Bringing over what your code doesn’t include

Your code rarely has everything your app needs. Secrets, database data, and backends hosted by another service stay behind. Both the migration plan and the setup plan end with a **What to bring over** checklist that says what’s missing, why your app needs it, and where to find it.

* **Secrets and API keys:** add them in your app’s **Settings > Environment Variables**. Don’t paste secret values into the chat.
* **Database dumps and table exports:** attach `.sql`, `.dump`, `.gz`, `.csv`, or `.json` files to a chat message, up to 250 MB each and 1 GB combined. These attachments are stored privately for your app. The agent loads them into your app’s database.
* **Larger databases:** add the old database’s connection string as an environment variable, and the agent copies the data across. Delete the variable once it’s done.
* **Backends that lived on another platform:** the agent suggests adding a Supabase or backend app to your project with **Add app**, then helps you move your data and code there.

### Migrating later

If an app that kept its existing setup is detected as **Expo, Vite, Astro, or Hono**, a **Migrate** button appears in the top bar for Editors and above. Click it, then **Migrate app** to switch the app to the full builder. Draftbit restarts the app’s workspace, and the agent starts the migration described above. Unsaved changes in the workspace are lost, so save first.

### React Native apps without Expo

A React Native app that doesn’t use Expo imports with its existing setup. Draftbit tries to give it a web preview. If the app depends on native-only code that can’t run on the web, it imports without a preview, and you can still chat with the agent and edit code.

To move it onto Expo, click **Convert to Expo** in the top bar, then **Convert app**. An agent adds Expo, sets up a web preview where it can, and keeps your navigation, styling, and libraries. Once the converted project is saved, the **Migrate** button appears so you can switch to the full builder as described above.
