# Apps from GitHub

dudbox can build and run your own app from a GitHub repo. After that, every push to the branch deploys again.

## Import a repo

1. In the dashboard, click **New**, then **GitHub repository**.
2. The first time, click **Install on GitHub**. GitHub asks which repos dudbox may read. Pick one or more, then come back.
3. Pick the repo. You can change:
   - **Name**: the app's name. It is also the start of its address.
   - **Root directory**: the folder to build, for a repo with more than one app (like `apps/web`).
   - **Env vars**: the settings your app needs, like `DATABASE_URL`. Paste a whole `.env` file into a field to fill them at once. They are saved as secrets.
4. Click **Deploy**. dudbox builds the newest commit of the default branch.

## What your app needs

- **Listen on `$PORT`.** dudbox sets the env var `PORT` (8080 unless you change it in Settings) and sends traffic there.
- **No Dockerfile needed.** dudbox builds with [Railpack](https://railpack.com), which finds out how to build most apps by itself (it reads `package.json`, `requirements.txt`, `go.mod` and so on).
- **Answer within 60 seconds.** A new version goes live when its port answers. With a health check path (Settings), it must answer that path with a status below 400. See [Deployments](/docs/deployments.md).
- **Migrations in the release command.** An app with a database usually migrates it before it starts. Put that command (like `npx prisma migrate deploy`) in **Settings → Release command**, not in the start command. The first deploy starts when you import the repo, before you can set it: set it, then click **Deploy latest commit** on the Deployments tab. See [Release command](/docs/settings.md#release-command).

## Deploy on push

Every push to the branch builds and deploys the new commit, usually within a few seconds. The **Deployments** tab shows each one, with its commit message and author. To deploy without a push, click **Deploy latest commit** there.

To change the repo, branch or folder later, or to stop deploying on push, go to **Settings → GitHub**.

## More repos

If you gave dudbox only some repos, the New dialog has **Add more repos on GitHub** under the repo list. You can also click **Manage GitHub access** on the Account page and change the dudbox app's repo access there. If the dialog says **Log in to GitHub again**, click it: GitHub forgot dudbox's login, for example after you removed the app there.
