This guide walks through deploying Firevector to Vercel from scratch. Total time: approximately 30 minutes.
- A GitHub account
- A Vercel account (free tier works)
- A Google Cloud account (for OAuth)
- A Mapbox account (free tier includes 50,000 map loads/month)
- Go to github.com/bgorzelic/firevector
- Click Fork in the top-right corner
- Keep the default settings and click Create fork
- Log in to vercel.com
- Click Add New > Project
- Import your forked
firevectorrepository from GitHub - Configure the project:
- Framework Preset: Next.js (auto-detected)
- Root Directory:
apps/web - Build Command:
npm run build(default) - Install Command:
npm install(default)
- Do not deploy yet -- you need to set up environment variables first. Click Cancel or proceed and redeploy later.
- In your Vercel project dashboard, go to Storage
- Click Create > Postgres
- Choose a region close to your expected users (e.g.,
us-east-1for US-based deployments) - Click Create
- Vercel automatically adds the
POSTGRES_URLand related environment variables to your project
After the database is provisioned, push the schema:
# From the repository root
npx drizzle-kit push --config=apps/web/drizzle.config.ts- Go to Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services > OAuth consent screen
- Choose External user type
- Fill in the app name:
Firevector - Add your email as the support email and developer contact
- Add the scope:
email,profile,openid - Click Save and Continue through the remaining steps
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Application type: Web application
- Name:
Firevector Production - Authorized JavaScript origins:
https://your-app.vercel.app(your Vercel deployment URL)http://localhost:3000(for local development)
- Authorized redirect URIs:
https://your-app.vercel.app/api/auth/callback/googlehttp://localhost:3000/api/auth/callback/google
- Click Create
- Copy the Client ID and Client Secret
Note: Replace
your-app.vercel.appwith your actual Vercel deployment URL. If you add a custom domain later (Step 8), add that domain to the authorized origins and redirect URIs as well.
- Go to mapbox.com and create an account
- Navigate to your Account page
- Copy your Default public token (starts with
pk.) - For production use, create a new token with URL restrictions limiting it to your deployment domain
In your Vercel project dashboard, go to Settings > Environment Variables and add the following:
| Variable | Value | Environment |
|---|---|---|
AUTH_GOOGLE_ID |
Your Google OAuth Client ID | Production, Preview, Development |
AUTH_GOOGLE_SECRET |
Your Google OAuth Client Secret | Production, Preview, Development |
AUTH_SECRET |
A random 32+ character string (generate with openssl rand -base64 32) |
Production, Preview, Development |
AUTH_URL |
https://your-app.vercel.app |
Production |
NEXT_PUBLIC_MAPBOX_TOKEN |
Your Mapbox public access token | Production, Preview, Development |
Note: The
POSTGRES_URLand related database variables are automatically added by Vercel when you provision Postgres storage in Step 3.
| Variable | Required | Description |
|---|---|---|
AUTH_GOOGLE_ID |
Yes | Google OAuth 2.0 Client ID |
AUTH_GOOGLE_SECRET |
Yes | Google OAuth 2.0 Client Secret |
AUTH_SECRET |
Yes | NextAuth.js encryption secret (32+ random characters) |
AUTH_URL |
Yes (prod) | Canonical URL of your deployment (e.g., https://firevector.app) |
POSTGRES_URL |
Yes | PostgreSQL connection string (auto-set by Vercel Postgres) |
POSTGRES_URL_NON_POOLING |
Yes | Direct PostgreSQL connection for migrations (auto-set by Vercel Postgres) |
POSTGRES_PRISMA_URL |
No | Prisma-compatible URL (auto-set, not used by Drizzle) |
NEXT_PUBLIC_MAPBOX_TOKEN |
Yes | Mapbox GL JS public access token |
- In your Vercel project dashboard, click Deployments
- Click Redeploy on the latest deployment (or push a commit to trigger a new build)
- Wait for the build to complete (typically 1-2 minutes)
- Click the deployment URL to verify:
- The landing page loads
- Google sign-in works
- The observation form loads after authentication
- The map renders correctly
- In your Vercel project, go to Settings > Domains
- Enter your custom domain (e.g.,
firevector.app) - Follow Vercel's instructions to configure DNS:
- For apex domains: Add an
Arecord pointing to76.76.21.21 - For subdomains: Add a
CNAMErecord pointing tocname.vercel-dns.com
- For apex domains: Add an
- Vercel automatically provisions an SSL certificate
- Update your Google OAuth settings:
- Add the custom domain to Authorized JavaScript origins
- Add
https://your-domain.com/api/auth/callback/googleto Authorized redirect URIs
- Update the
AUTH_URLenvironment variable to your custom domain
The redirect URI in Google Cloud Console must exactly match your deployment URL. Check:
- Protocol (
https://nothttp://) - No trailing slash
- The path is
/api/auth/callback/google
- Verify
POSTGRES_URLis set in your Vercel environment variables - If using Vercel Postgres, check the Storage tab to confirm the database is active
- Run
npx drizzle-kit pushto ensure the schema is up to date
- Verify
NEXT_PUBLIC_MAPBOX_TOKENis set (must be prefixed withNEXT_PUBLIC_to be available client-side) - Check that the token is valid at account.mapbox.com
- If using URL-restricted tokens, ensure your deployment domain is in the allowed list
- Ensure the Root Directory is set to
apps/webin Vercel project settings - Check that all required environment variables are set
- Review the build logs in the Vercel dashboard for specific errors