# Spaghet.io 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 push-to-deploy workflow: 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. ## 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 This website is built using Astro with the following key components: - **Blog**: Articles about technology, development, and personal insights - **Projects**: Showcasing my various projects and contributions - **Work Experience**: Professional background and career history - **Legal**: Privacy policy and terms of service - **System status**: The footer light is powered by Uptime Kuma (see below) ## System Status Footer The "All systems normal" light in the footer reflects the public Uptime Kuma status page at [uptime.spaghet.io/status/public](https://uptime.spaghet.io/status/public). - `src/lib/status.ts` fetches Uptime Kuma's public status-page and heartbeat APIs server-side, reduces them to one state (`up`, `degraded`, `down`, `maintenance`, `unknown`) and caches the result in-process. - `src/pages/api/status.ts` exposes that small snapshot to the browser. Uptime Kuma sends no CORS headers outside dev mode and its heartbeat payload is ~200 KB, so the browser never talks to it directly. - `src/components/SystemStatus.astro` renders the light server-side (correct on first paint and with JS disabled) and then refreshes it every minute, pausing while the tab is hidden. Optional environment variables (all have working defaults): | Variable | Default | Purpose | | --- | --- | --- | | `STATUS_PAGE_URL` | `https://uptime.spaghet.io` | Uptime Kuma origin | | `STATUS_PAGE_SLUG` | `public` | Status page slug | | `STATUS_WATCH_GROUPS` | *(all groups)* | Comma-separated group names that drive the light, e.g. `"Critical Services,Database Services"` | | `STATUS_CACHE_TTL_SECONDS` | `60` | Server-side cache lifetime | | `STATUS_TIMEOUT_SECONDS` | `4` | Upstream request timeout | | `STATUS_STALE_AFTER_SECONDS` | `900` | Treat the light as unknown once beats stop arriving | ## Theme and Colour Tokens The site has one colour system, in `src/styles/global.css`. Components never hard-code a hex and, in almost every case, never need a `dark:` colour variant. - **`@theme`** declares semantic tokens (`page`, `surface`, `wash`, `ink`, `ink-muted`, `accent`, `link`, `link-hover`, `edge`, `line`, `chip`, `chip-ink`, `code-bg`, `focus`, `status-*`). Tailwind generates `bg-page`, `text-ink`, `border-edge`, … from them. - **`html.dark`** re-declares the same names with cooked-longer values. Because Tailwind emits the utilities as `var(--color-*)` references, flipping the class on `` recolours the whole site from the same class list. - **`--color-spaghetti-*`, `--color-marinara*`, `--color-meatball*`, `--color-parmesan`** are the raw ingredient palette. They feed the hero sky and gradients; they are *not* for text, because the pastels fall to 1.1–1.5:1 on the cream plate. Rules that keep it from drifting again: 1. Add a token, don't add a `dark:` variant. A component class list should read the same in both modes. 2. Keep colour rules inside `@layer`. Unlayered CSS outranks every Tailwind layer, which is how `.dark .text-spaghetti-brown` used to silently beat `dark:` utilities and put cream-on-cream text on the hero button (1.18:1). 3. Never target a Tailwind utility class (e.g. `.border-black/15`) with an unlayered override — it fires in both modes. 4. Prose colours go through `--tw-prose-*` only. The `html .prose` prefix in `global.css` is load-bearing: the typography plugin emits its defaults into the same layer but later, so at equal specificity it would win and articles would render slate. Contrast is held to WCAG AA: 4.5:1 for body text and links, 3:1 for large text and interactive borders. Light mode is a warm cream plate with white cards; dark mode is a warm espresso plate (`#140C08`) with raised cards, so the marinara-and-meatball night sky 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`. 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 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 - **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 To run this site locally: ```bash # Install dependencies npm install # 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/). ## License This project is licensed under the MIT License - see the LICENSE file for details.