Deploying a Weaverse Next.js Storefront to Vercel
Vercel builds and hosts Next.js apps with no extra configuration, which makes it the natural home for a storefront built with@weaverse/next. Forward, the Weaverse Next.js starter theme, runs on Vercel in production.
Prerequisites
- Vercel account connected to your Git provider (GitHub, GitLab or Bitbucket)
- Next.js storefront using
@weaverse/next, pushed to a Git repository - Weaverse Project ID (from Weaverse Studio’s Project Settings or the project URL)
- Shopify Storefront API credentials for your store
- A local production build that succeeds (
next build) with the same environment variables you plan to use on Vercel
Quick Flow
1
Import the repository
Create a new Vercel project from your Git repository.
2
Add environment variables
Weaverse and Shopify variables, for Production and Preview.
3
Deploy
Vercel builds the app and gives you a deployment URL.
4
Point Weaverse Studio at the deployment
Set the project’s preview URL so Studio loads your live storefront.
1. Import the Repository
- In the Vercel dashboard, click Add New… → Project.
- Select your storefront’s repository and click Import.
- Vercel detects Next.js as the framework preset. Keep the default build and output settings unless your app needs something else.
- If the storefront lives in a subfolder of a monorepo, set Root Directory to that folder.
bun.lock, pnpm-lock.yaml, yarn.lock or package-lock.json).
2. Add Environment Variables
Open Settings → Environment Variables and add the variables your storefront reads. A typical@weaverse/next storefront needs:
Add any other variables your app reads, such as Customer Account settings.
Production and Preview values
Each variable can be scoped to Production, Preview and Development:- Production serves your live domain.
- Preview applies to every branch and pull request deployment. Use it to test a change in Studio before it reaches production, with the same
WEAVERSE_PROJECT_IDor a separate staging project. - Development is what
vercel env pullwrites to a local.envfile.
3. Deploy
Click Deploy. Vercel builds the app and assigns a URL such asyour-project.vercel.app. After the first deployment, every push to the production branch deploys to production, and every other branch gets its own preview deployment.
4. Connect Weaverse Studio
Studio loads your storefront in an iframe, so it needs a URL it can reach.- Open your project in Weaverse Studio.
- In Project Settings, set the preview URL to your deployment, for example
https://your-project.vercel.app. - Reload Studio and check that your pages render and that editing a section updates the preview.
Caching
The SDK and Next.js handle most caching for you. Keep these rules in mind on Vercel:- Published pages can use Next’s
revalidate(ISR) and the server client’scacheoption (revalidateandtags), so storefront pages are served from cache and refreshed in the background. - Studio requests are never cached. In design, preview and revision-preview mode the SDK fetches with
no-store, so merchants always see their latest edits, even on a route that is otherwise static. - The per-item revalidation route must stay dynamic. Studio posts to it (by default
/api/weaverse/revalidate) to re-run a section’s loader after an edit. Mark itdynamic = 'force-dynamic'so Vercel never caches its responses.
app/api/weaverse/revalidate/route.ts
Custom Domain
Add your domain under Settings → Domains in the Vercel project, then update the DNS records Vercel shows you. For DNS background and Shopify-specific notes, see Custom Domain & DNS Setup. After the domain is live, update the preview URL in Weaverse Studio if you want Studio to load the custom domain.Troubleshooting
- Build fails on missing variables: Check that every required variable is set for the environment being built (Production or Preview), then redeploy.
- Studio shows a Vercel login page: Deployment Protection is on for that deployment. Use the production URL or disable protection for previews.
- Studio preview is blank or stuck connecting: Make sure the preview URL matches the deployment exactly and that the Studio connector is mounted in your root layout. See Studio Integration.
- Page selector cannot open the default product, collection or page: Set
PUBLIC_STOREFRONT_API_TOKENand pass the SDK’spublicEnvto Studio. See Studio Integration. - Edits to a product picker show stale data: The revalidation route is missing, or it is being cached. Confirm it exists and is
force-dynamic.
Best Practices
- Keep secrets out of Git: Set them in Vercel, not in committed
.envfiles. - Test with Preview deployments: Open a pull request, check the preview deployment, then merge.
- Match local and Vercel settings: Use
vercel env pullto run locally with the same variables. - Pin exact package versions: Install an exact
@weaverse/nextversion so every deployment builds the same code.