This starter supports two realistic deployment modes:
Vercel + Neon + Cloudflare R2Self-hosted Next.js server + Postgres + Cloudflare R2
The runtime assumptions are the same in both cases:
- Postgres is reachable from the app
- R2 is reachable for media operations
- Auth base URLs match the public origin exactly
- Optional providers are enabled only when their corresponding features are needed
Before the first deploy:
- Copy
.env.exampleto your deployment secret manager or hosting platform. - Fill in all required database, auth, and R2 values.
- Decide whether email, AI assistant, try-on, or video generation are part of your first release.
- Create a production database branch or database.
- Create a production R2 bucket.
- Confirm your public app URL for
BETTER_AUTH_URLandNEXT_PUBLIC_BETTER_AUTH_URL.
- Provision production Postgres credentials
- Provision Cloudflare R2 credentials and bucket
- Decide your production domain before setting auth URLs
Set the vars from .env.example in Vercel.
Required in all cases:
DATABASE_URLDEV_DATABASE_URLPROD_DATABASE_URLBETTER_AUTH_SECRETBETTER_AUTH_URLNEXT_PUBLIC_BETTER_AUTH_URLR2_ACCOUNT_IDR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYR2_BUCKET_NAME
Add optional provider vars only when you are ready to use those features.
Run the normal Vercel deployment flow for the repository. The app already accounts for VERCEL_URL and VERCEL_BRANCH_URL in auth trusted origins when those values exist.
From a trusted environment with production secrets:
bun run db:prod:pushRecommended first-run sequence:
- Create the marketplace-managed seller account if admin-managed catalog operations are required.
- Log in as an admin.
- Configure store settings.
- Add categories, brands, sizes, and colors.
- Upload a logo and product images.
Verify:
- storefront landing page
- locale switching
- admin auth
- seller auth
- product image upload
- add to cart and checkout
Only then enable optional providers one by one.
bun installExport the same env surface used for Vercel deployments.
bun run buildbun run db:prod:pushbun run startRun it behind your preferred reverse proxy, container platform, or process manager.
Enable these only after the store works without them:
Resend: password reset and operational mailDeepInfra: AI shopping assistantOpenAI: routes or tools that still expect an OpenAI key in certain workflowsRunPod: virtual try-on and image-edit generationRunware: generated product videos
Expected behavior when omitted:
- The dependent feature should fail clearly or remain hidden/disabled
- Core storefront, seller, and admin operations should stay deployable
Common deployment mistakes:
BETTER_AUTH_URLdoes not match the public origin- R2 credentials are present but point to the wrong bucket
- Production database schema was never pushed
- Optional AI feature is enabled in UI expectations without provider credentials
- Marketplace-managed seller scripts are used without
MARKETPLACE_INTERNAL_SUPPLIER_ID
Current public deployment guidance remains neutral even though a few legacy internals still exist:
- Some scripts still accept
KIDSWAY_INTERNAL_SUPPLIER_IDas a legacy alias - Some order states still store
shipped_to_kidsway - The optional reference-photo try-on flow still uses the
kid_photostable name internally
Prefer the neutral public names in new operational docs and secrets management.