Back to Blog
September 24, 2026 • 5 min read

Building a Blazing-Fast School Website: Drupal + AstroJS Hybrid

Combined Drupal’s CMS power with Astro’s static speed

School websites often struggle with slow load times, complex content management, and rigid designs. Traditional full-stack Drupal sites can feel sluggish, especially for static content like school pages, where performance is critical for engagement.

I wanted to prove that Drupal + AstroJS could deliver:
✅ Lightning-fast page loads (static generation)
✅ Flexible content editing (Drupal’s paragraphs)
✅ Easy section rearrangement (component-based)
✅ Optimized media (AVIF/WebP image styles)
✅ Smart caching (Drupal API invalidation)
✅ Custom API mapping (paragraphs to Astro components)

The Solution: Decoupled Drupal + AstroJS

Architecture Overview

Backend: Drupal 10 (headless mode) for content management.

Frontend: AstroJS for static site generation (SSG) with dynamic islands for interactivity.

Data Flow: Drupal’s JSON:API feeds content to Astro, which builds static pages at build time.

 

Key Features

1. Paragraphs + Astro Components: A Match Made in Heaven
  • Drupal: Used Paragraphs to create modular content sections (e.g., Hero, Courses, Testimonials).
  • Astro: Each paragraph type maps to a dedicated Astro component 
  • (e.g., Hero.astro, OverviewSection.astro,  CarouselSection.astro).
  • Custom Module: Built a custom Drupal module to automatically map all paragraph types to their corresponding Astro components. This ensures that any new paragraph added in Drupal is instantly recognized and rendered in Astro.
  • Result: Editors drag-and-drop sections in Drupal, and Astro renders them as optimized static HTML.
2. Image Optimization: AVIF/WebP for All
  • Configured Drupal image styles to auto-convert uploads to AVIF/WebP (with fallback to JPEG/PNG).
  • Astro’s <Image /> component lazy-loads these optimized assets with srcset for responsive delivery.
  • Impact: ~50% reduction in image payload vs. traditional JPEG.

 

Custom API Endpoints for Seamless Integration
3. Caching That Actually Works
  • Drupal: Enabled internal caching for API responses.
  • Invalidation: Only cached API responses are purged when content updates (no full rebuilds!).
  • Astro: Static pages are regenerated only when Drupal content changes (via webhooks).
4. Custom API Endpoints for Seamless Integration
  • Path Alias API: Created a custom API endpoint that fetches content using Drupal path aliases This ensures clean, human-readable URLs for Astro to consume.
  • Listing API with Pagination: Built a listing API to fetch all nodes of a specific content type (e.g., /api/node/path?get=/about&page=1&limit=10). This supports pagination, making it easy for Astro to render lists of content (e.g., courses, blog posts) across multiple pages.
  • Performance: Both APIs are optimized to return only the necessary data, reducing payload size and improving load times.

Why This Matters for Schools

  1. Editors Love It: Non-technical staff can rearrange sections without breaking the layout (thanks to paragraphs + components).
  2. Students Love It: Pages load instantly, even on slow devices or rural internet.
  3. Developers Love It: Clean separation of concerns—Drupal handles content, Astro handles presentation, and the custom module bridges the gap.

Lessons Learned

  • Decoupling Isn’t Free: Initial setup requires careful planning for content modeling (e.g., paragraph fields must align with Astro props).
  • Image Styles Are Underrated: AVIF/WebP support in Drupal 10 is a game-changer for performance.
  • Cache Invalidation > Full Rebuilds: Webhooks from Drupal to trigger Astro rebuilds only for changed content.
  • Custom Modules Are Powerful: Building a custom module to map paragraphs and expose clean APIs made the integration smoother and more maintainable.

Try It Yourself


Enjoyed the post?

Feel free to share it or reach out to discuss more!