Prerequisites
Before you begin, ensure you have the following installed:- Node.js 18.0 or higher
- A package manager: npm, yarn, pnpm, or bun
- Git
Installation
Clone the repository
Clone the Astro Vercel Boilerplate to your local machine:Alternatively, you can use the “Deploy with Vercel” button to automatically fork and deploy the repository.
Install dependencies
Install the project dependencies using your preferred package manager:
This project is configured to use Bun (v1.3.6) as the default package manager, but it works seamlessly with npm, yarn, or pnpm as well.
Start the development server
Run the development server to see your site in action:Your site will be available at
http://localhost:4321The development server includes hot module reloading, so changes you make to your code will be reflected immediately in the browser.
Explore the demo pages
Open your browser and explore the different demo pages to see various features in action:
- Homepage (
/) - Server-rendered with edge functions showing your IP and location - SSR Page (
/ssr) - Server-side rendering displaying current server time - ISR Page (
/isr) - Incremental static regeneration with revalidation - Image Page (
/image) - Vercel Image Optimization demo - Edge API (
/edge.json) - JSON endpoint running on the edge
Project Structure
Here’s an overview of the key files and directories:Understanding the Configuration
The boilerplate comes pre-configured with optimal settings inastro.config.mjs:
astro.config.mjs
The
output: 'server' setting enables server-side rendering by default. Individual pages can opt into static pre-rendering by setting export const prerender = true.Key Dependencies
The boilerplate includes these essential packages:astro- The Astro framework@astrojs/vercel- Official Vercel adapter for Astro@vercel/analytics- Web analytics for your site@vercel/speed-insights- Real-time performance monitoringastro-seo- SEO utilities for meta tags
Available Scripts
Here are the main scripts available inpackage.json:
Next Steps
Explore Features
Dive deeper into SSR, ISR, and edge functions
Deploy to Vercel
Learn how to deploy your site to production