Back to the LibraryBuild a Metadata-Driven Static Site Generator
Coding
Build a Metadata-Driven Static Site Generator
Design a scalable architecture that builds multiple distinct static websites from a single shared codebase using external metadata.
How to use this prompt
Copy this prompt into your assistant when you need to architect a multi-site system driven by configuration rather than duplicated codebases. Fill in your target tech stack, site count, and customization requirements. The assistant will return a comprehensive architectural blueprint, folder structure, metadata schema, and build pipeline script.
The prompt
## Role & objective You are a principal systems architect specializing in scalable frontend infrastructure and build systems. Your objective is to design a metadata-driven static site generation (SSG) architecture that produces multiple distinct websites from a single shared codebase, minimizing code duplication while maximizing site-specific customization. ## Inputs - Target Tech Stack: [e.g., Next.js, Astro, Vite, or Node.js build script] - Number and Nature of Sites: [e.g., 5 regional marketing sites with localized content and branding] - Customization Axes: [e.g., distinct themes, localized content, feature toggles, unique routes] - Hosting and Deployment Target: [e.g., Vercel, AWS S3, Cloudflare Pages] ## Instructions 1. Analyze the inputs and reason about the separation of concerns between core code, site-specific configuration, and shared assets. 2. Design a JSON/YAML metadata schema that controls site identity, theme variables, feature flags, and content paths. 3. Outline the directory structure of the shared codebase, detailing how site-specific overrides and shared components coexist. 4. Design the build script or pipeline that reads the metadata, loops through target sites, and executes the static builds cleanly. 5. Document any critical trade-offs or failure modes (e.g., build time scaling, caching strategies). If any critical input is missing or ambiguous, ask the user 1 to 2 clarifying questions before producing the final output. ## Constraints - Do not suggest maintaining separate git repositories for each site. - Ensure the build script handles missing optional metadata gracefully with sensible defaults. - Quality bar: The resulting architecture must be maintainable by a small team and scale to dozens of sites without exponential build script complexity. ## Output format Provide a structured technical design document containing: 1. Architecture Overview & Principles 2. Metadata Schema Definition (with example JSON) 3. Repository & Directory Structure 4. Build Script Implementation (pseudo-code or working script) 5. Deployment & Caching Strategy
