コンテンツへスキップ
GitHub · 同期済み
すべてのプロジェクト

itsashik.dev

このサイトは、 homelabダッシュボードのようにレイアウトされたポートフォリオとブログです。

この記事は英語から機械翻訳されたものです。 原文を読む

コミット
96週あたりのコミット数itsashik.dev: from 0 to 0, peak 95
過去1年間
星
1
言語
TypeScript
最後の追い込み
2026年11月
MIT License
www.itsashik.devのスクリーンショット
live site · www.itsashik.dev
このページでは
  1. それは何なのか
  2. なぜ
  3. スタック
  4. 難しいところ
  5. 状態
  6. README

それは何なのか#

あなたが今見ているこのサイトは、 homelabダッシュボードのようなレイアウトになっています。プロジェクトは測定されたステータスを持つサービスとして表示され、書き込みはログとして表示され、ラボページには私の3ノードのProxmoxクラスタのライブ映像が表示されます。

なぜ#

どんなポートフォリオでも「私はインフラを運用しています」と謳うことはできます。しかし、このポートフォリオではそれを具体的に示すことに重点を置きたかったので、ページ上の数値はすべてGitHubやラボで計測したものであり、手入力は一切していません。

スタック#

Vercel上でNext.jsとReactを使用し、コンテンツはSanityに、Studioはサイトに合わせたテーマで構築されています。CSSはTailwindを使用し、モノクロパレットを採用。色はステータスのみを表します。各ラボノードは、30秒ごとに署名付きハートビートを送信する小型のPythonエージェントを実行します。サイトはUpstash Redisに24時間分の履歴を保持し、ピアからのレポートに基づいてノードをダウンとマークします。GitHub GitHub統計情報は、スケジュールに基づいて、またはStudioからのオンデマンドで同期されます。

難しいところ#

本番環境でのみ発生する不具合。リファクタリング後、プレビューデプロイは成功し、ローカルでの本番ビルドも成功しましたが、本番デプロイは失敗しました。違いは環境変数1つでした。Sanity読み取りトークンが設定されている場合、 Sanityページ生成時にドラフトモードが要求されますが、これはビルド時には許可されていません。これらのクエリを公開コンテンツに固定することで問題は解決し、現在はプレースホルダートークンを設定することで、本番環境でのみ発生する不具合をローカルで再現できるようになりました。

状態#

活動的。まず最初に色々なことを試す場所です。

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.

GitHubで見る