|
| 1 | +# Deployment |
| 2 | + |
| 3 | +This guide will walk you through setting up hosting with Vercel and GitHub. |
| 4 | + |
| 5 | +Note that AirBadge works with almost any hosting provider, including [Fly](https://fly.io), [Railway](https://railway.app), [Netlify](https://netlify.com), [Docker](https://docker.com), and many more. |
| 6 | + |
| 7 | +## Preparing |
| 8 | + |
| 9 | +Here's what you'll need: |
| 10 | + |
| 11 | +- A [Stripe account](https://dashboard.stripe.com/register). It's free to create. |
| 12 | +- A database. Create a free one using [Neon](https://pg.new) or [Vercel](https://vercel.com/docs/storage/vercel-postgres). |
| 13 | +- OAuth credentials (optional). See [Auth.js Instructions](https://authjs.dev/guides/configuring-oauth-providers). |
| 14 | + |
| 15 | +## Create a database |
| 16 | + |
| 17 | +The production database can be migrated via your local machine. Just specify your production `DATABASE_URL` on the command line: |
| 18 | + |
| 19 | +```bash |
| 20 | +DATABASE_URL=... pnpm prisma db push |
| 21 | +``` |
| 22 | + |
| 23 | +## Setup OAuth Credentials |
| 24 | + |
| 25 | +This step is optional and only required if you are using OAuth. |
| 26 | + |
| 27 | +See [Auth.js's Guide](https://authjs.dev/getting-started/authentication/oauth) for more information about setting up OAuth providers. |
| 28 | + |
| 29 | +## Setup hosting |
| 30 | + |
| 31 | +The easiest way to set up hosting with Vercel is via a GitHub connection. |
| 32 | + |
| 33 | +1. Create a [new project](https://vercel.com/new). |
| 34 | +2. Import a GitHub repo. |
| 35 | +3. Setup environment variables (detailed below). |
| 36 | + |
| 37 | +### Environment Variables |
| 38 | + |
| 39 | +Select the project in Vercel, and go to Settings -> Environment Variables. |
| 40 | + |
| 41 | +Then you'll need the following variables: |
| 42 | + |
| 43 | +- `DOMAIN`: The base url of your app. For example: `https://example.tld` |
| 44 | +- `DATABASE_URL`: The URL to the database. For example: `postgresql://user:password@host:5432/dbname?schema=public`. |
| 45 | +- `SECRET_STRIPE_KEY`: Your secret Stripe key. Starts with `sk_prod_...`. Can be found in the Stripe Dashboard under [Developers -> API Keys](https://dashboard.stripe.com/apikeys) |
| 46 | +- `STRIPE_WEBHOOK_SECRET`: |
| 47 | +- `AUTH_SECRET`: Generate it with `openssl rand -base64 33` |
| 48 | +- `AUTH_*`: OAuth provider credentials. For example, GitHub would need `AUTH_GITHUB_ID` & `AUTH_GITHUB_SECRET`. |
| 49 | + |
| 50 | +## Deploy |
| 51 | + |
| 52 | +Now anytime you push code to GitHub, it will automatically be deployed to Vercel. |
0 commit comments