From 424a7ac1ed2e91dc39fa0ef2d2626af752618692 Mon Sep 17 00:00:00 2001 From: Spaghet Date: Thu, 26 Nov 2026 21:13:22 -0500 Subject: [PATCH] docs: rewrite README for the Appwrite architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old pipeline description was stale: there is no Gitea->GitHub mirror (verified against the Gitea API: no mirror flag, no GitHub repo) — the only webhook feeds Appwrite Sites, which builds and runs the site. Documents the TablesDB content backend, the Appwrite-first/ .md-fallback read path, storage media, preview deployments, and the optional APPWRITE_* env knobs; fixes 'Static site generation' to SSR. --- README.md | 81 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 2684b03..07978cd 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,66 @@ # Spaghet.io -Welcome to my personal website! This site showcases my projects, blog posts, and professional experience. It's built with Astro and hosted using a modern deployment pipeline. +Welcome to my personal website! This site showcases my projects, blog posts, and +professional experience. It's built with Astro in SSR mode and runs entirely on +self-hosted infrastructure: the site itself is an [Appwrite](https://appwrite.io) +Site, its content lives in Appwrite TablesDB, and its images come from Appwrite +Storage — all on my own server. + +Live at [spaghet.io](https://spaghet.io) (served from the Appwrite site at +[home.spaghet.io](https://home.spaghet.io)). ## Deployment Pipeline -My website follows a robust deployment workflow: +My website follows a push-to-deploy workflow: -1. **Development**: I develop content and code locally using Gitea as my Git hosting solution -2. **Auto-push**: Changes are automatically pushed from Gitea to GitHub via configured webhooks -3. **Hosting**: The site is hosted on self-hosted infrastructure, which provides a scalable and secure hosting environment -4. **Delivery**: NGINX reverse proxy handles routing and serves content with optimal performance +1. **Development**: I develop content and code locally and push to + [Gitea](https://gitea.spaghet.io/spaghet/Spaghet.io), my canonical Git host. +2. **Auto-deploy**: a Gitea webhook notifies Appwrite Sites. A push to `main` + builds a new deployment and becomes the live one; pushes to other branches + build ephemeral preview deployments at `branch--.spaghet.io` + (console sign-in required to view). +3. **Runtime**: Appwrite's compute (Open Runtimes, Node 22) runs the Astro SSR + server (`@astrojs/node`). Pages fetch their content per request, so editing + a blog post in the Appwrite console goes live without a rebuild. +4. **Edge**: NGINX Proxy Manager terminates TLS (Let's Encrypt wildcard cert + for `*.spaghet.io`) and routes to Appwrite's Traefik router, which matches + the site's proxy rule. -This pipeline ensures that my website is always up-to-date with the latest changes while leveraging modern hosting technologies. +## Content: Appwrite TablesDB + +The markdown under `src/content/` is the source of truth and backup, but pages +read from Appwrite at request time: + +- Database `spaghet-home` (project `homelab` on `appwrite.spaghet.io`), one + table per collection: `blog`, `projects`, `work`, `legal`. Frontmatter + fields are columns, the markdown body is the `content` column, and the + filename is the row id and slug. +- `src/lib/appwrite.ts` is the service layer: SDK reads, markdown rendered at + request time with Astro's own Shiki pipeline (dual themes, same config as + `astro.config.mjs`), 60-second in-process cache with stale-serving. +- `src/lib/content-source.ts` is the facade every page imports: Appwrite first, + bundled `.md` copies as fallback when Appwrite is cold-unreachable. The site + never 500s on a backend outage. +- Reads are public: each table grants `read("any")`, so the server needs no API + key for normal traffic. `scripts/appwrite-migrate.mjs` (re-)imports all + content rows and both images; it is idempotent. +- Images (`logo.png`, `profile.jpg`) live in the Storage bucket `site-media` + under stable file ids; `src/lib/media.ts` builds the browser URLs (including + the on-the-fly resized profile preview), and each `` falls back to the + `public/images/` copy via `onerror` if storage is ever down. + +Optional environment variables (all have working defaults, see `.env.example`): + +| Variable | Default | Purpose | +| --- | --- | --- | +| `APPWRITE_ENDPOINT` | `https://appwrite.spaghet.io/v1` | Content/media backend origin | +| `APPWRITE_PROJECT_ID` | `homelab` | Appwrite project | +| `APPWRITE_DATABASE_ID` | `spaghet-home` | TablesDB database | +| `APPWRITE_API_KEY` | *(unset)* | Optional server key for reads (bypasses guest rate limits) | +| `APPWRITE_CONTENT_TTL_SECONDS` | `60` | In-process content cache lifetime | + +Search (`/search`) runs client-side with fuse.js over a slim index of blog and +project titles, summaries and tags — bodies are never shipped to the browser. ## Site Components @@ -85,14 +134,19 @@ has something warm to sit on. Code blocks use dual Shiki themes (`light-plus` / `everforest-dark`, chosen by measuring every bundled theme's tokens against the site's own code backgrounds) with the -`--shiki-light` / `--shiki-dark` swap in `global.css`. +`--shiki-light` / `--shiki-dark` swap in `global.css`. The same config is mirrored in +`src/lib/appwrite.ts`, which renders stored markdown at request time, so code blocks +look identical whether content came from Appwrite or the bundled `.md` fallback. ## Technologies Used -- **Framework**: Astro (Static site generation) -- **Styling**: Tailwind CSS +- **Framework**: Astro 7 (server-side rendering via `@astrojs/node`) +- **Interactivity**: SolidJS islands (filterable listings, search) +- **Styling**: Tailwind CSS 4 with custom semantic tokens - **TypeScript**: Type-safe development -- **Deployment**: Gitea → GitHub → Self-hosted infrastructure → NGINX reverse proxy +- **Backend**: Appwrite 2.7 — Sites (compute), TablesDB (content), Storage (media) +- **Deployment**: Gitea → webhook → Appwrite Sites build → SSR runtime, behind + NGINX Proxy Manager (TLS) and Appwrite's Traefik router ## Getting Started @@ -102,8 +156,11 @@ To run this site locally: # Install dependencies npm install -# Start development server +# Start development server (content reads hit Appwrite; the .md fallback works offline) npm run dev + +# Re-import content and images into Appwrite after editing .md files +APPWRITE_API_KEY=*** node scripts/appwrite-migrate.mjs ``` For more information about the Astro framework and its features, please refer to the [Astro documentation](https://docs.astro.build/).