Create a .env.local file in your calendefi-new directory:
# Solana Configuration
VITE_SOLANA_RPC_URL=https://api.devnet.solana.com
VITE_SOLANA_NETWORK=devnet
# Backend API URL (update this to your Vercel backend URL)
VITE_API_BASE_URL=https://your-backend-app.vercel.app
# Google OAuth (if using Google Sign-in)
VITE_GOOGLE_CLIENT_ID=your_google_client_id_hereCreate a .env file in your backend directory:
# Server Configuration
PORT=3001
NODE_ENV=production
# Google Calendar API
GOOGLE_CALENDAR_CREDENTIALS_PATH=./service-account-key.json
GOOGLE_CALENDAR_SERVICE_ACCOUNT_EMAIL=calendefi-agent@coders-connect-450316.iam.gserviceaccount.com
# Solana Configuration
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_NETWORK=devnet
# CORS Configuration
FRONTEND_URL=https://your-frontend-app.vercel.app-
Connect to Vercel:
cd calendefi-new npx vercel -
Set Environment Variables in Vercel Dashboard:
- Go to your project settings
- Add these environment variables:
VITE_SOLANA_RPC_URL=https://api.devnet.solana.comVITE_SOLANA_NETWORK=devnetVITE_API_BASE_URL=https://your-backend-app.vercel.app
-
Create vercel.json in backend directory:
{ "version": 2, "builds": [ { "src": "server.js", "use": "@vercel/node" } ], "routes": [ { "src": "/(.*)", "dest": "/server.js" } ], "env": { "NODE_ENV": "production" } } -
Deploy backend:
cd backend npx vercel -
Set Environment Variables in Vercel Dashboard:
PORT=3001NODE_ENV=productionSOLANA_RPC_URL=https://api.devnet.solana.comSOLANA_NETWORK=devnetFRONTEND_URL=https://your-frontend-app.vercel.app
IMPORTANT: You need to add your Google Service Account key to Vercel:
-
Convert your service-account-key.json to base64:
base64 -i backend/service-account-key.json
-
Add as Environment Variable in Vercel:
- Variable name:
GOOGLE_SERVICE_ACCOUNT_KEY - Value: The base64 encoded string from step 1
- Variable name:
-
Update backend/server.js to use the environment variable:
// Add this at the top of server.js const fs = require('fs'); const path = require('path'); // Create service account key from environment variable if (process.env.GOOGLE_SERVICE_ACCOUNT_KEY) { const serviceAccountKey = Buffer.from(process.env.GOOGLE_SERVICE_ACCOUNT_KEY, 'base64').toString('utf-8'); fs.writeFileSync(path.join(__dirname, 'service-account-key.json'), serviceAccountKey); }
VITE_SOLANA_RPC_URL=https://api.devnet.solana.com
VITE_SOLANA_NETWORK=devnet
VITE_API_BASE_URL=https://your-backend-app.vercel.app
VITE_GOOGLE_CLIENT_ID=your_google_client_id_here
PORT=3001
NODE_ENV=production
SOLANA_RPC_URL=https://api.devnet.solana.com
SOLANA_NETWORK=devnet
FRONTEND_URL=https://your-frontend-app.vercel.app
GOOGLE_SERVICE_ACCOUNT_KEY=base64_encoded_service_account_key
GOOGLE_CALENDAR_SERVICE_ACCOUNT_EMAIL=calendefi-agent@coders-connect-450316.iam.gserviceaccount.com
# 1. Install Vercel CLI
npm i -g vercel
# 2. Deploy Frontend
cd calendefi-new
vercel --prod
# 3. Deploy Backend
cd ../backend
vercel --prod
# 4. Update environment variables in Vercel dashboard
# 5. Redeploy both apps- Check Frontend: Visit your frontend Vercel URL
- Check Backend: Visit
https://your-backend-app.vercel.app/api/health - Test Calendar Integration: Try onboarding a calendar
- Test Transactions: Create a test SOL transaction
- CORS Issues: Make sure
FRONTEND_URLmatches your actual frontend URL - Service Account Issues: Verify the base64 encoding is correct
- API Connection: Check that
VITE_API_BASE_URLpoints to your backend - Build Errors: Check Vercel build logs for missing dependencies