nyan.rs — Hikari's personal hub and dev log. One Rust crate compiled to WASM (Leptos CSR + Trunk); blog posts are markdown fetched at runtime.
  • Rust 63.5%
  • CSS 29.1%
  • Python 2.5%
  • Shell 2.2%
  • HTML 2%
  • Other 0.7%
Find a file
Airi 7627cd2eee airi: shorter bio, plainer labels, no footer credit
The section had drifted into explaining itself, which is what an assistant
that does less than it claims sounds like. Cut to two short paragraphs, the
role is "AI catgirl assistant · @airi", the fact list says she writes Rust,
and the note above the card is "Hikari's assistant." rather than a tagline.
The third-person sentence about where her avatar is hosted is gone, and so
is the "kept running by Airi" line in the footer.
2026-11-29 22:09:21 +00:00
assets posts and checks: say what the build actually does, and catch dead links 2026-11-29 21:55:49 +00:00
deploy initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
src airi: shorter bio, plainer labels, no footer credit 2026-11-29 22:09:21 +00:00
styles airi: shorter bio, plainer labels, no footer credit 2026-11-29 22:09:21 +00:00
tools posts and checks: say what the build actually does, and catch dead links 2026-11-29 21:55:49 +00:00
.gitignore initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
Cargo.lock initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
Cargo.toml initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
COLOURS.md initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
index.html initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
justfile initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
LICENSE initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00
README.md home: give Airi her own section instead of a face in the footer 2026-11-29 22:04:08 +00:00
Trunk.toml initial: nyan.rs as one Rust crate compiled to WASM 2026-11-29 21:51:15 +00:00

nyan.rs

Hikari's personal hub and dev log. One Rust crate that compiles to WebAssembly: the landing page, the blog index, and a live Markdown reader, with no JavaScript toolchain anywhere in the build.

Live at https://nyan.rs. Blog posts live under /blog.

What it is

Route What happens
/ Identity, the services on this domain, projects, hardware, and Airi
/blog Post index read from posts/index.json, filterable by tag
/blog/:slug posts/<slug>.md fetched and rendered in the browser
anything else In-app 404 page

Publishing a post is a file drop. The binary does not know what the posts are — it asks the web server for them at runtime, so adding a post never rebuilds the WASM.

Stack

  • Leptos 0.8, client-side rendering (csr), plus leptos_router for the client-side routes.
  • pulldown-cmark 0.13 for Markdown, with a hand-written renderer on top of its event stream so every element can carry the classes the stylesheet wants (code-block headers, table wrappers, footnote lists, heading anchors, figure captions).
  • gloo-net + serde for the runtime fetches.
  • Trunk as the only build tool: it runs cargo, wasm-bindgen and wasm-opt, and copies the static content.
  • Four hand-written CSS files and a token layer. No framework, no CSS build step.
  • A small hand-written syntax colourer for fenced code blocks (src/highlight.rs) — about 300 lines, no tree-sitter, no WASM-in-WASM.

Nothing at runtime comes from a third party: Montserrat and Quicksand are vendored woff2 files (the same variable-font files the reference sites load), icons are inline SVG, and there is no analytics, no favicon CDN, no webfont request.

Getting it running

rustup target add wasm32-unknown-unknown
cargo install trunk            # 0.21+
just serve                     # http://127.0.0.1:8090

just serve builds the debug bundle and runs src/bin/serve.rs, a ~150-line static server whose one job is SPA fallback: /blog/some-slug is not a file, so it must answer with index.html for the router to take over. trunk serve 404s those links, which is exactly the behaviour the site must never have, and the deploy configs in deploy/ do the same thing.

Command What it does
just build Release build into dist/ (771 KB wasm, 310 KB gzipped)
just serve Debug build + dev server with fallback on 127.0.0.1:8090
just check cargo clippy -D warnings for the wasm target and the native server
just verify Release build, then smoke-test every route over HTTP
just fmt cargo fmt

tools/verify.sh checks the failures that are otherwise invisible until someone clicks: a deep link that does not fall back, a manifest entry whose .md is missing, an href in index.html that does not exist in dist/, duplicate slugs, wrong content types.

