Integrate Astro with Storyblok as a headless CMS.
This blueprint is ideal for kickstarting new Storyblok and Astro projects. What's inside:
- Pre-configured default blocks:
page,teaser,grid, andfeature. - Support for the Visual Editor's live preview.
- Dynamic routing to fetch and render new stories automatically.
- Minimal styling.
Tip
Follow our Astro guide for a step-by-step walkthrough and learn more about Storyblok's range of features, including rich text rendering, custom content modeling, and internationalization. See the @storyblok/astro package reference for further information.
No Storyblok account yet? Sign up now to experience a 14-day free trial of all features and enjoy our completely free Starter plan.
- Create a new empty Storyblok space
- Create a new repository based on this template
- Open the project on your device
- Install dependencies
npm installIn the root of the project, create a .env file to store the access token of your space:
STORYBLOK_DELIVERY_API_TOKEN=<REPLACE_WITH_YOUR_TOKEN>
STORYBLOK_REGION=<REPLACE_WITH_SPACE_REGION>Tip
Copy your space's preview access token from Settings > Access Tokens. STORYBLOK_REGION defaults to eu if omitted; valid values are eu, us, ca, ap.
Learn more about Storyblok access tokens.
The Visual Editor lets content editors preview changes in real time while editing content in the Storyblok dashboard. To render a preview of the local project in the Visual Editor, follow these steps:
- In your space, navigate to Settings > Visual Editor.
- Set the default environment to
https://localhost:4321/. - Save.
- Open the
homestory. - Click Config.
- Type
/in the Real path.
Run the development server:
npm run devImportant
To connect the Storyblok Visual Editor, the local project must run over HTTPS. Learn more in the Visual Editor concept. Check the Visual Preview section of the Astro guide for detailed instructions.
Back in Storyblok, open the Home story to start editing.
Happy building!
The site is statically built from Storyblok content and served via AWS CloudFront.
flowchart LR
Editor["Storyblok Visual Editor"] --> API["Storyblok CDN API"]
API --> Build["Astro Build (GitHub Actions)"]
Build --> S3["S3 Bucket"]
S3 --> CF["CloudFront CDN"]
CF --> User["End User"]
- Node.js 20+
- npm
- A Storyblok account
- OpenTofu / Terraform (only for infrastructure changes)
- AWS CLI configured (only for infrastructure changes)
src/
layouts/Layout.astro # Base HTML layout
pages/[...slug].astro # Dynamic catch-all route
storyblok/ # Astro components mapped to Storyblok blocks
Page.astro
Grid.astro
Feature.astro
Teaser.astro
infra/ # AWS infrastructure (OpenTofu)
.github/workflows/ # CI/CD pipelines
astro.config.mjs # Astro + Storyblok SDK configuration
- Create the content block in Storyblok's Block Library.
- Create a matching
.astrofile insrc/storyblok/. - Register it in the
componentsmap inastro.config.mjs. - Use
storyblokEditable(blok)on the root element.
- Pushing to
maintriggers the deploy workflow: build, S3 sync, CloudFront cache invalidation. - Content updates in Storyblok require a new build to go live (no automatic webhook rebuilds).
- Required GitHub Actions secrets:
AWS_DEPLOY_ROLE_ARN,AWS_REGION,STORYBLOK_DELIVERY_API_TOKEN. - See infra/README.md for initial AWS infrastructure setup and bootstrap instructions.
npm run dev— start development server (HTTPS via mkcert)npm run build— build static site todist/npm run preview— preview the built site locally
- To learn more about what you can do with Storyblok, visit our documentation and learning hub.
- To learn more about the integration between Storyblok and Astro, check our dedicated developer tutorials.
- To learn more about Astro, check the official documentation.
- Infrastructure documentation
- Have questions, need help, want to chat with other users? Join our Discord community.
- Visit the Storyblok Help Center.