Back to: README.md | See also: LOGGING.md for debugging deployments
This project supports deploying all 4 Task Vantage services to Vercel as separate serverless functions. Each service runs independently and can be deployed and scaled separately.
- API Service (
task-vantage-api) - REST API built with Hono + Auth0 JWT validation - MCP Service (
task-vantage-mcp) - Model Context Protocol server with Hono + mcp-handler + Custom Token Exchange - Agent Service (
task-vantage-agent) - LlamaIndex agent with OpenAI integration + Auth0 sessions - Web App Service (
task-vantage-webapp) - Web application frontend with Auth0 OAuth2 flow
Each service is deployed as a serverless function with its own domain:
- API:
api.taskvantage.example.com - MCP:
mcp.taskvantage.example.com - Agent:
agent.taskvantage.example.com - Web App:
webapp.taskvantage.example.com
- Install Vercel CLI:
npm install -g vercel(or use the local dev dependency) - Login to Vercel:
vercel login
Bootstrap all services at once:
npm run bootstrap:allOr bootstrap each service individually:
npm run bootstrap:api # Links task-vantage-api project
npm run bootstrap:mcp # Links task-vantage-mcp project
npm run bootstrap:agent # Links task-vantage-agent project
npm run bootstrap:webapp # Links task-vantage-webapp projectNote: These scripts match the ones documented in README.md.
Deploy all services sequentially:
npm run deploy:all # Sequential deployment (safer)
npm run deploy:parallel # Parallel deployment (faster)Or deploy each service individually:
npm run deploy:api # Deploys API service
npm run deploy:mcp # Deploys MCP service
npm run deploy:agent # Deploys Agent service
npm run deploy:webapp # Deploys Web App serviceView logs for services:
npm run logs:all # View all service logs
npm run logs:api # View API service logs
npm run logs:mcp # View MCP service logs
npm run logs:agent # View Agent service logs
npm run logs:webapp # View Web App service logsOpen deployed services in browser:
npm run open:deployed:all # Open all service dashboards
npm run open:deployed:api # Open API service dashboard
npm run open:deployed:mcp # Open MCP service dashboard
npm run open:deployed:agent # Open Agent service dashboard
npm run open:deployed:webapp # Open Web App service dashboardComplete script reference: See README.md for all available commands.
Each service has its own Vercel configuration in its respective directory:
vercel/api/vercel.json- API service configurationvercel/mcp/vercel.json- MCP service configurationvercel/agent/vercel.json- Agent service configurationvercel/webapp/vercel.json- Web App service configuration
Each Vercel project needs its environment variables configured in the Vercel dashboard:
- Go to your project dashboard on vercel.com (e.g., task-vantage-api)
- Navigate to Settings → Environment Variables
- Add the required variables for that service
Important: When deployed to Vercel, services communicate via public URLs, not localhost:
# Local development
API_BASE_URL=http://localhost:8787
MCP_BASE_URL=http://localhost:8080
# Production deployment
API_BASE_URL=https://api.taskvantage.example.com
MCP_BASE_URL=https://mcp.taskvantage.example.comREDIS_URL - Automatically provided by Vercel for all deployed services:
- ✅ Vercel Deployment:
REDIS_URLis automatically set by Vercel's Redis add-on ⚠️ Local Development: Only configureREDIS_URLif you have a local Redis instance- 🚫 Not Required: Do not manually set
REDIS_URLin Vercel environment variables
Note: Vercel automatically provisions and configures Redis storage for serverless functions. The
REDIS_URLenvironment variable is injected at runtime and points to Vercel's managed Redis service.
API Service (task-vantage-api):
AUTH0_DOMAINAPI_AUTH0_AUDIENCEAPI_DEFAULT_ORGLOG_VERBOSE
MCP Service (task-vantage-mcp):
AUTH0_DOMAINAPI_BASE_URL(URL of deployed API service)MCP_AUTH0_AUDIENCEMCP_AUTH0_CLIENT_IDMCP_AUTH0_CLIENT_SECRETMCP_AUTH0_SUBJECT_TOKEN_TYPEMCP_AUTH0_EXCHANGE_SCOPELOG_VERBOSE
Agent Service (task-vantage-agent):
AUTH0_DOMAINMCP_BASE_URL(URL of deployed MCP service)AGENT_AUTH0_CLIENT_IDAGENT_AUTH0_CLIENT_SECRETAGENT_SESSION_SECRETOPENAI_API_KEYLOG_VERBOSE
Web App Service (task-vantage-webapp):
AUTH0_DOMAINAPI_BASE_URL(URL of deployed API service)API_AUTH0_AUDIENCEWEBAPP_AUTH0_CLIENT_IDWEBAPP_AUTH0_CLIENT_SECRETWEBAPP_SESSION_SECRETLOG_VERBOSE
Each deploy:* script follows this exact pattern:
# Example: npm run deploy:api
cp -r src vercel/api/ && # Copy all source code
cp package*.json vercel/api/ && # Copy package.json + package-lock.json
cd vercel/api && # Enter service directory
vercel link --project task-vantage-api --yes && # Link to Vercel project
vercel --prod --yes # Deploy to productionFrom root directory to vercel/[service]/:
src/→ Complete source code (all services)package.json→ Dependencies and scriptspackage-lock.json→ Exact dependency versions
Pre-existing in each vercel/[service]/ directory:
api/index.js→ Vercel serverless function entry pointvercel.json→ Vercel configuration (routing, etc.).vercelignore→ Files to exclude from deployment.vercel/project.json→ Project linking information (created by bootstrap)
Each service has a minimal wrapper in vercel/[service]/api/index.js:
// vercel/api/api/index.js
import createApp from '../src/api/app.js';
const app = createApp();
export default app;
// vercel/webapp/api/index.js
import createWebApp from '../src/webapp/app.js';
const app = createWebApp();
export default app;
// vercel/agent/api/index.js
import createAgentApp from '../src/agent/app.js';
const app = createAgentApp();
export default app;
// vercel/mcp/api/index.js
import createApp from '../src/mcp/app.js';
const app = createApp();
export default app;Note: The MCP service now uses the same Hono + mcp-handler pattern for both local development and Vercel deployment.
task-vantage-demo/
├── src/ # 📦 Source code (copied during deployment)
│ ├── api/ # API service source
│ ├── mcp/ # MCP service source
│ ├── agent/ # Agent service source
│ ├── webapp/ # Web app service source
│ └── utils/ # Shared utilities
├── vercel/ # 🚀 Vercel deployment targets
│ ├── api/
│ │ ├── api/index.js # 🔗 Serverless function entry point
│ │ ├── vercel.json # ⚙️ Vercel routing config
│ │ └── .vercelignore # 🚫 Deployment exclusions
│ ├── mcp/ # (same structure)
│ ├── agent/ # (same structure)
│ └── webapp/ # (same structure)
└── package.json # 📋 Deployment scripts
vercel/api/
├── api/index.js # 🔗 Entry point (imports ../src/api/app.js)
├── vercel.json # ⚙️ Routes all requests to /api
├── .vercelignore # 🚫 Excludes .env*, node_modules, etc.
├── src/ # 📦 COPIED: Complete source code
│ ├── api/ # ✅ API service (used by entry point)
│ ├── mcp/ # ➡️ MCP service (unused but copied)
│ ├── agent/ # ➡️ Agent service (unused but copied)
│ ├── webapp/ # ➡️ Web app (unused but copied)
│ └── utils/ # ✅ Shared utilities (used by API)
├── package.json # 📦 COPIED: Dependencies
├── package-lock.json # 🔒 COPIED: Exact versions
└── .vercel/
└── project.json # 🔗 Created by vercel link
Pros:
- ✅ Simple deployment scripts (no selective copying)
- ✅ Shared utilities work across all services
- ✅ Consistent dependency resolution
- ✅ Easy to debug (complete codebase available)
Cons:
- ❌ Larger deployment packages
- ❌ Unused code deployed to each function
Design Decision: This project prioritizes simplicity over optimization. Each service gets the complete codebase but only uses what it needs.
Deployment Failures:
- Check logs:
npm run logs:[service] - Verify all environment variables are set in Vercel dashboard
- Ensure Node.js runtime version matches (18+ required)
- Check build logs in Vercel dashboard
Authentication Issues:
- Verify Auth0 domain and client credentials
- Ensure callback URLs include your Vercel domains
- Check token audience matches between services
Service Communication:
- Update
*_BASE_URLenvironment variables to point to deployed Vercel URLs - Verify CORS settings if needed
- Check network connectivity between services
Environment Variables:
- Use
vercel env addto add variables via CLI - Remember to redeploy after changing environment variables
- Check variable names match exactly (case-sensitive)
Deployment Workflow Commands:
# 1. First-time setup (creates .vercel/project.json)
npm run bootstrap:all
# 2. Deploy everything
npm run deploy:all # Sequential (safer, ~4 minutes)
npm run deploy:parallel # Parallel (faster, ~1 minute)
# 3. Monitor deployments
npm run logs:all # All service logs
vercel ls # List all deployments
vercel --prod # Manual deploy from service directory
# 4. Debug individual services
npm run deploy:api # Deploy just API
npm run logs:api # View API logs
vercel logs api.taskvantage.example.com --follow # Live logs
# 5. Environment management
vercel env add VARIABLE_NAME # Add variable
vercel env rm VARIABLE_NAME # Remove variable
vercel env ls # List variablesProject Management:
# Link existing projects (after git clone)
vercel link --project task-vantage-api
vercel link --project task-vantage-mcp
vercel link --project task-vantage-agent
vercel link --project task-vantage-webapp
# Or use the automated script
npm run bootstrap:all