Zum Inhalt springen
github · synchronisiert
alle Projekte

itsashik.dev

Diese Website: ein Portfolio und Blog, gestaltet wie ein homelab Dashboard.

Dieser Artikel wurde maschinell aus dem Englischen übersetzt. Lesen Sie das Original

Commits
96itsashik.dev Commits pro Woche: from 0 to 0, peak 95
vergangenes Jahr
Sterne
1
Sprache
TypeScript
letzter Schub
Nov. 2026
MIT License
Screenshot von www.itsashik.dev
live site · www.itsashik.dev
Auf dieser Seite
  1. Was es ist
  2. Warum
  3. Stapel
  4. Der schwierige Teil
  5. Status
  6. README

Was es ist#

Die Website, die Sie gerade lesen. Sie ist wie ein Dashboard homelab aufgebaut: Projekte werden als Dienste mit einem messbaren Status angezeigt, Schreibvorgänge werden protokolliert, und die Laborseite zeigt meinen dreiknotigen Proxmox Cluster live an.

Warum#

Jedes Portfolio kann behaupten: „Ich betreibe Infrastruktur“. Ich wollte, dass dieses Portfolio es auch zeigt, deshalb ist jede Zahl auf der Seite gemessen, entweder von GitHub oder aus dem Labor, und keine wurde von Hand eingegeben.

Stapel#

Next.js und React basieren auf Vercel, die Inhalte werden in Sanity bereitgestellt und das Studio ist thematisch an die Website angepasst. Tailwind CSS verwendet eine monochrome Farbpalette, wobei Farbe ausschließlich den Status anzeigt. Jeder Lab-Knoten führt einen kleinen Python-Agenten aus, der alle 30 Sekunden ein signiertes Statussignal sendet. Die Website speichert 24 Stunden Verlauf in Upstash Redis und markiert einen Knoten anhand der Meldungen seiner Peers als inaktiv. GitHub Statistiken werden planmäßig oder auf Anfrage aus dem Studio synchronisiert.

Der schwierige Teil#

Ein Fehler, der ausschließlich in der Produktionsumgebung auftrat. Nach einer Refaktorisierung verliefen die Preview-Deployments und der lokale Produktions-Build erfolgreich, das Deployment in der Produktionsumgebung schlug jedoch fehl. Der Unterschied lag in einer einzigen Umgebungsvariablen: Mit einem gesetzten Sanity -Lesetoken forderte die statische Seitengenerierung den Entwurfsmodus an, der zur Build-Zeit nicht zulässig ist. Das Problem ließ sich beheben, indem diese Abfragen auf veröffentlichte Inhalte zurückgeführt wurden. Nun kann ich die Fehler, die nur in der Produktionsumgebung auftreten, lokal reproduzieren, indem ich ein Platzhaltertoken setze.

Status#

Aktiv. Dort probiere ich Dinge zuerst aus.

README.md

MeAshikeqbal/portfolio · master

Portfolio and blog of Ashik Eqbal, styled as a homelab status dashboard: a monochrome UI where colour only ever means status (green = live, amber = attention, red = down, blue = link/info).

Live: www.itsashik.dev · Style guide: /styleguide (preview and local builds only)

Stack

AreaChoice
FrameworkNext.js 16 (App Router, static prerendering), React 19, TypeScript
ContentSanity 6 with the Studio embedded at /studio, typed GROQ via TypeGen, Live Content API
StylingTailwind CSS 4 (CSS-first tokens in app/globals.css), shadcn/ui on Radix, Geist
Code highlightingShiki, rendered on the server
Share imagesnext/og (opengraph-image.tsx routes)
TestsVitest + Testing Library, Playwright + axe
HostingVercel (Analytics, Speed Insights, Cron)

Getting started

bash
nvm use               # Node 24 (see .nvmrc)
npm ci
cp .env.example .env.local   # fill in values; the public Sanity id is prefilled
npm run dev           # http://localhost:3000, Studio at /studio

Without the server-side secrets the site still builds and renders. The contact form, GitHub sync and webhook just report that they aren't configured.

Scripts

CommandWhat it does
npm run devDev server (Turbopack); Studio at /studio (workspaces content and inbox)
npm run build / npm startProduction build / serve it
npm run checkLint + typecheck + unit tests
npm run lint · npm run typecheck · npm testIndividually
npm run format · npm run format:checkPrettier (with Tailwind class sorting)
npm run test:e2ePlaywright against a production build (npm run build first)
npm run typegenRegenerate sanity.types.ts after changing a schema or a query
npm run backupExport the production and inbox datasets (with assets) into backups/ (git-ignored). Needs npx sanity login

Project layout

code
app/
  (root)/            public site: home, /post, /post/[slug], /projects, /projects/[slug]
  studio/            embedded Sanity Studio
  styleguide/        living style guide (404 in production)
  api/               sanity-webhook (revalidation), sync-github-data (cron), github-sync (Studio)
  icons/             self-hosted Iconify SVGs for the skills inventory
  opengraph-image.tsx, sitemap.ts, robots.ts, manifest.ts, rss.xml/
components/
  dashboard/         design-system primitives (StatusPill, Panel, DataRow, Sparkline…)
  home/ blog/ projects/ site/ portable-text/ seo/
  ui/                shadcn/ui components
lib/                 data access (api.ts), helpers, structured data, OG frame
sanity/              schema types, GROQ queries, clients; Studio dashboard, actions, inputs
scripts/             one-off data migrations (dry run by default) and the backup script
tests/unit, tests/e2e

