stnd.build

Digital Garden Recipe

Architectural blueprint and file tree for deploying an exploratory digital garden with bidirectional wiki-links and vault synchronization.

This recipe details the architecture of a Digital Garden — an interconnected, exploratory knowledge repository that evolves in public. Unlike a chronological blog where posts are published once and freeze in time, a digital garden is an active graph of evolving notes, connected via bidirectional wiki-links, tagged with intellectual maturity levels, and synced seamlessly from an authoring environment like Obsidian or local Markdown vaults.

Instant Scaffolding

To scaffold a complete, production-ready Digital Garden using @stnd/cli:

npx @stnd/cli new my-garden --template garden
cd my-garden
pnpm install
pnpm dev

File Structure

Following Standard’s fourth law (Vertical-Slice Modules), the garden functionality is completely encapsulated within modules/garden/, with pure markdown content living in an isolated content root (or symlinked directly from your personal Obsidian vault):

my-garden/
  astro.config.mjs                 # Standard core integration + Cloudflare adapter
  package.json                     # Dependencies (@stnd/core, @stnd/press, @stnd/ui)
  tsconfig.json                    # Path aliases (@modules/*)
  content/                         # Markdown vault root (or symlink to Obsidian vault)
    index.md                       # Garden home note & global frontmatter tokens
    concepts/
      continuous-learning.md
      mental-models.md
      second-brain.md
    references/
      books-2026.md
      typography-treatise.md
  modules/
    garden/
      index.module.js              # Module manifest registering routes and launcher actions
      helpers.ts                   # Note resolution, backlinks indexer, and graph builder
      layouts/
        GardenLayout.astro         # Standard layout with sidebar, search, and reading measure
      components/
        Backlinks.astro            # Incoming link explorer
        MaturityBadge.astro        # Visual indicator for seed/sprout/evergreen
        NoteHeader.astro           # Note title, modified date, reading time, and tags
      routes/
        index.astro                # Garden home route (renders content/index.md)
        [...slug].astro            # Dynamic catch-all reader for any nested vault note
        graph.astro                # Interactive 2D graph visualizer of note relationships

Architectural Breakdown

1. Astro Configuration (astro.config.mjs)

The garden is configured as an SSR-ready Cloudflare application, powered by @stnd/core:

import { defineConfig } from "astro/config";
import cloudflare from "@astrojs/cloudflare";
import standard from "@stnd/core";

export default defineConfig({
  site: "https://garden.example",
  output: "server",
  adapter: cloudflare({ inspectorPort: false }),
  integrations: [
    standard({
      title: "Digital Garden",
      vault: "./content", // Points to local notes directory or Obsidian vault
    }),
  ],
});

2. Note Lifecycle & Frontmatter Metadata

In Standard Garden, each note carries structured frontmatter indicating its status, visibility, and intellectual maturity:

---
title: Mental Models for Systems Thinking
created: 2026-03-12 10:14
modified: 2026-09-24 16:30
maturity: sprout        # seed (rough draft) | sprout (developing) | evergreen (mature)
visibility: public      # public (indexed) | unlisted (direct link only) | private
publish: true           # true to build and serve on edge
tags:
  - systems
  - philosophy
---

A system is an interconnected set of elements coherently organized in a way that achieves something...

Garden notes use natural Obsidian syntax: [[Target Note]] or [[Target Note|Custom Anchor Text]]. The @stnd/press engine parses these references into an in-memory graph at build or request time:

import { Press } from "@stnd/press";

export interface GardenNote {
  slug: string;
  title: string;
  content: string;
  maturity: "seed" | "sprout" | "evergreen";
  visibility: "public" | "unlisted" | "private";
  outgoingLinks: string[];
  backlinks: Array<{ slug: string; title: string }>;
}

// Data helper extracting notes and indexing reciprocal backlinks
export async function getGardenGraph() {
  const allNotes = await Press.loadFromDirectory("./content");
  const backlinkMap = new Map<string, Array<{ slug: string; title: string }>>();

  // Build the backlink inverted index
  for (const note of allNotes) {
    for (const target of note.outgoingLinks) {
      const existing = backlinkMap.get(target) || [];
      existing.push({ slug: note.slug, title: note.title });
      backlinkMap.set(target, existing);
    }
  }

  return allNotes.map((note) => ({
    ...note,
    backlinks: backlinkMap.get(note.slug) || [],
  }));
}

4. Dynamic Catch-All Reader ([...slug].astro)

Standard’s second law mandates that .astro files hold zero business logic. Data fetching and backlink calculation occur in helpers.ts:

---
import GardenLayout from "../layouts/GardenLayout.astro";
import Backlinks from "../components/Backlinks.astro";
import MaturityBadge from "../components/MaturityBadge.astro";
import { getGardenGraph } from "../helpers";

const { slug } = Astro.params;
const notes = await getGardenGraph();
const currentSlug = slug || "index";
const note = notes.find((n) => n.slug === currentSlug);

if (!note || note.visibility === "private") {
  return Astro.redirect("/404");
}
---

<GardenLayout title={note.title}>
  <article class="prose reading-measure">
    <header class="mb-2">
      <div class="cluster items-center gap-half mb-1">
        <MaturityBadge maturity={note.maturity} />
        <time class="spec label" datetime={note.modified}>Updated {note.modified}</time>
      </div>
      <h1 class="font-display step-4">{note.title}</h1>
    </header>

    <div class="note-body" set:html={note.contentHtml} />

    {note.backlinks.length > 0 && (
      <footer class="mt-4 pt-2 border-t">
        <h2 class="step-1 font-mono mb-1">Links to this note</h2>
        <Backlinks links={note.backlinks} />
      </footer>
    )}
  </article>
</GardenLayout>

5. Instant Command Palette Search (@stnd/launcher)

Registering a keyboard-driven search palette requires zero third-party search scripts. In modules/garden/index.module.js:

export default {
  id: "garden",
  routes: {
    "/": "./routes/index.astro",
    "/graph": "./routes/graph.astro",
    "/*": "./routes/[...slug].astro",
  },
  launcher: {
    actions: [
      {
        id: "garden.search",
        title: "Search Garden Notes",
        shortcut: ["Mod", "K"],
        handler: "openPalette",
      },
      {
        id: "garden.graph",
        title: "Open Interactive Graph View",
        shortcut: ["Mod", "G"],
        action: "/graph",
      },
    ],
  },
};

Best Practices for Digital Gardens

  1. Keep Originals Untouched: Never write proprietary framework syntax into your markdown notes. Use pure CommonMark, GFM tables, and standard [[wikilinks]]. Your notes must remain readable in raw terminal editors or Obsidian.
  2. Respect the Measure: Reading long-form hypertext demands optical discipline. Use class="prose" with max-inline-size: var(--reading-width, 42rem) to ensure comfortable eye tracking.
  3. Embrace Sprouting: Do not wait for complete essays before publishing. Mark fresh thoughts as maturity: seed and allow your audience to explore ideas as they develop.