本サイト
Donekbs0830.com — This Site

This site itself. Instead of renting cloud hosting, it runs on a desktop at home (i7-12700 + RTX 3070); my home internet blocks inbound ports 80/443, so it connects out through Cloudflare Tunnel. Beyond the web pages, the point is the automation a one-person operation needs: deployment, monitoring, alerts and backups all run without anyone watching.
Problem
I wanted a personal site that shows my work and is a piece of work itself, without paying monthly for cloud hosting — and my home internet blocks inbound ports 80/443. With one person running it, deployment, monitoring and backups all had to be automated: if something breaks it should fix itself, and if it can't, it should tell me.
Key decisions
- 01
Connect out from the home desktop with Cloudflare Tunnel
No open ports and no static IP; HTTPS, caching and blocking bad traffic are handled by Cloudflare.
- 02
Two-slot deployment (two build folders used in turn)
The new version builds in the slot that isn't live, so a failed build never touches the live site; if the health check fails after switching, it rolls back to the previous version automatically and sends an email.
- 03
Server Components for the home page, no animation library
Animation moved to CSS, native <dialog> and React View Transitions, and only the small components that really need interaction are sent to the browser.
- 04
Next.js 16 Cache Components
Pages with live data send a shell rendered at build time first and stream the numbers in after; posts and project pages are locked to fully static.
- 05
Build visitor analytics myself
No third-party analytics, no stored IPs and no cookies — only aggregate numbers; daily, weekly and monthly reports come from the same data.
Trade-offs
- The whole site runs on one desktop, so a power cut or network outage takes it down; there are automatic restarts, external monitoring and start-up notifications, but no second machine to take over
- Without a cloud platform's built-in features, deployment, backups and monitoring are all my own scripts to write and maintain
Results
- Downtime during deploys went from 5–40 seconds to 1–2 seconds, with automatic rollback when the health check fails
- Mobile home page JavaScript went from 225 KB to 170 KB; project pages from 2.8 MB to 565 KB
- Lighthouse scores of 100 for accessibility, best practices and SEO
- Daily encrypted off-site backups, with an automatic restore-and-compare from backup every 90 days
- 200+ unit tests and 130+ end-to-end tests (including accessibility scans) run on every push
Architecture
Details
- Visitor → Cloudflare (DNS, HTTPS, www redirect) → Cloudflare Tunnel → Next.js 16 on the desktop
- Static pages are served straight from Cloudflare's cache, and the cache is purged automatically after a deploy switches versions; the Cloudflare settings (HTTPS, HSTS, scanner blocking) are scripted and checked for drift on every deploy
- A custom Node.js server wraps Next.js and handles request and error logs; it starts at boot from Windows Task Scheduler, no login required
- All four home page sections are Server Components; only small interactions — the typing effect, the 3D background, the project filter — send JavaScript to the browser
- The hero's 3D background uses Three.js + React Three Fiber and only loads at desktop widths; phones never download it
Deploy
- Push to main → GitHub Actions self-hosted runner (on the same desktop) → a PowerShell deploy script
- Two-slot builds: the new version builds into the slot that isn't live, so a failed build never affects the live site; after switching, the home page and JS files are checked, and if anything is wrong it switches back and sends an email
- Downtime went from 5–40 seconds to 1–2 seconds
- After a successful deploy, Bing is notified automatically (IndexNow); if the résumé content changed, the PDF is regenerated and committed automatically
Operations
- A watchdog runs every 5 minutes: it checks the site and the CI runner and makes one request from outside to confirm the tunnel works; problems trigger an automatic restart, and if that fails it emails me (at most once an hour for the same issue)
- A real problem I tracked down: the site went down exactly every 3 days. Memory logs ruled out a leak; the cause was Windows Task Scheduler's default "stop the task if it runs longer than 72 hours"
- Daily backups of the settings and credentials that aren't in git: 30 copies kept on another drive, plus an AES-256-encrypted copy pushed to a private GitHub repo — every 90 days it is downloaded, decrypted and compared file by file
- Monitoring from outside the desktop: a GitHub-hosted job requests the site on a schedule, opens an issue if it can't reach it, and closes it when the site is back
- Maintenance mode: one command shows a maintenance page and keeps the monitors from treating it as an outage; if it stays on too long, I get a reminder email
Status-aware favicon
- The tab icon is a terminal window, and its colour is the site's current status
- Indigo: running normally | amber: under maintenance | red: page error | green: running on my own machine in development (so local and production are easy to tell apart)
- The dot in the top-right corner is a new-feature light: normally white, it turns cherry-blossom pink right after a new feature ships (lit automatically when a deploy contains a feature commit, off again after 12 hours)
- Every size comes from one SVG — browser tab, phone home screen and favicon.ico — with a simplified drawing for small sizes so it still reads at 16 px
Quality
- Dropping the animation library (for CSS, native <dialog> and React View Transitions) and moving to Server Components took mobile home page JavaScript from 225 KB to 170 KB
- Project architecture diagrams are pre-rendered to SVG with Playwright before deploy, taking project page JavaScript from 2.8 MB to 565 KB
- Lighthouse scores of 100 for accessibility, best practices and SEO
- Self-hosted visitor analytics (/stats) and real-visitor Web Vitals: aggregate numbers only, no stored IPs, no cookies
- Content-Security-Policy is enforced, and blocked resources are reported automatically
- Vitest unit tests + Playwright E2E (axe accessibility checks, every sitemap page returns 200, CSP violations); ESLint and type checks run before every commit