Backend (https://promptpipe-backend.dschulz.dev)
Set the following environment variables in Vercel for the backend deployment:
-
BETTER_AUTH_URL
- Value:
https://promptpipe-backend.dschulz.dev - Description: The base URL of your backend authentication service
- Value:
-
BETTER_AUTH_SECRET
- Value:
AcF7q7NEkgcEZTBxgSLjf1JqFRi0flJc(or generate a new secure secret) - Description: Secret key for Better Auth
- Value:
-
GITHUB_CLIENT_ID
- Value: Your GitHub OAuth App Client ID
- Description: GitHub OAuth application client ID
-
GITHUB_CLIENT_SECRET
- Value: Your GitHub OAuth App Client Secret
- Description: GitHub OAuth application client secret
-
NODE_ENV
- Value:
production - Description: Sets the environment to production mode
- Value:
-
DATABASE_URL
- Value: Your production PostgreSQL connection string
- Description: PostgreSQL database connection string
-
REDIS_URL
- Value: Your production Redis connection string
- Description: Redis connection string for queue management
-
FRONTEND_URL
- Value:
https://promptpipe.dschulz.dev - Description: Your frontend application URL
- Value:
-
POSTHOG_API_KEY
- Value: Your PostHog API key
- Description: Analytics service API key
-
OPENAI_API_KEY (if used)
- Value: Your OpenAI API key
-
GOOGLE_GENERATIVE_AI_API_KEY (if used)
- Value: Your Google AI API key
-
OPENROUTER_KEY (if used)
- Value: Your OpenRouter API key
Frontend (https://promptpipe.dschulz.dev)
Set the following environment variables in Vercel for the frontend deployment:
-
VITE_SERVER_URL
- Value:
https://promptpipe-backend.dschulz.dev - Description: Backend API base URL
- Value:
-
VITE_BASE_URL
- Value:
https://promptpipe.dschulz.dev - Description: Frontend base URL
- Value:
Make sure your GitHub OAuth App is configured with the correct callback URL:
- Authorization callback URL:
https://promptpipe-backend.dschulz.dev/api/auth/callback/github
You can update this in your GitHub OAuth App settings at: https://github.com/settings/developers
The authentication flow uses cookies with the following settings for production:
- Domain:
.dschulz.dev(set viacrossSubDomainCookies.domain- allows cookies to be shared across subdomains) - SameSite:
none(required for cross-origin requests) - Secure:
true(HTTPS only) - HttpOnly:
true(prevents JavaScript access)
Important: The domain should ONLY be set in crossSubDomainCookies.domain, not in individual cookie attributes. Better Auth will handle cookie domain inheritance automatically.
The backend is configured to accept requests from:
https://promptpipe.dschulz.devhttps://promptpipe-backend.dschulz.dev
Note: Better Auth trustedOrigins does not support wildcard patterns like https://*.dschulz.dev. Each subdomain must be listed explicitly.
-
Backend Deployment:
- Connect your repository to Vercel
- Set the root directory to
apps/backend - Add all environment variables listed above
- Deploy
-
Frontend Deployment:
- Connect your repository to Vercel (or add as a separate project)
- Set the root directory to
apps/web - Add all environment variables listed above
- Deploy
-
Verify Authentication:
- Visit https://promptpipe.dschulz.dev
- Try to sign in with GitHub
- Check browser DevTools for any CORS or cookie errors
- Verify that the session cookie is being set with the correct domain
- Check Browser Console: Look for CORS errors or cookie warnings
- Verify Environment Variables: Ensure all URLs are correct and don't have trailing slashes
- Check Cookie Settings: In browser DevTools > Application > Cookies, verify:
- Cookie domain is
.dschulz.dev - Cookie has
SecureandHttpOnlyflags - Cookie
SameSiteis set toNone
- Cookie domain is
- Verify GitHub OAuth: Ensure callback URL matches exactly
- Check Logs: Review Vercel function logs for any errors
If you see CORS errors:
- Verify
NODE_ENV=productionis set in backend - Check that frontend URL is in the allowed origins list
- Ensure credentials are included in fetch requests (
credentials: 'include')
- Verify
BETTER_AUTH_URLmatches your backend domain - Check that both domains use HTTPS
- Ensure
SameSite=NoneandSecure=truefor cross-domain cookies