---
title: "Supercharging Directus on Railway with a Static Frontend"
description: "A custom Python static site generator replaces per-request GraphQL fetching from a Directus CMS, which was slow and loaded the server, for a school newspaper site."
url: "https://swe.quest/articles/supercharging-directus-on-railway-with-a-static-frontend-06dcb86215b2424e"
canonical: "https://blog.railway.com/p/supercharging-directus-on-railway"
source: "Railway"
published: "2024-12-13"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["python","graphql","web-performance","ci-cd","frontend"]
---

# Supercharging Directus on Railway with a Static Frontend

A post on [Railway](https://swe.quest/sources/railway.md), published 2024-12-13, 8 min read, How-to. Original: [https://blog.railway.com/p/supercharging-directus-on-railway](https://blog.railway.com/p/supercharging-directus-on-railway)

## Summary

A custom Python static site generator replaces per-request GraphQL fetching from a Directus CMS, which was slow and loaded the server, for a school newspaper site. A single GraphQL query pulls all published articles and issues. Jinja2 templates render pages into per-path index.html files and collect URLs for a sitemap. Deployment runs through GitHub Actions to GitHub Pages, and a Directus flow fires a repository\_dispatch webhook so content edits trigger rebuilds. HTMX handles 'Read More' expansion by fetching the prebuilt article page and swapping in just the article element.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Python](https://swe.quest/tags/python.md) (Languages)
- [GraphQL](https://swe.quest/tags/graphql.md) (Backend & APIs)
- [Web performance](https://swe.quest/tags/web-performance.md) (Web & mobile)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- Python basics ([easy posts on Python](https://swe.quest/tags/python.md?difficulty=easy))
- Git
- GraphQL basics ([easy posts on GraphQL](https://swe.quest/tags/graphql.md?difficulty=easy))

## Keywords

Directus, Railway, Jinja2, Pixi, GitHub Actions, GitHub Pages, HTMX, gql

## Related posts

- [How We Built Hydrogen: A React Framework for Building Custom Storefronts](https://swe.quest/articles/how-we-built-hydrogen-a-react-framework-for-building-custom-storefronts-0de0baea8226959f.md): Shopify Engineering · 2022-06-22 · Medium · 13 min read · React, Frontend, Web performance, GraphQL, E-commerce
  Hydrogen, Shopify's React framework for custom storefronts, was built on React Server Components, React 18 streaming SSR and Vite, chosen over static JAMStack approaches because commerce pages are inherently dynamic.
- [More Editorial Content, please.](https://swe.quest/articles/more-editorial-content-please-3a9ab301c97b6ae2.md): Zalando Engineering · 2022-09-28 · Medium · 10 min read · Product engineering, GraphQL, System design, Frontend
  Zalando replaced a legacy, engineering-heavy landing page tool with a system built on the headless CMS Contentful, integrated into its Interface Framework via a Contentful proxy service behind the Fashion Store GraphQL aggregator, with modules mapped to renderers shared across web and app.
- [Remixing Shopify's Admin: How We Made It 30% Faster and AI-Ready](https://swe.quest/articles/remixing-shopify-s-admin-how-we-made-it-30-faster-and-ai-ready-996b243df73e0345.md): Shopify Engineering · 2025-06-30 · Medium · 7 min read · Web performance, React, Frontend, Refactoring & migrations, AI agents
  Shopify migrated its Admin (67 million daily page views, 101 teams, ~350 PRs merged daily, 3M+ lines of TypeScript) to Remix in SPA mode with Vite.
- [How we built it: incident.io Status Pages](https://swe.quest/articles/how-we-built-it-incident-io-status-pages-37acc4f93c86c23d.md): incident.io · 2023-04-19 · Medium · 8 min read · Caching, React, Frontend, Serverless, CDN & edge
  incident.io built its Status Pages product in three months on Vercel and Next.js, using Incremental Static Regeneration with per-fetch revalidate times (e.g. 30s) so the backend serves only a couple of requests per minute regardless of traffic spikes.
- [A database for every preview environment using Neon, GitHub Actions, and Vercel](https://swe.quest/articles/a-database-for-every-preview-environment-using-neon-github-actions-and-vercel-dd5fe24cba2d12b5.md): Neon · 2023-04-14 · Medium · 14 min read · PostgreSQL, CI/CD, Deployment, Schema migrations
  Neon's copy-on-write branching can give every pull request its own production-like Postgres database, avoiding the bottlenecks of shared staging or shared preview databases.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
