VercelDeployer ✅
The VercelDeployer deploys Kastrax applications to Vercel, handling configuration, environment variable synchronization, and deployment processes. It extends the abstract Deployer class to provide Vercel-specific deployment functionality.
Usage Example ✅
import { Kastrax } from '@kastrax/core';
import { VercelDeployer } from '@kastrax/deployer-vercel';
const kastrax = new Kastrax({
deployer: new VercelDeployer({
teamSlug: 'your-team-slug',
projectName: 'your-project-name',
token: 'your-vercel-token'
}),
// ... other Kastrax configuration options
});Parameters ✅
Constructor Parameters
teamSlug:
projectName:
token:
Environment Variables
The VercelDeployer handles environment variables from multiple sources:
- Environment Files: Variables from
.env.productionand.envfiles. - Configuration: Variables passed through the Kastrax configuration.
- Vercel Dashboard: Variables can also be managed through Vercel’s web interface.
The deployer automatically synchronizes environment variables between your local development environment and Vercel’s environment variable system, ensuring consistency across all deployment environments (production, preview, and development).
Build Kastrax Project ✅
To build your Kastrax project for Vercel deployment:
npx kastrax buildThe build process generates the following output structure in the .kastrax/output directory:
.kastrax/output/
├── vercel.json # Vercel configuration
└── index.mjs # Application entry pointVercel Configuration
The VercelDeployer automatically generates a vercel.json configuration file in .kastrax/output with the following settings:
{
"version": 2,
"installCommand": "npm install --omit=dev",
"builds": [
{
"src": "index.mjs",
"use": "@vercel/node",
"config": {
"includeFiles": ["**"]
}
}
],
"routes": [
{
"src": "/(.*)",
"dest": "index.mjs"
}
]
}Deployment Options ✅
After building, you can deploy your Kastrax application .kastrax/output to Vercel using any of these methods:
-
Vercel CLI: Deploy directly using Vercel’s official CLI tool
- Install the CLI:
npm install -g vercel - Navigate to the output directory:
cd .kastrax/output - Deploy to preview environment:
vercel - For production deployment:
vercel --prod
- Install the CLI:
-
Vercel Dashboard: Connect your Git repository or drag-and-drop the build output through the Vercel dashboard
You can also run
vercel devin your output directory.kastrax/outputto test your Kastrax application locally.