Laktawan ang nilalaman
github · naka-sync
lahat ng proyekto

itsashik.dev

Ang site na ito: isang portfolio at blog na inilatag na parang isang homelab dashboard.

Ang artikulong ito ay isinalin gamit ang makina mula sa Ingles. Basahin ang orihinal

commits
96itsashik.dev na mga commit kada linggo: from 0 to 0, peak 95
nakaraang taon
mga bituin
1
wika
TypeScript
huling pagtulak
Nob 2026
MIT License
Screenshot ng www.itsashik.dev
live site · www.itsashik.dev
Sa pahinang ito
  1. Ano ito
  2. Bakit
  3. Patong-patong
  4. Ang mahirap na bahagi
  5. Katayuan
  6. README

Ano ito#

Ang site na iyong binabasa. Ito ay nakaayos na parang isang homelab dashboard: ang mga proyekto ay binabasa bilang mga serbisyo na may nasusukat na status, ang pagsusulat ang log, at ang pahina ng lab ay nagpapakita ng aking three-node Proxmox cluster nang live.

Bakit#

Maaaring sabihin ng kahit anong portfolio na "I run infrastructure". Gusto kong ipakita ito, para masusukat ang bawat numero sa pahina, mula sa GitHub o mula sa lab, at walang mano-manong tinatype.

Patong-patong#

Next.js at React sa Vercel, na may nilalaman sa Sanity at isang Studio na may temang tumutugma sa site. Tailwind CSS na may monochrome palette, kung saan ang kulay ay nangangahulugan lamang ng status. Ang bawat lab node ay nagpapatakbo ng isang maliit na Python agent na nagpapadala ng isang nilagdaang heartbeat bawat 30 segundo; ang site ay nagpapanatili ng 24 na oras ng kasaysayan sa Upstash Redis at nagmamarka ng isang node pababa mula sa mga ulat ng mga kapantay nito. Ang mga istatistika GitHub ay nagsi-sync sa isang iskedyul, o kapag hiniling mula sa Studio.

Ang mahirap na bahagi#

Isang pagkabigo na nangyari lamang sa produksyon. Pagkatapos ng isang refactor, naipasa ang mga preview deploy, naipasa ang isang local production build, at nabigo ang production deploy. Ang pagkakaiba ay isang environment variable: sa isang Sanity read token set, ang static page generation ay humingi ng draft mode, na hindi pinapayagan sa oras ng pagbuo. Ang pag-pin sa mga query na iyon sa na-publish na nilalaman ay naayos ito, at ngayon ay nire-reproduce ko na ang mga pagkabigong production-only nang lokal sa pamamagitan ng pagtatakda ng isang placeholder token.

Katayuan#

Aktibo. Dito ko unang sinusubukan ang mga bagay-bagay.

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.

tingnan sa GitHub