How things work

  • Content and freshness. Every read goes through sanityFetch (lib/api.ts). Pages are static. <SanityLive /> revalidates them when content is published, and the Sanity webhook (/api/sanity-webhook) is the backstop for changes made while nobody is on the site.
  • Typed queries. All GROQ lives in sanity/lib/queries.ts. After editing a query or a schema, run npm run typegen.
  • GitHub stats. /api/sync-github-data runs daily (vercel.json). It updates stars, language, last push and past-year commit activity (including a 12-week series for the sparklines) on every project with a repo, plus the repo's README, which the project page shows below the case study (sanitized, GitHub-hosted images only, starter READMEs hidden; Show README in the project's GitHub tab turns it off). New repositories are not added automatically. In the Studio, Sync from GitHub (a project's ⋯ menu) or Sync all now (Home dashboard) runs it on demand: the Studio stamps githubSyncRequestedAt with the editor's own permissions and /api/github-sync only syncs freshly stamped projects, so no secret ever reaches the browser.
  • Design tokens. Colours are OKLCH tokens in app/globals.css. tests/unit/tokens.test.ts fails the build if any text/background pair drops below WCAG AA.
  • Contact messages. The form stores each message in a private inbox dataset, shown in the Studio as the Inbox workspace (/studio/inbox, Unread / Read / Archived). Messages never go to the public production dataset.
  • Security. next.config.ts sends HSTS, nosniff, a referrer policy, a permissions policy and a Content Security Policy. The CSP applies to production builds only and doesn't cover the Studio. tests/e2e/security.spec.ts fails on any CSP violation.

Content tips (Sanity Studio)

  • Project status (active / maintained / archived) turns on status pills. Nothing is claimed until it's set.
  • Project featured and the drag-and-drop order of the Projects list decide what leads the home page (skills follow the order of the Skills list). Adding tech and a case-study body fills /projects/[slug] and the filters. A Demo video (Overview tab) replaces the cover at the top of the project page.
  • excerpt and the SEO fields (title, description, social image, noindex) override the generated defaults for posts and projects.
  • Skill icons are Iconify names (logos:aws, mdi:security) from the logos, mdi, simple-icons and ri sets. The icon field has a search and warns when a name doesn't exist.
  • Rich text has code blocks (language, filename, highlighted lines), note/warning callouts, videos, numbered lists and inline code. /styleguide shows every block type.
  • Videos (demo video or a block in any case study or post) are either an upload (MP4/WebM on Sanity's CDN; keep clips short, every view counts against Sanity bandwidth; "Play like a GIF" loops them muted) or a YouTube link, which loads the youtube-nocookie player only when played. RSS readers get a link instead.
  • Open on site (⋯ menu) opens a published post, project, Homecave or /now in a new tab.
  • Homecave (/homecave, formerly /uses, which now redirects) is the live homelab dashboard. Each Proxmox node's agent (scripts/lab-heartbeat/) posts a signed, anonymized report every 30s to /api/lab-heartbeat. Reports are stored in Upstash: the latest per node, plus 24h of 5-minute samples, one Lua EVAL per write. /api/lab-status serves them, re-allowlisted. The page is server-rendered every 30s and kept fresh in the browser.
    • A root collector on each node (collect.py, every 60s, local only) adds what the read-only token can't see: named public services up/down (badges on the self-hosted and network rows), container health, temperatures, GPU, scrubs, backups, WAN, edge traffic, DNS and media savings, all reduced to public names and counts before the sender signs them.
    • Its copy comes from the Homecave singleton (Sanity type uses): the intro; the "Homelab" rows, whose names match the lab's public node names and whose descriptions become the node spec lines; and the self-hosted and setup sections.
    • The hero's homelab list shows the first five Homelab rows, with measured badges.
    • Snapshot (button by the verdict) saves /homecave/snapshot, a PNG of the lab right now, rendered with next/og from the same public status and CDN-cached for 30s.
    • Env vars: LAB_HEARTBEAT_SECRET, plus Upstash (UPSTASH_REDIS_REST_* or KV_REST_API_*).
  • /now is a singleton under Personal Info. It stays a 404, and isn't linked from the footer, ⌘K palette or sitemap, until it has published content. It turns its date pill amber once it hasn't been edited for siteConfig.nowStaleAfterDays.
  • Content seeds stay local. Sanity is the source of truth for content. The one-off seed and migration scripts (Homecave and /now copy, the project refresh, curation) are git-ignored, because this repo is public: they live only on the owner's machine and run with npx sanity exec scripts/<name>.ts --with-user-token (dry run first).
  • E2E and publication state. Tests expect ABOUT_PAGES=published|unpublished (whether /now is live), decided before the build by export $(node scripts/about-state.mjs) (uncached Sanity API). CI does this automatically and picks lighthouserc.published.json once /now is live. Homecave is always audited.
  • Draft previews. Open Presentation in the Studio to edit with a live preview of the real site, drafts included. This needs SANITY_API_READ_TOKEN (a Viewer token).
  • Availability badge. The hero badge comes from siteConfig.availability in lib/site.ts: change the label, use status: "warn" for limited availability, or set it to null to hide it.

Deployment checklist (Vercel)

  1. Set the environment variables from .env.example (Production and Preview). For draft previews, create a Viewer token at sanity.io/manage → API → Tokens and set it as SANITY_API_READ_TOKEN.
  2. In sanity.io/manage → API:
    • add https://www.itsashik.dev (and preview domains) as CORS origins, for live updates
    • add a webhook to https://www.itsashik.dev/api/sanity-webhook with header Authorization: Bearer $SANITY_WEBHOOK_SECRET
  3. The cron in vercel.json calls the GitHub sync daily; Vercel adds the CRON_SECRET header.

License

Code is released under the MIT License. Blog posts, images and other site content are © Ashik Eqbal and not covered by it. The Geist fonts in assets/fonts (used by the generated share images) are under the SIL Open Font License; see assets/fonts/OFL.txt.

Auf GitHub ansehen