This guide describes how the Deep Dive Brewing Co website is built, previewed, and deployed.
The repository uses Git with Vercel Git integration.
- Create a feature or fix branch from the main development branch.
- Make your changes.
- Push the branch to GitHub.
- Open a pull request.
- Vercel automatically builds a preview deployment for the pull request.
- Review the preview, run checks, and merge when ready.
Note: The production branch name is configured in Vercel. Typically it is
main, but confirm in the Vercel project settings if you are unsure.
Every push to a branch and every pull request creates a preview URL. You can use this URL to verify changes with real Firebase data before merging.
Preview URLs look like:
https://deepdivebrewing-<random>-<team>.vercel.app
- Preview deployments use the same Firebase project as production if the environment variables point to it.
- Preview domains must be added to Firebase Authentication > Settings > Authorized domains if you need to test Google sign-in on a preview URL.
- The
frame-srcContent-Security-Policy is built at deploy time using the value ofNEXT_PUBLIC_FIREBASE_AUTH_DOMAIN. If that environment variable is not set for the preview, the fallback domain is used.
Merging an approved pull request into the production branch triggers a production deploy on Vercel.
You can also deploy manually from the Vercel dashboard or CLI, but this guide assumes Git-based deployment.
Environment variables are managed in the Vercel dashboard.
These variables are prefixed with NEXT_PUBLIC_ and are embedded in the client bundle. They are safe to expose because they configure Firebase client access only. Actual data access is controlled by Firebase Security Rules.
Examples:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_APP_IDNEXT_PUBLIC_FIREBASE_MEASUREMENT_IDNEXT_PUBLIC_SITE_URLNEXT_PUBLIC_GTM_ID
These variables are used only by API routes or build-time scripts and must not be exposed to the browser.
Examples:
RESEND_API_KEY— injected by the Vercel-managed Resend integration (also setsRESEND_EMAIL_DOMAIN, which the app does not consume)RESEND_FROM_EMAIL,ADMIN_INVITE_FROM_EMAIL— optional sender overrides; both default tonoreply@mail.deepdivebrewing.comon the verified sending domainTRADE_INQUIRY_TO_EMAILVERCEL_DEPLOY_HOOK_URLFIREBASE_ADMIN_PROJECT_IDFIREBASE_ADMIN_CLIENT_EMAILFIREBASE_ADMIN_PRIVATE_KEYADMIN_REBUILD_COOLDOWN_MSSUPER_ADMIN_EMAIL— the verified Google account that receives the initial superadmin role
Local development can run with sample or empty data. To verify a preview with real data:
- Open the Vercel preview URL.
- Navigate to
/beersand confirm the current beer list loads. - Visit
/where-to-buyand confirm partner venues appear. - Visit a beer detail page (
/beers/<slug>) and confirm images load. - Visit
/contactand confirm the map renders. - Visit
/adminand confirm the sign-in button loads (complete sign-in only on an authorized domain).
If data is missing, check that the preview environment variables match the production Firebase project.
The site is configured to redirect:
- HTTP to HTTPS with a permanent 308 redirect.
www.deepdivebrewing.comtodeepdivebrewing.comwith a permanent 308 redirect.
These redirects are defined in next.config.ts.
The admin dashboard has a Rebuild Site button. When clicked:
- The dashboard sends a Firebase ID token to
POST /api/admin/rebuild. - The server verifies the token and confirms the user has an
admin: truecustom claim and an activeadminUsersrecord. - The server calls the Vercel Deploy Hook configured in
VERCEL_DEPLOY_HOOK_URL. - Vercel starts a new production build.
- A cooldown prevents repeated rebuilds. The default cooldown is 10 minutes (
ADMIN_REBUILD_COOLDOWN_MS=600000).
The rebuild is needed because the following pages are static and only update at build time:
/(homepage)/beers/where-to-buy/about/contact/tradesitemap.xml
Beer detail pages (/beers/<slug>) are rendered on demand, so they reflect Firestore changes without a rebuild.
On a fresh deployment — or after changing SUPER_ADMIN_EMAIL — you must establish the bootstrap superadmin using the server-only SUPER_ADMIN_EMAIL value.
- The
SUPER_ADMIN_EMAILenvironment variable is set in Vercel (or your local.env.local). - The bootstrap account has already signed in to Google at least once, so it exists in Firebase Authentication.
- The bootstrap account's email is verified in Firebase Authentication.
- You have the Firebase Admin SDK credentials configured locally (
FIREBASE_ADMIN_PROJECT_ID,FIREBASE_ADMIN_CLIENT_EMAIL,FIREBASE_ADMIN_PRIVATE_KEY).
npm run bootstrap-superadmin -- --dry-runnpm run bootstrap-superadminThe script will:
- Look up the Firebase user whose email matches
SUPER_ADMIN_EMAIL. - Fail safely if the user does not exist, is not verified, or multiple unexpected issues occur.
- Set the custom claim
{ admin: true, role: "superadmin" }. - Create or update the
adminUsers/{uid}record as an active superadmin.
After running the script, the bootstrap user must sign out and sign back in at https://deepdivebrewing.com/admin.
If the wrong account receives superadmin access, a developer can:
- Use the Firebase Admin SDK or Firebase CLI to clear custom claims for that UID.
- Update or delete the corresponding
adminUsersrecord in Firestore. - Set the correct
SUPER_ADMIN_EMAIL, re-run the migration, and ask that user to sign out and back in.
If a production deploy causes problems:
- Identify the last known good commit from the Git history or Vercel deployment list.
- In the Vercel dashboard, find the previous production deployment and click Promote to Production.
- This is usually the fastest rollback.
- Alternatively, revert the problematic commit in Git and merge the revert to the production branch.
- After rollback, verify the live site.
Warning: Promoting a previous deployment is faster than reverting and redeploying, but make sure the previous deployment is actually working before promoting it.
After any production deployment, run through these checks:
- Load https://deepdivebrewing.com and confirm the homepage renders.
- Load
/beersand confirm the beer grid appears. - Click into a beer detail page and confirm the image and metadata load.
- Load
/where-to-buyand confirm venue groups appear. - Load
/contactand confirm the map loads. - Load
/tradeand confirm the inquiry form renders. - Open the browser console and confirm there are no CSP violations or 404 errors.
- Test a Google sign-in attempt on
/admin(complete login only if you are authorized).
For a full checklist, see Post-deployment checklist.
- Open the Vercel dashboard for the project.
- Go to the production deployment.
- The deployment details show the Git commit SHA and message.
- Compare that commit with the latest commit in the repository's production branch.
You can also check the response headers of the live site for build information, but the Vercel dashboard is the most reliable source.