@vercel/functions for serverless background processing. Vercel is the recommended deployment target.
Postcard uses the Vercel AI SDK’s
waitUntil pattern to run the forensic pipeline as a background task after returning an immediate 202 Accepted response to the client. This allows long-running AI analysis to complete without blocking the HTTP response or hitting serverless function timeout limits.Deploy to Vercel
Fork or clone the repository
Fork postcardhq/postcard on GitHub, or push your own clone to a GitHub, GitLab, or Bitbucket repository.
Connect to Vercel
Go to vercel.com/new and import your repository. Vercel automatically detects the Next.js framework and configures the build settings.
Add environment variables
In the Vercel project settings under Environment Variables, add the following:Required:
Recommended for production:
See Environment variables for the full list of options, including social media API keys for improved platform ingestion.
| Variable | Value |
|---|---|
GOOGLE_GENERATIVE_AI_API_KEY | Your Gemini API key from Google AI Studio |
NEXT_PUBLIC_FAKE_PIPELINE | false |
| Variable | Value |
|---|---|
TURSO_DATABASE_URL | Your Turso database URL (e.g. libsql://your-database.turso.io) |
TURSO_AUTH_TOKEN | Your Turso auth token |
NEXT_PUBLIC_APP_URL | Your deployment URL (e.g. https://postcard.example.com) |
If you omit
TURSO_DATABASE_URL, Vercel will use an in-memory SQLite instance that does not persist data between deployments. Set up a Turso cloud database for persistent storage.API reference endpoint
The/api/reference endpoint is powered by Scalar and serves an interactive API reference in both development and production. Visit /api/reference on your deployed instance to explore and test the Postcard API directly from the browser.
The underlying OpenAPI specification is available at /openapi.json.
CORS
The Postcard API allows requests from all origins by default. Responses include the following headers:Using fake mode for demos
For public demos or presentations where API quota reliability matters, you can deploy with fake mode enabled:Production checklist
Before going live, confirm the following:NEXT_PUBLIC_FAKE_PIPELINEis set tofalseGOOGLE_GENERATIVE_AI_API_KEYis set to a valid, active keyTURSO_DATABASE_URLandTURSO_AUTH_TOKENare configured for persistent storageNEXT_PUBLIC_APP_URLis set to your canonical deployment URL for correct OG image and metadata resolution