systemprompt-generator
Static site generation and content publishing orchestrator for systemprompt.io. Coordinates domain services to generate prerendered HTML pages, sitemaps, RSS feeds, and optimized assets.
Overview
This application-layer crate orchestrates the full content publishing pipeline:
- Content Ingestion - Fetches and processes content from sources
- Prerendering - Generates static HTML for all content pages
- Asset Organization - Copies and organizes CSS, JS, fonts, and images
- Feed Generation - Creates sitemaps and RSS feeds for SEO
File Structure
src/
├── lib.rs # Public API exports
├── api.rs # HTTP API content fetching
├── assets.rs # Asset copying and organization
│
├── build/ # Web build orchestration
│ ├── mod.rs # Module exports
│ ├── orchestrator.rs # BuildOrchestrator, BuildMode, BuildError
│ ├── steps.rs # Theme, TypeScript, Vite, CSS build steps
│ └── validation.rs # Sitemap URL validation
│
├── content/ # Content processing
│ ├── mod.rs # Module exports
│ ├── cards.rs # Card HTML generation, image URL normalization
│ └── markdown.rs # Markdown rendering, frontmatter extraction
│
├── jobs/ # Scheduled job definitions
│ ├── mod.rs # Module exports
│ ├── copy_assets.rs # CopyExtensionAssetsJob
│ ├── content_prerender.rs # ContentPrerenderJob
│ └── page_prerender.rs # PagePrerenderJob
│
├── prerender/ # Static page generation
│ ├── mod.rs # Module exports
│ ├── engine.rs # prerender_content, prerender_pages entry points
│ ├── context.rs # PrerenderContext, HomepageBranding
│ ├── content.rs # Source processing, item rendering
│ ├── fetch.rs # Database content fetching with retries
│ ├── index.rs # GenerateParentIndexParams, parent index generation
│ └── parent.rs # RenderParentParams, parent route rendering
│
├── rss/ # RSS feed generation
│ ├── mod.rs # Module exports
│ ├── generator.rs # generate_feed entry point
│ └── xml.rs # RssChannel, RssItem, XML building
│
├── sitemap/ # Sitemap generation
│ ├── mod.rs # Module exports
│ ├── generator.rs # generate_sitemap entry point
│ └── xml.rs # SitemapUrl, XML building
│
└── templates/ # Template data preparation
├── mod.rs # Module exports
├── engine.rs # load_web_config, get_templates_path
├── html.rs # Related content, CTA links, references HTML
├── items.rs # find_latest_items, find_popular_items
├── navigation.rs # Footer, social action bar HTML generation
├── paper.rs # Paper content type: TOC, sections, read time
└── data/ # Template data preparation (split for maintainability)
├── mod.rs # prepare_template_data entry point
├── types.rs # TemplateDataParams, DateData, ImageData, etc.
├── extractors.rs # Config and field extraction functions
└── builders.rs # JSON template building
Module Descriptions
| Module | Purpose |
|---|---|
build |
Orchestrates web frontend build: theme generation, TypeScript, Vite, CSS |
content |
Markdown rendering and content card HTML generation |
jobs |
Scheduled jobs implementing the Job trait for the scheduler |
prerender |
Static HTML generation for content pages and homepage |
rss |
RSS 2.0 feed generation with Atom namespace support |
sitemap |
XML sitemap generation with chunking for large sites |
templates |
Template data preparation and HTML fragment generation |
Key Types
| Type | Description |
|---|---|
BuildOrchestrator |
Coordinates theme, TypeScript, Vite, and CSS build steps |
BuildMode |
Development, Production, or Docker build configuration |
PrerenderContext |
Shared context for prerendering: db pool, config, templates |
PublishContentJob |
Main job that runs the full publishing pipeline |
SitemapUrl |
URL entry for sitemap XML generation |
RssChannel / RssItem |
RSS feed data structures |
TemplateDataParams |
Parameters for preparing template data |
Public Exports
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
Dependencies
| Crate | Purpose |
|---|---|
systemprompt-database |
Database connection pool |
systemprompt-content |
Content repository and models |
systemprompt-templates |
Template registry and rendering |
systemprompt-models |
Configuration and domain types |
systemprompt-identifiers |
Typed identifiers (SourceId, ContentId) |
systemprompt-traits |
Job trait interface |
systemprompt-extension |
Extension discovery and assets |
systemprompt-files |
File storage configuration |
handlebars |
Template engine |
comrak |
Markdown to HTML |
Architecture Notes
This crate follows the application layer pattern:
- Orchestration only - No business logic; delegates to domain services
- Read-only domain access - Uses
ContentRepositoryfor data fetching - Job interface - Jobs implement
systemprompt_traits::Jobfor scheduling - Template delegation - Uses
TemplateRegistryfrom domain layer - Config via models - Uses
Config::get()instead of directenv::var()
Installation
Add to your Cargo.toml:
[]
= "0.0.1"
License
FSL-1.1-ALv2 - See LICENSE for details.