A Next.js TypeScript application that serves as a Vercel integration server for deploying AI Assistant applications. This server handles OAuth token exchange, stores Vercel account tokens securely, and deploys the assistant-server and assistant-chat applications to users' Vercel accounts with the correct environment parameters.
This integration server enables users to:
- Install the AI Assistant Server integration from the Vercel Marketplace
- Install the Assistant Chat integration from the Vercel Marketplace
- Authenticate via OAuth with their Vercel account
- Configure the required credentials for each app
- Automatically deploy Assistant Server or Assistant Chat to their Vercel project
- Complete each integration setup seamlessly
User Vercel Marketplace Integration Server
β β β
β 1. Install β β
βββββββββββββββββββββΊβ β
β β β
β 2. OAuth Redirect β β
ββββββββββββββββββββββ€ β
β β β
β 3. Authorize β β
βββββββββββββββββββββΊβ β
β β β
β 4. Redirect with Code β
ββββββββββββββββββββββββββββββββββββββββββ€
β β β
β 5. Assistant Server installs β `/configure`
β Assistant Chat installs β `/configure/assistant-chat`
βββββββββββββββββββββββββββββββββββββββββΊβ
β β β
β 6. Deploy Assistant Server or Chat β
βββββββββββββββββββββββββββββββββββββββββΊβ
β β β
β 7. Success & Complete β
ββββββββββββββββββββββββββββββββββββββββββ€
- Node.js 20+
- Supabase account
- Vercel account
- GitHub repository with your assistant-server code
git clone https://github.com/vezlo/vercel-integration-server.git
cd vercel-integration-server
npm install- Go to Supabase Dashboard
- Create a new project
- Go to SQL Editor
- Copy and paste the content from
supabase/schema.sql - Click Run
- Go to Settings β API and copy:
- Project URL
- Service Role Key (secret)
- Go to Vercel Integrations Console
- Click Create Integration
- Fill in the details for Assistant Server (Marketplace listing: Assistant Server):
- Name: "AI Assistant Server"
- Redirect URL:
http://localhost:3000/api/oauth/callback - Configuration URL:
http://localhost:3000/configure
- Enable the following permissions:
- β Installation (Read)
- β Projects (Read)
- β Deployments (Read/Write)
- β Integration-owned Project Environment Variables (Read/Write)
- Save and copy the Client ID & Client Secret
- Repeat for Assistant Chat (Marketplace listing: Assistant Chat) using:
- Redirect URL:
http://localhost:3000/api/oauth/chat-callback - Configuration URL:
http://localhost:3000/configure/assistant-chat
- Redirect URL:
Create .env.local file:
# App URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Encryption Key
ENCRYPTION_KEY=[32_character_random_string]
# Supabase Configuration (Assistant Server)
SUPABASE_URL=[your_supabase_url]
SUPABASE_SERVICE_ROLE_KEY=[your_supabase_service_role_key]
# Assistant Server OAuth
ASSISTANT_SERVER_CLIENT_ID=oac_server
ASSISTANT_SERVER_CLIENT_SECRET=[server_secret]
ASSISTANT_SERVER_REDIRECT_URI=http://localhost:3000/api/oauth/callback
# Assistant Chat OAuth
ASSISTANT_CHAT_CLIENT_ID=oac_chat
ASSISTANT_CHAT_CLIENT_SECRET=[chat_secret]
ASSISTANT_CHAT_REDIRECT_URI=http://localhost:3000/api/oauth/chat-callback
# Assistant Server Repository
ASSISTANT_SERVER_REPO=https://github.com/vezlo/assistant-server
ASSISTANT_SERVER_REPO_ID=1066522680
# Assistant Chat Repository
ASSISTANT_CHAT_REPO=https://github.com/vezlo/assistant-chat
ASSISTANT_CHAT_REPO_ID=1070840472npm run devSince OAuth requires HTTPS, use ngrok for local testing:
# Install ngrok if you haven't already
npm install -g ngrok
# Start ngrok tunnel
ngrok http 3000
# Update .env.local with ngrok URL:
NEXT_PUBLIC_APP_URL=https://[your-ngrok-id].ngrok.io
VERCEL_REDIRECT_URI=https://[your-ngrok-id].ngrok.io/api/oauth/callback
# Update your Vercel integration redirect URL to the ngrok URL- User clicks "Install" on the Assistant Server or Assistant Chat listings:
- Vercel redirects to OAuth authorization
- User authorizes the integration
- Vercel redirects back with authorization code
- Integration server exchanges code for access token
- Encrypts and stores the token in Supabase
- Creates installation record linked to the account
- Assistant Server installs redirect to
/configure- Collect Supabase, Database, and OpenAI credentials
- Assistant Chat installs redirect to
/configure/assistant-chat- Collect Assistant Server URL (and optional API key)
- Credentials are validated and prepared for deployment
- Server retrieves integration configuration from Vercel
- Determines target project (first selected project)
- Sets environment variables sequentially (to avoid Vercel API conflicts)
- Deploys the appropriate app:
- Assistant Server β
ASSISTANT_SERVER_REPO - Assistant Chat β
ASSISTANT_CHAT_REPO
- Assistant Server β
- Updates installation status
- Assistant Server success page shows deployment status + database setup URLs + completion button
- Assistant Chat success page shows deployment status + completion button (no database steps)
- User clicks βComplete Integrationβ to return to Vercel
vercel-integration-server/
βββ app/
β βββ api/
β β βββ oauth/callback/ # Assistant Server OAuth callback
β β βββ oauth/chat-callback/# Assistant Chat OAuth callback
β β βββ deploy/ # Deployment API
β β βββ health/ # Health check endpoint
β β βββ docs/ # Swagger documentation
β βββ configure/ # Assistant Server configuration pages
β β βββ assistant-chat/ # Assistant Chat configuration page
β βββ api-docs/ # API documentation UI
βββ lib/
β βββ encryption.ts # AES-256 encryption utilities
β βββ storage.ts # Supabase database operations
β βββ vercel-api.ts # Vercel API client
β βββ swagger.ts # Swagger documentation
βββ types/
β βββ index.ts # TypeScript interfaces
βββ supabase/
βββ schema.sql # Database schema
- GET
/api/oauth/callbackβ Assistant Server OAuth - GET
/api/oauth/chat-callbackβ Assistant Chat OAuth - Both endpoints share the same logic but use app-specific credentials
- POST
/api/deploy - Triggers the appropriate deployment (Assistant Server or Assistant Chat) based on stored
app_name
- GET
/api/health - Returns server status
- GET
/api/docs - Swagger JSON documentation
- GET
/api-docs - Interactive Swagger UI
Stores encrypted Vercel access tokens and user information:
id: Primary keyuuid: Unique identifier for external API exposurevercel_user_id: Vercel user IDvercel_team_id: Vercel team ID (if applicable)access_token: Encrypted Vercel access tokencreated_at,updated_at: Timestamps
Tracks deployment instances:
id: Primary keyuuid: Unique identifier for external API exposureinstallation_id: Vercel's integration configuration IDaccount_id: Foreign key to accounts tableapp_name: Application name (default: 'assistant-server')vercel_project_id: Deployed project IDvercel_project_name: Deployed project namedeployment_url: Live deployment URLstatus: Installation status ('pending', 'installed', 'failed')created_at,updated_at: Timestamps
- AES-256 Encryption: All Vercel tokens are encrypted before storage
- No Credential Storage: User credentials (Supabase, OpenAI) are never stored
- Environment Variables: Sensitive data passed as environment variables to deployments
- Row Level Security: Supabase RLS enabled for additional security
- HTTPS Only: OAuth flow requires HTTPS (use ngrok for local testing)
Add ?success=true to the configure page URL to test the success page UI:
http://localhost:3000/configure?configurationId=test&success=true
- Deploy the integration server to Vercel
- Update Vercel integration URLs to production URLs
- Test the complete OAuth and deployment flow
- Push your code to GitHub
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy
Set these in your Vercel project settings:
ASSISTANT_SERVER_CLIENT_IDASSISTANT_SERVER_CLIENT_SECRETASSISTANT_SERVER_REDIRECT_URIASSISTANT_CHAT_CLIENT_IDASSISTANT_CHAT_CLIENT_SECRETASSISTANT_CHAT_REDIRECT_URINEXT_PUBLIC_APP_URLENCRYPTION_KEYSUPABASE_URLSUPABASE_SERVICE_ROLE_KEYASSISTANT_SERVER_REPOASSISTANT_SERVER_REPO_IDASSISTANT_CHAT_REPOASSISTANT_CHAT_REPO_ID
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Write clear commit messages
- Test your changes thoroughly
- Update documentation as needed
- Ensure all tests pass
- Use ESLint configuration provided
- Follow Next.js conventions
- Use meaningful variable names
- Add comments for complex logic
This project is dual-licensed:
- Non-Commercial Use: Free under AGPL-3.0 license
- Commercial Use: Requires a commercial license - contact us for details
- Documentation: Check this README and inline code comments
- Issues: Report bugs and request features via GitHub Issues
- Discussions: Join our GitHub Discussions for questions and ideas
- Vercel Integration (Assistant Server): https://vercel.com/marketplace/vezlo-assistant-server
- Vercel Integration (Assistant Chat): https://vercel.com/marketplace/vezlo-assistant-chat
- Vezlo Website: https://vezlo.org
- GitHub Repository: https://github.com/vezlo/vercel-integration-server
Made with β€οΈ by Vezlo