Astro Netlify Edge Starter is a boilerplate template for building a server-side rendered Astro application that runs on Netlify Edge Functions and renders content based on the visitor's geographical location.
What is the Astro Netlify Edge Starter?
This starter repository combines Astro's server-side rendering (SSR) mode with the @astrojs/netlify integration to deploy on Netlify Edge Functions. It takes an incoming HTTP request, reads the geolocation data that Netlify's edge runtime attaches to the request, and renders the page server-side so the browser displays location-specific content. The repo is maintained by sarahetter, and a live demo runs at https://astro-edge-functions-demo.netlify.app/.
Key Features
- Server-Side Rendering — Uses Astro in SSR mode with the
@astrojs/netlifyadapter, so pages are rendered at the edge on Netlify rather than pre-built statically. - Edge Function Geolocation — Detects the requesting user's location and renders it in the browser, with an in-browser alert showing the result, as demonstrated in the included animation.
- One-Click Deploy — The repository includes a Deploy to Netlify button that initializes the project directly at https://app.netlify.com/start/deploy?repository=https://github.com/sarahetter/astro-netlify-edge-starter.
- Local Development Workflow — Run
npm installandnpm run devto start a local Astro dev server after cloning the repo. - Netlify CLI Deployment — Supports deployment with
netlify deploy --buildonce you install the Netlify CLI globally. - Live Demo Site — A working example is available at astro-edge-functions-demo.netlify.app, letting you inspect the behavior before cloning.
Local geolocation does not work during development; the location detection only activates after the app is deployed to Netlify's edge network.
Who is it for?
- Astro developers who want a minimal working example of SSR with Netlify Edge Functions without configuring the integration from scratch.
- Netlify users who need to serve geo-personalized content and want a reference implementation for edge-based request handling.
- Learning engineers who want to understand how Astro integrates with Netlify's edge runtime and how to structure a project for it.
What can you do with it?
- Geo-personalized sites: Detect a visitor's country or region at the edge and customize text, language, currency, or regional offers accordingly.
- A/B testing by location: Use the edge function to route different server-rendered variants to users in different regions.
- Starter for edge computing: Add other edge functions on top, such as authentication checks, bot detection, or header manipulation.
How does it work?
The starter uses the @astrojs/netlify integration to enable SSR. When a request hits Netlify, an edge function reads the geolocation data from the request context and passes it to the Astro page, which returns a fully rendered HTML response. After cloning, run npm install and npm run dev to test the app locally, then deploy with the Netlify CLI using netlify deploy --build; the geolocation feature only works once deployed.
FAQ
Does geolocation work during local development?
No. The README explicitly states that geolocation will not work locally because the edge runtime is only present on Netlify's infrastructure. You must deploy the application to Netlify for location detection to function.
How do I deploy this to Netlify?
Install the Netlify CLI globally with npm install netlify-cli -g, then run netlify deploy --build from the repository root. The CLI will prompt you to configure the site and output a live URL when successful.
Where is the live demo?
The repository links to the demo at https://astro-edge-functions-demo.netlify.app/ which runs the exact code in this starter and shows the geolocation alert in action.
What command starts the dev server?
After cloning and running npm install, use npm run dev. The command starts Astro's local development server and prints a local URL you can open in your browser.
What should I do if I find a bug?
You can open an issue in the GitHub repository at https://github.com/sarahetter/astro-netlify-edge-starter/issues or ask in the Netlify Forums at https://answers.netlify.com/.





