Prerequisites
Before deploying to Vercel, ensure you have:- A Vercel account
- The Vercel CLI installed (optional, for local testing)
- Your project pushed to a Git repository (GitHub, GitLab, or Bitbucket)
Vercel adapter setup
Velaria uses the official Astro Vercel adapter to enable server-side rendering. The adapter is already configured in the project.Installation
The Vercel adapter is included in your dependencies:package.json
Configuration
The adapter is configured inastro.config.mjs with server output mode:
astro.config.mjs
The
output: 'server' setting enables server-side rendering for all pages. This allows you to use dynamic content, API routes, and server-side logic throughout your application.Deployment steps
Connect your repository
Log in to your Vercel dashboard and click “Add New Project”. Select your Git provider and import the Velaria repository.
Configure project settings
Vercel automatically detects Astro projects. Verify the following settings:
- Framework Preset: Astro
- Build Command:
astro build - Output Directory:
dist - Install Command:
npm install
Deploy
Click “Deploy” and Vercel will build and deploy your project. The first deployment typically takes 1-2 minutes.
Server-side rendering
Withoutput: 'server' configured, your Velaria site benefits from:
- Dynamic content: Render pages on-demand with access to request data
- API routes: Create serverless API endpoints in the
src/pages/api/directory - Form handling: Process form submissions server-side
- Authentication: Implement user authentication with server-side session management
How it works
When a user visits your site:- Vercel receives the request
- The Astro server renders the page dynamically
- The rendered HTML is sent to the user
- Client-side hydration occurs for interactive components
Environment variables
If your application requires environment variables, add them in the Vercel dashboard:Navigate to project settings
Go to your project in Vercel and click “Settings” → “Environment Variables”.
Deploy with Vercel CLI
For developers who prefer command-line deployments:Preview deployments
Vercel automatically creates preview deployments for every push to non-production branches:- Each pull request gets a unique preview URL
- Test changes before merging to production
- Share previews with your team or clients
Preview deployments use the same build configuration as production, ensuring consistency across environments.
Monitoring and analytics
After deployment, monitor your site’s performance:- Vercel Analytics: Track page views, performance metrics, and Web Vitals
- Deployment logs: View build logs and runtime errors in the dashboard
- Real-time logs: Stream function logs for debugging
Troubleshooting
Build failures
If your deployment fails, check:- Build logs in the Vercel dashboard
- Ensure all dependencies are listed in
package.json - Verify that your local build succeeds with
npm run build
Runtime errors
For runtime issues:- Check function logs in the Vercel dashboard
- Verify environment variables are set correctly
- Test locally with
npm run previewafter building
