itsashik.dev
このサイトは、 homelabダッシュボードのようにレイアウトされたポートフォリオとブログです。
この記事は英語から機械翻訳されたものです。 原文を読む
- コミット
- 96
- 過去1年間
- 星
- 1
- 言語
- TypeScript
- 最後の追い込み
- 2026年11月
- MIT License
それは何なのか#
あなたが今見ているこのサイトは、 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
| Area | Choice |
|---|---|
| Framework | Next.js 16 (App Router, static prerendering), React 19, TypeScript |
| Content | Sanity 6 with the Studio embedded at /studio, typed GROQ via TypeGen, Live Content API |
| Styling | Tailwind CSS 4 (CSS-first tokens in app/globals.css), shadcn/ui on Radix, Geist |
| Code highlighting | Shiki, rendered on the server |
| Share images | next/og (opengraph-image.tsx routes) |
| Tests | Vitest + Testing Library, Playwright + axe |
| Hosting | Vercel (Analytics, Speed Insights, Cron) |
Getting started
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 /studioWithout 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
| Command | What it does |
|---|---|
npm run dev | Dev server (Turbopack); Studio at /studio (workspaces content and inbox) |
npm run build / npm start | Production build / serve it |
npm run check | Lint + typecheck + unit tests |
npm run lint · npm run typecheck · npm test | Individually |
npm run format · npm run format:check | Prettier (with Tailwind class sorting) |
npm run test:e2e | Playwright against a production build (npm run build first) |
npm run typegen | Regenerate sanity.types.ts after changing a schema or a query |
npm run backup | Export the production and inbox datasets (with assets) into backups/ (git-ignored). Needs npx sanity login |
Project layout
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/e2eHow 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, runnpm run typegen. - GitHub stats.
/api/sync-github-dataruns 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 stampsgithubSyncRequestedAtwith the editor's own permissions and/api/github-synconly 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.tsfails the build if any text/background pair drops below WCAG AA. - Contact messages. The form stores each message in a private
inboxdataset, shown in the Studio as the Inbox workspace (/studio/inbox, Unread / Read / Archived). Messages never go to the publicproductiondataset. - Security.
next.config.tssends 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.tsfails 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
featuredand the drag-and-drop order of the Projects list decide what leads the home page (skills follow the order of the Skills list). Addingtechand a case-studybodyfills/projects/[slug]and the filters. A Demo video (Overview tab) replaces the cover at the top of the project page. excerptand 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 thelogos,mdi,simple-iconsandrisets. 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.
/styleguideshows 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
/nowin 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 LuaEVALper write./api/lab-statusserves 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 withnext/ogfrom the same public status and CDN-cached for 30s. - Env vars:
LAB_HEARTBEAT_SECRET, plus Upstash (UPSTASH_REDIS_REST_*orKV_REST_API_*).
- A root collector on each node (
/nowis 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 forsiteConfig.nowStaleAfterDays.- Content seeds stay local. Sanity is the source of truth for content. The one-off seed
and migration scripts (Homecave and
/nowcopy, the project refresh, curation) are git-ignored, because this repo is public: they live only on the owner's machine and run withnpx sanity exec scripts/<name>.ts --with-user-token(dry run first). - E2E and publication state. Tests expect
ABOUT_PAGES=published|unpublished(whether/nowis live), decided before the build byexport $(node scripts/about-state.mjs)(uncached Sanity API). CI does this automatically and pickslighthouserc.published.jsononce/nowis 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.availabilityinlib/site.ts: change the label, usestatus: "warn"for limited availability, or set it tonullto hide it.
Deployment checklist (Vercel)
- 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 asSANITY_API_READ_TOKEN. - 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-webhookwith headerAuthorization: Bearer $SANITY_WEBHOOK_SECRET
- add
- The cron in
vercel.jsoncalls the GitHub sync daily; Vercel adds theCRON_SECRETheader.
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.