Vercel
Deploying Manic to Vercel's global infrastructure.
Deploying to Vercel
Manic integrates with Vercel using the official @manicjs/providers package. This provider transforms your built application into the Vercel Build Output API format.
Setup
First, ensure you have the provider installed:
bun add @manicjs/providersThen, configure it in manic.config.ts:
import { defineConfig } from 'manicjs/config';
import { vercel } from '@manicjs/providers';
export default defineConfig({
providers: [vercel({
regions: ['sfo1'],
})],
});Deployment
Simply run the Vercel CLI from your project root:
vercelFor production:
vercel --prodHow It Works
Build Output Architecture
The Vercel provider transforms Manic's unified .manic/ output into the Vercel Build Output API (v3) layout.
Manic build output (input to the provider):
Provider output (under .vercel/output/):
client/→.vercel/output/static/(global CDN)server.jsandapi/bundles →.vercel/output/functions/(Serverless by default, or Edge whenedge: trueon the provider)- Mounted
/api/*routes stay on/api/*in production
Regions & Functions
export default defineConfig({
providers: [vercel({
regions: ['sfo1', 'iad1'], // US West, US East
edge: false, // Use Serverless (default)
// edge: true, // Use Edge Functions (faster, limited runtime)
})],
});Environment Variables
Set environment variables in Vercel's dashboard or via the CLI:
vercel env add SECRET_KEYAccess them in API routes:
export async function GET() {
const secret = process.env.SECRET_KEY;
return Response.json({ secret });
}Incremental Static Regeneration (ISR)
Manic doesn't use ISR; however, you can implement server-side caching for static-like content:
// app/api/posts/index.ts
import { runtime } from '@vercel/functions';
export async function GET() {
const cached = await runtime.cache.get('posts');
if (cached) return cached;
const posts = await fetchPosts();
await runtime.cache.set('posts', Response.json(posts), {
tags: ['posts'],
revalidate: 3600, // 1 hour
});
return Response.json(posts);
}Revalidate Routes
Invalidate cached routes with Vercel's Revalidate API:
curl -X POST https://api.vercel.com/v1/deployments/<deployment-id>/revalidate \
-H "Authorization: Bearer $VERCEL_TOKEN" \
-d '{"paths": ["/posts"]}'Debugging Deployments
View Logs
vercel logsInspect Function Output
vercel inspectTest Locally
vercel devThis emulates the Vercel environment locally, including serverless function behavior.