How rustlanges/blog works
Project type and purpose
• This is a static‐site blog generator built in Rust (using Leptos for component‐based SSR/SSG) plus a Tailwind CSS pipeline via Node.js.
• It consumes Markdown files under articles/ and esta_semana_en_rust/, generates HTML pages with a Rust SSG (src/ssg.rs, src/render.rs), runs CSS builds (tailwind.config.js + input.css), and outputs a static site in out/.
• A secondary Rust crate (preview_generator/) produces share‐image previews; a Python or Rust HTTP server serves the site locally. CI/CD is configured via GitHub Actions.
File structure
• Top‐level scripts and configs
• .github/workflows/ – CI pipelines for build, tests, deploy
• server / server.bat – helper scripts that orchestrate cargo watch, CSS rebuilds, and static‐file serving
• gen_translated.py – custom script (e.g., for generating translations)
• package.json + tailwind.config.js – Node.js dependencies for Tailwind CSS
• Cargo.toml, rust-toolchain.toml – Rust toolchain and dependencies for the main app
• Source code for the main SSG
• src/ – Leptos components (components/), pages (pages/), models, utilities, ssg.rs and render.rs entrypoints
• Secondary crate
• preview_generator/ – its own Cargo.toml and Rust code to produce social‐media preview images
• Content
• articles/, esta_semana_en_rust/ – Markdown content
• assets/images/ – static assets for the site
• Build‐and‐deploy helpers
• .github/workflows/*.yml for CI and deployment
• leptosfmt.toml, clippy.toml, husky/githooks for linting
README insights
• Describes local dev requirements: Rust, Node.js, cargo-watch, leptosfmt
• Instructions to run parallel watchers: Rust rebuild + Tailwind CSS compiler + optional HTTP server
• Mentions Git hooks to enforce linting and formatting
a. Main components
1. Developer Workstation (IDE, Git CLI)
2. Content source: Markdown files (articles/, esta_semana_en_rust/) + assets
3. Rust SSG (Leptos app in src/ + ssg.rs)
4. Tailwind CSS pipeline (Node.js + input.css → output.css)
5. Preview Generator (preview_generator/ crate)
6. Build orchestrator (cargo-watch, server script)
7. Output directory (out/)
8. Local static server (Python http.server or basic-http-server)
9. CI/CD (GitHub Actions) → Deployment (e.g., GitHub Pages, Netlify)
b. Relationships and interactions
• Developer edits Markdown → Git → triggers local build or CI
• cargo-watch detects code/content changes → runs Rust SSG → generates HTML
• Simultaneously, Node.js Tailwind process compiles CSS → writes out/output.css
• preview_generator can be invoked during build to generate social preview images under out/
• Final static site (out/) served locally or deployed by CI to hosting
c. Architectural patterns and design principles
• Component‐based rendering (Leptos) with SSG for performance and SEO
• File‐watcher orchestration for rapid developer feedback
• Separation of concerns: content (Markdown), presentation (Leptos components + CSS), build logic (Rust + Node)
• Extensible plugin‐like preview generator as a separate crate
d. Key technologies
• Rust + Leptos for SSG and page components
• Node.js + Tailwind CSS for styling
• cargo-watch for live rebuilds
• Python or Rust HTTP server for local preview
• GitHub Actions for CI and deploy
• Markdown content with front‐matter