Skip to content
rayrayraykkPublic

Repository files navigation

Weirui Kuang · Agent World

中文说明

Weirui Kuang (Ray)'s interactive portfolio: an information-first personal site wrapped in an optional voxel Agent World. It presents my work on agent harnesses, loop engineering, human-in/on-the-loop systems, multi-agent orchestration, open-source systems, publications, and experience.

Made with QwenPaw

This site was built with QwenPaw. Visit the QwenPaw website to learn more.

The reusable site template is open source at rayrayraykk/homepage. If you enjoy the build, please star both the QwenPaw repository and the homepage template.

Highlights

  • Information-first portfolio with responsive English and Chinese routes.
  • Live GitHub stars, forks, and language data, sorted by stars at request time.
  • Optional desktop-only voxel Agent World with first-person exploration, NPCs, collectibles, weather, and a day/night cycle.
  • A tactile interaction layer with a wrench cursor, impact particles, animated project glyphs, avatar easter eggs, and an autonomous cursor-following agent crew.
  • Mobile visitors skip the 3D world and see the portfolio content immediately.

Stack

  • Next.js 16 App Router
  • React 19 and strict TypeScript
  • Motion
  • Three.js
  • Next.js Route Handlers and the GitHub REST API
  • Vercel Analytics

Local development

Requirements

  • 64-bit Node.js 24.x
  • npm 11+
  • Git

Verify your Node.js installation:

node -p "process.version + ' ' + process.arch"

The architecture should be x64 (or arm64 on a compatible machine).

Install and run

git clone https://github.com/rayrayraykk/homepage.git
cd homepage
npm install
copy .env.example .env.local
npm run dev

On macOS or Linux, use cp .env.example .env.local instead. Open http://localhost:3000; /en and /zh are the localized routes.

If npm is slow in mainland China, use a mirror for the current install without committing registry settings:

npm install --registry=https://registry.npmmirror.com

Runtime GitHub data

The browser requests /api/github after the page loads. The server fetches stars, forks, and languages for QwenPaw, AgentScope, and AgentScope Runtime, then returns the projects in descending star order. The values are not frozen at build time.

The route works without authentication, but a read-only fine-grained token is recommended to avoid low anonymous rate limits:

GITHUB_TOKEN=your_read_only_fine_grained_token

The token stays on the server and is never included in the browser bundle. Responses use CDN caching with stale-while-revalidate; if GitHub is unavailable, project information remains visible without invented metrics.

Persistent visitor telemetry

The footer's HUMANS IN THE LOOP counter uses Upstash Redis through /api/visits. It records daily anonymous visits and a persistent lifetime total, so redeployments do not reset the number. Raw IP addresses and user agents are never stored; they are combined with a server-only secret to create a daily HMAC identifier that expires after 48 hours. Bots, non-production deployments, repeated visits on the same day, and untrusted hosts do not increment the counter.

The Vercel Upstash integration automatically provides KV_REST_API_URL, KV_REST_API_TOKEN, and KV_REST_API_READ_ONLY_TOKEN. Public reads prefer the read-only token, while increments use the write token through Redis.fromEnv(). Adding a dedicated VISITOR_HASH_SECRET is recommended; when it is absent, the write token is used only as the server-side HMAC key. VISITOR_ALLOWED_HOSTS may contain a comma-separated allowlist. Redis failures hide the counter rather than showing a fabricated zero.

Content map

Content Location
Profile, projects, research history, experience, and publications lib/site-data.ts
English and Chinese interface copy lib/i18n.ts
GitHub fetching and ranking lib/github.ts
Main page and interaction logic components/agent-habitat.tsx
Agent World components/voxel-world.tsx
Core layout and responsive styles app/globals.css
Tactile effects and easter-egg styles app/interactions.css
Metadata app/layout.tsx

Agent World

Agent World is enabled on desktop only. Each run generates a compact voxel landscape with terrain, water, trees, rocks, four roaming agent NPCs, four collectible objects, a day/night cycle, and weather events.

Controls:

  • Mouse: look around
  • WASD or arrow keys: move
  • Space: jump
  • Left click: use the hoe to dig
  • E: open the inventory
  • F: talk to a nearby NPC
  • Esc: release the pointer

NPC dialogue appears in speech bubbles and does not interrupt movement. Collecting the toolbox, telescope, clock, and notebook updates the quest HUD and unlocks different weather. After all four are collected, visitors may finish or keep exploring.

On the first visit, a 10-second full-world entry screen lets visitors enter or skip. Skipping or leaving folds the world into a pixel black-hole portal and reveals the portfolio. That folded state is stored locally so returning visitors do not have to wait through the countdown again. Re-entering hides the portfolio with a black-hole transition.

Interaction easter eggs

  • Click the avatar repeatedly to trigger its alternate build state and contact shortcut.
  • The cursor starts with three small agents. Every ten clicks discovers another randomly generated agent, up to twenty.
  • Each agent has independent reaction time, acceleration, collision, bounce, idle actions, and wandering behavior when the pointer leaves the page.
  • After ten seconds without pointer movement, surplus agents leave one at a time until the original three remain.
  • The floating pixel clock can switch between Anywhere on Earth (UTC-12) and local time, and can be folded or closed.
  • Reduced-motion, touch, and small-screen modes remove decorative pointer effects.

Quality checks

npm run typecheck
npm run lint
npm run build

TODO

  • Provide a template configuration interface so profile content, projects, links, themes, and optional modules can be customized without editing source files.

Deploy to Vercel

  1. Push the repository to GitHub and import it in Vercel.
  2. Set Framework Preset to Next.js.
  3. Set Node.js Version to 24.x.
  4. Leave Build Command and Output Directory on the Next.js defaults; do not override the output directory with out.
  5. Add GITHUB_TOKEN under Project Settings → Environment Variables for Production, Preview, and Development.
  6. Connect an Upstash Redis database. Confirm that KV_REST_API_URL and KV_REST_API_TOKEN are present, then add VISITOR_HASH_SECRET for Production.
  7. Deploy, then verify /, /en, /zh, /api/github, and /api/visits.

The checked-in vercel.json pins the Next.js framework preset so settings from the repository's former Flask deployment cannot produce an incompatible output.

Custom domains

Add weiruikuang.com and www.weiruikuang.com under Project Settings → Domains, follow Vercel's DNS instructions, and redirect one hostname to the canonical domain.

Troubleshooting

  • Deployment is ready but every route is a Vercel 404: confirm the Framework Preset is Next.js, disable custom Build/Output overrides, and redeploy without the previous build cache.
  • GitHub cards remain on SYNCING: open /api/github, check its live field, verify GITHUB_TOKEN, and allow the CDN cache to refresh.
  • Windows reports a missing native binding: run node -p "process.arch". Replace an ia32 Node installation with 64-bit Node.js 24, reinstall dependencies, and rebuild.

Credits and license

If this project is useful to you, a star on both open-source repositories is warmly appreciated.

Licensed under the Apache License 2.0.

Releases

Packages

Contributors

Languages