Layout

index.html            the shell: meta, the pre-paint theme script, trunk asset links
Trunk.toml            dist dir, no SRI, dev-server notes
justfile            the only task runner
src/
  main.rs             mount the app; debug-only panic hook into the console
  app.rs              routes: / , /blog , /blog/:slug , fallback
  data.rs             every link, project, service and system on the home page
  icons.rs            the inline SVG set (brand marks are simple-icons paths)
  posts.rs            index.json + markdown fetches, frontmatter, tag histogram
  markdown.rs         pulldown events -> styled HTML, escaped on the way out
  highlight.rs        syntax colours for fenced blocks
  util.rs             URL joining, dates, slugs, clipboard, theme, escaping
  components/         header, footer, cards, theme toggle, background fx, Link
  pages/              home, blog index, post reader, 404
  bin/serve.rs        dev/deploy-parity server (feature-gated: `--features serve`)
styles/               tokens.css (palettes) base.css home.css blog.css
assets/
  posts/              index.json + the markdown posts
  img/                favicon, avatars, pixel-art decorations
  fonts/              vendored Montserrat + Quicksand variable woff2
tools/                pixelart.py (regenerates the SVG decorations), verify.sh
deploy/               nginx and Caddy configs with SPA fallback + cache rules
COLOURS.md            the palette spec this site is not allowed to contradict

Publishing a post

  1. Drop assets/posts/<slug>.md.

  2. Add one entry to assets/posts/index.json:

    { "slug": "hello", "title": "Hello", "date": "2026-12-01",
      "tags": ["rust"], "summary": "One line for the index card." }
    
  3. Done. The file is served as /posts/hello.md; the app reads it at runtime.

index.json is the list of record. Frontmatter in the file (title:, date:, updated:, tags:, draft:) overrides the manifest on the post page, which is handy while a draft is still unlisted — an unlisted slug still renders if the file exists, and shows a draft sticker when frontmatter says so. draft: true in the manifest hides the entry from the index. Reading time is computed from the words in the rendered body (code counts at an eighth the rate of prose), so nobody maintains a reading_time field by hand.

Supported in a post: headings with anchor links and a generated table of contents, tables, task lists, footnotes with back-references, images (a paragraph that is only an image becomes a <figure> with a caption from its alt text), fenced blocks with a language label and a copy button, and > [!note] style callouts. Raw HTML in a post is escaped, not injected.

Styling

COLOURS.md is the spec. It records the palettes of blog.neurosama.com (light and dark) and vedal.ai, and this site uses them:

  • light — blog.neurosama.com: cream #f8f3ea, slate body, indigo headings, pink accent.
  • dark — blog.neurosama.com at night: #090713 with pink/cyan/lilac glows.
  • layout language — vedal.ai: card grid, pill buttons, tag chips.

styles/tokens.css is the only place a colour literal is allowed, as --accent-pink and friends under [data-theme="light"] and [data-theme="dark"]. Every component reads tokens. Fonts are Quicksand for display and Montserrat for body, matching the reference sites.

The theme is applied by a tiny inline script in index.html before first paint (stored preference → prefers-color-scheme, with ?theme=light|dark as a debug override), and the Rust theme toggle keeps data-theme, the <meta theme-color>, and localStorage in step afterwards.

Deploy

dist/ is the whole artefact: the wasm blob, one JS shim, four CSS files, two fonts, the images, and the posts folder. Serve it from anything static with fallback to index.html — see deploy/nginx.conf and deploy/Caddyfile.

Cache policy that actually matters:

  • hashed bundles (*-<16 hex>.wasm|js|css) → immutable, one year;
  • index.html, posts/index.json, posts/*.md, fonts, images → no-cache, so a new post is live the moment it is pushed.

One consequence of fallback routing is worth knowing: a request for a file that does not exist answers 200 with the app shell. src/posts.rs recognises that (is_app_shell) and turns it into a real not-found, so a wrong slug shows the "that post is not in the index" card instead of rendering index.html as an article.

Licence

MIT — see LICENSE.