Repository navigation
Home
TRACE is the Telemetry Render & Activity Coding Engine: coding activity SVG snapshots for GitHub profile READMEs and live auto-resizing embeds for personal websites, maintained by LianHarman(LienThuan04). Everything is on this one page.
Quick start: Enable both public profile checkboxes in WakaTime (see WakaTime and Wakapi setup), open Card Studio (/), enter your username or User ID, pick a layout and pattern, and copy Markdown, Picture, HTML, Live iframe, SVG URL, or JSON. No WakaTime API key is required for public profiles.
- Card Studio
- Themes
- Style axes, patterns, and icons
- Options
- WakaTime and Wakapi setup
- Public API vs. server-only owner API key
- README snapshot
- Live card
- Self-hosting and environment variables
- Deploying to Vercel and Cloudflare Workers
- Caching and GitHub Camo
- SVG size and performance tips
- Troubleshooting
- Development
- Feedback and ideas
Card Studio runs at the root route / of your Waka-TRACE deployment. It renders live previews using the exact React theme components shared by /live/{username} and can switch directly to the /api/{username} SVG snapshot (loaded as a standalone image) to verify GitHub README parity before copying embed code.
-
Identity & Source (
01 Identity & Source):-
Username or WakaTime User ID starts blank so visitors can type immediately without clearing a prefilled handle. Leading
@characters are stripped automatically. -
Display name also starts blank (
Optional custom name), while Card title defaults to empty placeholderCoding Activity. - When the username input is blank, Studio previews the instance's configured demo handle (
NEXT_PUBLIC_DEMO_USERNAME/NEXT_PUBLIC_DEMO_DISPLAY_NAME). Typing any valid handle (^[A-Za-z0-9_.-]{1,64}$) automatically switches the preview toggle to Live API so you immediately see live stats for that profile. -
Provider selects
WakaTime (Public API)(source=wakatime) orWakapi (Compat API)(source=wakapi). -
Time range lists
auto (profile default),last_7_days,last_30_days,last_6_months,last_year, andall_time. Same-daytodayis only shown when the server hasWAKATIME_API_KEY+WAKATIME_OWNER_USERNAMEconfigured and the active handle matchesWAKATIME_OWNER_USERNAME(see Public API vs. server-only owner API key).
-
Username or WakaTime User ID starts blank so visitors can type immediately without clearing a prefilled handle. Leading
-
Theme picker (
02 Pick a Theme):- Choose among all 10 themes (
Editorial,Bento,Terminal,Glass,Wave,Compact,Neon,Badge,Mesh,Blueprint). - Selecting a theme automatically applies that theme's default width (
460pxfor most cards,480pxforbento/terminal/blueprint, auto-sized pill width forbadge). - The grid ends with a Coming soon tile (
SOON · Suggest a theme or feature) linked toFEEDBACK_URL.
- Choose among all 10 themes (
-
Style & Visibility (
03 Style & Visibility):- Controls are filtered dynamically to the selected theme's
supportedParamslist (Filtered for <Theme>). Unsupported controls never appear in Studio and are stripped from generated URLs. -
<ColorControl />provides quick swatches (includingAuto,Transparent,Gradient, GitHub dark/light tones), a native color picker, and direct hex entry forbgandaccent. -
<GradientControl />appears automatically wheneverbg=gradient,border=gradient, an atmospheric/glowpattern(grid_glow,aurora,spotlight,horizon,mesh) is active,themeisglassormesh, or 2+ custom gradient stops are set. Adjust 2–4 color stops andgradient_angle(0–360°). -
<PatternControl />displays a visual thumbnail grid for all 14 PatternCraft-inspired patterns, plus Intensity (pattern_opacity5–100%), Scale (pattern_scale50–200%), Pattern color swatches/picker (pattern_color), and a local Reset action. - Toggle switches control
animated,hide_header,hide_total,hide_daily_avg,hide_best_day,hide_langs,hide_projects,hide_editors,hide_os,hide_categories,hide_percent, andhide_other. Enabling Projects reveals the Max projects slider (1–5).
- Controls are filtered dynamically to the selected theme's
-
Preview stage & embed output:
-
Data mode: switch between Live API (fetches
/api/{username}/statswith a 5-minute refresh interval) and Sample Data (offline rich fixture data for exploring layouts even if a new WakaTime account has0aggregated seconds yet). -
Render target: switch between Card (direct React render) and SVG URL (rendered as a standalone SVG image from
/api/{username}). -
Stage backdrop: test how
bg=transparentand glow borders behave overdark,light, orcheckerbackgrounds. -
Embed tabs: copy Markdown, HTML, Picture (
<picture>dark/light media query), Live iframe (includes safewt:heightauto-resize script), SVG URL, or JSON (/api/{username}/stats). Studio omits options equal to their defaults so URLs stay concise. Reset clears Username, Display name, Title, and restoresDEFAULT_OPTIONS.
-
Data mode: switch between Live API (fetches
All 10 built-in themes implement docs/THEME-CONTRACT.md: pure React components rendered to inline SVG via renderToStaticMarkup (react-dom/server.edge), zero external image or font network fetches, deterministic measure() height calculation matching the rendered layout, automatic WCAG sRGB contrast polarity switching on custom backgrounds or gradients, and inline active IDE header emblems via IdeMark.
| Theme | Aesthetic / Use case | Width range & default | Sample dark size |
|---|---|---|---|
editorial |
Signature deep indigo & warm alabaster paper surface with crisp hierarchy |
300–900 (default 460) |
460×364 (460×456 with projects) |
bento |
Modular multi-tile dashboard grid separating metrics, languages, and telemetry |
320–900 (default 480) |
480×396 |
terminal |
Monospace command-line telemetry frame with traffic-light prompt chrome |
320–900 (default 480; defaults to mono font) |
480×330 |
glass |
Frosted translucent layered panels over a subtle multi-stop ambient wash |
300–900 (default 460) |
460×380 |
wave |
Liquid curved banner colored by your #1 language with automatic ink contrast |
300–900 (default 460) |
460×360 |
compact |
Slim 100px README strip highlighting primary language, total time, and bar |
300–900 (default 460) |
460×100 (88 high on error notice) |
neon |
High-contrast luminescent frame and glowing metric highlights |
300–900 (default 460) |
460×364 |
badge |
Compact 32px shields-style pill showing handle, total time, and top language |
180–520 auto-sized; ignores width; fixed 32 high |
362×32 |
mesh |
Multi-corner studio gradient mesh wash with luminous typography and balanced tiles |
300–900 (default 460) |
460×362 |
blueprint |
Precision technical drafting sheet with twin crosshair grid lines and coordinate metadata |
320–900 (default 480) |
480×362 |
Every preview below comes directly from the deterministic offline SVG generator (public/examples/) built from sanitized fixture metrics. Browse the interactive browser gallery at public/examples/index.html.
| Theme | Dark Mode | Light Mode |
|---|---|---|
editorial |
||
bento |
||
terminal |
||
glass |
||
wave |
||
compact |
||
neon |
||
badge |
||
mesh |
||
blueprint |
| State / Feature | What it verifies | Preview |
|---|---|---|
Projects grid (hide_projects=false) |
Renders top active project chips (max_projects=1..5) below the languages chart with adjusted card height (456px) |
|
Empty coding window (empty) |
Clean, informative empty notice returned as HTTP 200 when a new account has 0 aggregated seconds yet |
|
Private profile notice (private) |
Step-by-step fix card pointing to the two WakaTime Profile Settings checkboxes without breaking README <img> tags |
|
| Wave bright language contrast | When the #1 language has a bright swatch (like JavaScript #f1e05a), the liquid wave automatically switches overlay text ink to dark charcoal |
Every theme validates options against its declared supportedParams. Passing an unsupported query parameter is harmless (it is ignored gracefully) and Studio automatically hides unsupported controls:
| Theme group | Supported parameters | Special notes |
|---|---|---|
Full themes (editorial, bento, terminal, glass, wave, neon, mesh, blueprint) |
All 34 OPTION_NAMES
|
terminal forces font=mono unless another font is explicitly chosen; editorial, glass, and neon automatically yield their default ambient glow when a light-based pattern (aurora, spotlight, horizon, mesh, grid_glow) is selected |
compact |
25 parameters: theme, mode, range, source, accent, bg, radius, width, animated, lang_icon, display_name, title, hide_total, hide_langs, hide_percent, hide_other, hide_header, plus all surface params (pattern, pattern_color, pattern_opacity, pattern_scale, border, font, gradient, gradient_angle) |
Single-strip 100px layout omits secondary stats (daily_avg, best_day), project chips, footer rows, and multi-language chart_style
|
badge |
16 parameters: theme, mode, range, source, accent, bg, gradient, gradient_angle, radius, font, border, lang_icon, display_name, hide_total, hide_langs, hide_other
|
Width is calculated dynamically from label + total + top language (180–520px), height is fixed at 32px, and corner radius is capped at 16px
|
All visual customization options compose cleanly across SVG snapshots and live browser renders using inline SVG geometry, CSS gradients, and system font stacks — with zero external runtime network requests.
Pass chart_style=<value> on any full-size theme (bar is default):
| Value | Description | Preview (editorial dark) |
|---|---|---|
bar |
Clean horizontal bars scaled proportionally to coding share with rounded caps | |
stacked |
Unified multi-segment ribbon bar followed by compact language legend entries | |
blocks |
Segmented 10-cell horizontal equalizer meter per language | |
pills |
High-density wrapped rounded badges displaying language marker, name, and share | |
ring |
Concentric SVG donut breakdown paired alongside a ranked language legend | |
dots |
Crisp minimalist proportional dot matrix next to each language row |
Waka-TRACE bundles tree-shaken subpath icons from thesvg directly into server & client builds. normalizeInlineSvg() (src/card/parts/ide-icons.tsx) strips outer <svg> XML chrome, normalizes dark/light icon variants (#000 / #281733 / omitted root fill), and scopes every gradient, clipPath, and mask ID with a unique prefix (wt-ide-... / wt-lg-...) so multiple cards or icons on one README page never collide.
Mode (lang_icon) |
Behavior | Preview |
|---|---|---|
dot (default) |
GitHub Linguist color dots for every language, keeping SVG byte weight minimal | |
svg |
Renders the inline thesvg logo whenever a language is recognized and falls back automatically to the Linguist colored dot for obscure or unlisted languages |
31 Active IDE Header Marks (IdeMark):
The top-left header emblem automatically reflects your #1 recorded editor (editors[0].name). Supported IDEs (thesvg): VS Code, VSCodium, Cursor, Windsurf, Antigravity, Visual Studio, LazyVim, Neovim, Vim, IntelliJ IDEA, WebStorm, PyCharm, GoLand, PhpStorm, Rider, CLion, DataGrip, JetBrains Fleet, Android Studio, Xcode, Zed, Sublime Text, Emacs, Trae, Jupyter, Eclipse, Helix, Atom, Replit, Kiro, and RStudio. Unlisted editor names render a clean generic IDE vector icon, and empty telemetry states render the signature <TraceMark /> flame emblem.
57 Language SVG Icons (LanguageMarker):
Exact normalized alias matching (preventing short language names like C or R from false-matching longer strings) supports:
-
Web & Frontend:
TypeScript(tsx,typescriptreact),JavaScript(jsx,javascriptreact),HTML,CSS,Sass(scss),Less,React,Vue,Svelte,Astro,SVG -
Systems, App & General Purpose:
Python,Go,Rust,Java,C,C++,C#,PHP,Ruby,Swift,Kotlin,Dart,Scala,Elixir,Haskell,Lua,Perl,R,Zig,Julia,Clojure(clojurescript),Erlang,OCaml,F#,MATLAB,Solidity,WebAssembly(wasm) -
Shells, Data, Markup & Infra:
Bash(sh,shell,shellscript),PowerShell(pwsh),Zsh,MySQL,PostgreSQL(postgres,plpgsql),SQLite,JSON(jsonc,json5),YAML(yml),TOML,Markdown,MDX,GraphQL,Prisma,Docker(dockerfile),Terraform(hcl),LaTeX(tex),CMake,XML,Nix
Inspired by patterncraft.fun, Waka-TRACE renders 14 subtle vector textures and layered radial glows inside <StyleLayers />. Geometric patterns include radial <mask> edge fades so lines dissolve softly toward the card border rather than terminating harshly.
Pattern (pattern) |
Group / Behavior | Preview (editorial dark) |
|---|---|---|
none (default) |
Clean card surface with no extra texture overlay | |
dots |
Finely spaced geometric dot matrix with radial edge fade | |
grid |
Orthogonal coordinate grid overlay | |
grid_glow |
Orthogonal coordinate grid layered over a soft centered glow | |
blueprint |
Dual-step engineering drafting grid with major/minor subdivisions | |
crosshatch |
Woven crisscross architectural hatch lines | |
diagonal |
Angled parallel technical pinstripes | |
hex |
Seamless geometric honeycomb lattice | |
circuit |
PCB trace nodes and orthogonal circuit paths | |
waves |
Flowing parallel topographic contour curves | |
aurora |
Dual northern-lights radial glow using theme accent or gradient stops |
|
spotlight |
Overhead conical beam illuminating the header and top metrics | |
horizon |
Bottom-lit atmospheric horizon glow rising behind footer telemetry | |
mesh |
Multi-corner studio mesh wash blending 2–4 palette or gradient hues |
Pattern tuning parameters:
-
pattern_color— Optional 3/6/8-digit hex tint (defaultnullfollows accent/ink contrast automatically). -
pattern_opacity— Integer5–100percentage (default20), controlling line/dot or radial glow visibility. -
pattern_scale— Integer50–200percentage (default100), scaling geometric SVG<pattern>tile dimensions proportionally (dots,grid,grid_glow,blueprint,crosshatch,diagonal,hex,circuit,waves).
6 Frame Borders (border):
| Value | Effect | Preview |
|---|---|---|
subtle (default) |
Clean translucent hairline stroke adapted to dark/light mode | |
none |
Borderless surface edge | |
accent |
Crisp solid 1.5px border tinted with the active accent color |
|
gradient |
Multi-stop linear gradient frame driven by gradient & gradient_angle
|
|
glow |
Accent perimeter with an ambient halo ring | |
dashed |
Technical dashed outline (strokeDasharray="6 4") |
5 Font Stacks (font):
Every font stack relies strictly on local/system font families (never external @font-face fetches inside SVGs so GitHub Camo renders crisply without missing glyphs).
| Value | CSS font stack (src/lib/style-options.ts) |
Preview |
|---|---|---|
default |
var(--font-inter), "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif |
|
rounded |
"SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, sans-serif |
|
mono |
ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas, monospace |
|
serif |
Georgia, "Times New Roman", Cambria, serif |
|
condensed |
"Bahnschrift", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif |
- Pass
bg=gradientalongsidegradient=hex1-hex2[-hex3-hex4](2–4 hex stops separated by-or,, optional#) andgradient_angle=0..360(default135) to apply a custom linear gradient surface on any theme. - When fewer than 2 stops are passed, Waka-TRACE automatically builds a harmonious fallback ramp (
[accent, #3f2b96, #155555]). - The same
gradientandgradient_angleparameters also powerborder=gradient, atmospheric patterns (grid_glow,aurora,spotlight,horizon,mesh),glassbackdrops, andmeshtheme washes. -
Automatic WCAG sRGB contrast:
getEditorialPalette()computes WCAG relative luminance (isLightHex/isLightGradient) on custom hex backgrounds and gradients. Even ifmode=dark, setting a bright surface such asbg=f6f8faor a pastel gradient likegradient=fef08a-bae6fdflips card inks to dark charcoal (#292827/ theme dark ink) automatically so metrics always remain readable.
All query parsing lives in src/lib/options.ts and feeds both /api/{username}, /live/{username}, and /api/{username}/stats:
- Repeated keys: Uses the first value when a key appears multiple times.
-
Unknown keys: Silently ignored (never throw HTTP
400or500on typos). - Per-field isolation: An invalid value for one parameter falls back independently to that field's default while keeping all other valid options intact.
-
Booleans: Strictly
"true"or"false"; anything else falls back to default. -
Numbers: Parsed as finite numbers, rounded (
Math.round), and clamped to the field's[min, max]range (NaN/Infinityfall back to default). -
Hex colors:
normalizeHex()accepts 3, 6, or 8 hex digits with or without a leading#(3-digit shorthand expands automatically; invalid strings returnnull). -
Text bounds:
titletrims whitespace and caps at60characters (nullif empty);display_nametrims whitespace and caps at48characters. -
Themes: Validated against
/^[a-z0-9_-]{1,32}$/i, then resolved throughgetTheme()(src/card/theme-registry.ts), falling back toeditorialfor unknown theme names.
| Parameter | Accepted values | Default | Effect |
|---|---|---|---|
theme |
editorial, bento, terminal, glass, wave, compact, neon, badge, mesh, blueprint
|
editorial |
Card visual layout |
mode |
dark, light
|
dark |
Base palette polarity (auto-flipped when custom bg or gradient luminance demands opposite ink) |
range |
auto, last_7_days, last_30_days, last_6_months, last_year, all_time, today
|
auto |
Telemetry aggregation window (auto uses WakaTime public default; today requires server-side owner API key) |
source |
wakatime, wakapi
|
wakatime |
Telemetry provider |
accent |
3, 6, or 8 hex digits; optional #
|
null (theme auto) |
Accent color override |
bg |
Hex color, transparent, or gradient
|
null (theme auto) |
Card surface override; custom hex and gradient trigger automatic WCAG ink contrast |
gradient |
2–4 hex colors separated by - or ,
|
[] |
Multi-stop linear gradient colors consumed by bg=gradient, border=gradient, atmospheric patterns, glass, and mesh
|
gradient_angle |
Number, 0–360
|
135 |
Linear gradient angle in degrees |
radius |
Number, 0–48
|
16 |
Outer corner radius (badge caps at 16) |
width |
Number, 300–900
|
460 (bento/terminal/blueprint 480) |
Card width in px (badge ignores width and auto-sizes 180–520) |
animated |
true, false
|
true |
Enables CSS progress bar, wave, and pulse animations (always respects prefers-reduced-motion) |
chart_style |
bar, stacked, blocks, pills, ring, dots
|
bar |
Top Languages visualization style |
lang_icon |
dot, svg
|
dot |
Language marker (dot Linguist dot vs. svg inline thesvg logo with automatic dot fallback) |
pattern |
none, dots, grid, grid_glow, blueprint, crosshatch, diagonal, hex, circuit, waves, aurora, spotlight, horizon, mesh
|
none |
PatternCraft-inspired background texture or atmospheric glow layer |
pattern_color |
3, 6, or 8 hex digits; optional #
|
null (auto) |
Tint color override for geometric patterns and atmospheric glows |
pattern_opacity |
Number, 5–100
|
20 |
Pattern / glow opacity percentage |
pattern_scale |
Number, 50–200
|
100 |
Geometric pattern tile scale percentage (50%–200%) |
border |
subtle, none, accent, gradient, glow, dashed
|
subtle |
Card frame border style |
font |
default, rounded, mono, serif, condensed
|
default |
Font stack override (terminal and badge default to mono) |
max_langs |
Number, 1–8
|
5 |
Maximum number of languages returned & rendered |
max_projects |
Number, 1–5
|
3 |
Maximum number of project chips rendered when hide_projects=false
|
title |
Trimmed non-empty string, max 60 chars |
null (Coding Activity) |
Custom card header title |
display_name |
Trimmed non-empty string, max 48 chars |
null |
Override handle label displayed next to provider metadata |
hide_total |
true, false
|
false |
Hide Total Time metric |
hide_daily_avg |
true, false
|
false |
Hide Daily Average metric |
hide_best_day |
true, false
|
false |
Hide Best Day metric |
hide_langs |
true, false
|
false |
Hide Top Languages section |
hide_editors |
true, false
|
false |
Hide top IDE / editor footer telemetry |
hide_os |
true, false
|
false |
Hide operating system footer telemetry |
hide_projects |
true, false
|
true |
Hide Projects grid (false displays top projects) |
hide_categories |
true, false
|
true |
Hide coding/debugging categories footer item |
hide_header |
true, false
|
false |
Hide the top card header row |
hide_percent |
true, false
|
false |
Hide language percentages |
hide_other |
true, false
|
false |
Filter out the Other language bucket before capping max_langs
|
GitHub dark/light <picture> embed with SVG language icons, aurora glow, and custom projects:
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://your-deployment.vercel.app/api/YOUR_WAKATIME_USERNAME?theme=editorial&mode=dark&chart_style=bar&lang_icon=svg&pattern=aurora&pattern_opacity=25&hide_projects=false" />
<source media="(prefers-color-scheme: light)" srcset="https://your-deployment.vercel.app/api/YOUR_WAKATIME_USERNAME?theme=editorial&mode=light&chart_style=bar&lang_icon=svg&pattern=aurora&pattern_opacity=25&hide_projects=false" />
<img src="https://your-deployment.vercel.app/api/YOUR_WAKATIME_USERNAME?theme=editorial&mode=dark&chart_style=bar&lang_icon=svg&pattern=aurora&pattern_opacity=25&hide_projects=false" alt="Coding Activity" width="460" height="456" />
</picture>Blueprint card with custom tint, scale, dashed border, and monospace typography:
https://your-deployment.vercel.app/api/YOUR_WAKATIME_USERNAME?theme=blueprint&pattern=blueprint&pattern_color=38bdf8&pattern_opacity=30&pattern_scale=120&border=dashed&font=mono&lang_icon=svg
Self-hosted Wakapi user over last_30_days:
https://your-deployment.vercel.app/api/YOUR_WAKAPI_USERNAME?source=wakapi&range=last_30_days&theme=terminal
- Install the official WakaTime plugin inside your IDE (
VS Code,Cursor,Antigravity,Neovim,JetBrains,Xcode,Zed, etc.) and edit code for a few minutes. - Sign in to WakaTime → Settings → Profile and enable both public stats checkboxes:
- Display code time publicly
- Display languages, editors, os, categories publicly
- Copy your WakaTime Username (e.g.
LianHarman) or your WakaTime User ID UUID (e.g.66e506fe-4593-425e-9957-fefffdd20a83if your account does not set a public alias).- Valid characters (
sanitizeUsername): letters, numbers,.,_, and-,1–64characters. - Leading
@symbols are stripped automatically before calling WakaTime.
- Valid characters (
WakaTime lets users choose which single historical range is shown publicly in Profile Settings. Because of that:
-
range=auto(default) calls/api/v1/users/{username}/statswithout a fixed range suffix, letting WakaTime return whichever public range your profile exposes. - If you request a specific range (for example
range=last_30_days) that differs from your WakaTime public profile setting, WakaTime returns HTTP400with a"time range"error message. Waka-TRACE automatically detects HTTP400time-range mismatch errors (isRangeMismatchError) and transparently falls back to/users/{username}/stats(range=auto) so your README card still renders instead of failing.
To use Wakapi (wakapi.dev or a self-hosted Wakapi instance):
- Enable public stats in your Wakapi user settings.
- Pass
source=wakapiin query parameters (or choose Wakapi (Compat API) in Card Studio). - Requests automatically route to
{WAKAPI_API_URL}/api/compat/wakatime/v1/users/{username}/stats/{range}(mappingautoandtodaysafely tolast_7_days, since Wakapi's WakaTime compat stats route requires an explicit range segment). - Override
WAKAPI_API_URLin.envor Cloudflare secrets if you host your own Wakapi domain.
One of the most frequent questions when adopting Waka-TRACE is whether users need to paste a personal WakaTime API key into the web app. They do not.
- All six standard public ranges (
auto,last_7_days,last_30_days,last_6_months,last_year,all_time) read WakaTime's unauthenticated public/api/v1/users/{username}/statsendpoint. Once you enable the two checkboxes in WakaTime Profile Settings, your public username or User ID is all Waka-TRACE needs. - Asking visitors to paste a secret WakaTime API key into a public web form or pass
?api_key=...inside a README<img>URL would leak full account read credentials in browser history, server logs, and GitHub Markdown source. Waka-TRACE never accepts API keys in URL query parameters or browser requests. -
Why
range=todayis hidden for other handles: WakaTime only exposes real-time same-day activity (/api/v1/users/current/status_bar/today) to authenticated requests usingWAKATIME_API_KEY. On a hosted instance, allowing another person's handle to trigger the host'sWAKATIME_API_KEYwould expose the host's own/users/current/telemetry or fail. Therefore:- Card Studio hides
todayfrom the Time range dropdown unlesssource === "wakatime", bothWAKATIME_API_KEYandWAKATIME_OWNER_USERNAMEare set on the server, and the active Studio handle matchesWAKATIME_OWNER_USERNAME(case-insensitive,@stripped). - If another username calls
/api/someone_else?range=todaydirectly,canUseOwnerKey()returnsnulland Waka-TRACE falls through safely tosomeone_else's unauthenticated public/statsendpoint — never touchingWAKATIME_API_KEY.
- Card Studio hides
When you clone or fork Waka-TRACE to run your own deployment:
- Copy your personal WakaTime API key (
waka_...) and store it in your host's encrypted server-side environment settings (WAKATIME_API_KEYin Vercel Environment Variables orwrangler secret put WAKATIME_API_KEYon Cloudflare Workers). - Set
WAKATIME_OWNER_USERNAMEto your exact WakaTime username or User ID (66e506fe-...). Use your User ID UUID if WakaTime returnsusername: nullon your public stats payload. - Redeploy so Server Components (
src/app/page.tsx) passownerApiKeyEnabledandownerUsernameaccurately to Card Studio. - Once live, leaving Username blank (previewing your own
NEXT_PUBLIC_DEMO_USERNAME) or typing your matchingWAKATIME_OWNER_USERNAMEunlockstoday(Owner API key enabledlabel in Studio), while anyone else entering their own handle continues using public ranges cleanly without seeing401 Unauthorizederrors.
GET /api/{username} (configured with runtime = "nodejs" in src/app/api/[username]/route.ts) produces standalone SVG documents tailored for GitHub's README image proxy (GitHub Camo):
-
Always returns HTTP
200: Even when a profile is private (401/403), still compiling (202), missing (404), invalid, or has0aggregated seconds yet,/api/{username}renders a styled notice card matching your chosentheme,mode, andbgwith HTTP200so GitHub READMEs never display broken image icons. -
Security headers: Responds with
Content-Type: image/svg+xml; charset=utf-8andX-Content-Type-Options: nosniff. -
Self-contained rendering: Card layouts render cleanly into SVG
<foreignObject>alongside inline vector pattern<defs>, mask fades,<IdeMark />,<LanguageMarker />, and scoped CSS@keyframes(wtGrow,wtWaveSlide). Zero external images, stylesheets, or@font-faceURLs are requested when viewing the SVG. -
Motion accessibility: CSS animations only emit when
animated=true(default) and automatically disable inside@media (prefers-reduced-motion: reduce). Passanimated=falsefor completely static SVG output.
GET /live/{username} (dynamic = "force-dynamic" in src/app/live/[username]/page.tsx) renders a transparent HTML page hosting the interactive React <LiveCard /> component (src/live/LiveCard.tsx) backed by useWakaStats:
- Server-renders initial telemetry immediately on load, then performs a background client check
40msafter mount (and every300msdebounced on studio option updates). - Automatically refreshes telemetry every 5 minutes (
300,000ms) while the browser tab is visible, and triggers an immediate refresh onvisibilitychangewhen returning to the tab. - Retains last known data cleanly if a background refresh fails transiently.
<LiveCard /> attaches a ResizeObserver to its outer frame and posts { type: "wt:height", height } via window.parent.postMessage(...) whenever the rendered height changes. Copy Live iframe from Card Studio or use the hardened snippet below, always validating both event.origin and event.source before resizing the <iframe>:
<iframe
id="waka-trace-card"
src="https://your-deployment.vercel.app/live/YOUR_WAKATIME_USERNAME?theme=editorial&mode=dark&bg=transparent"
title="Live Coding Activity"
width="460"
height="364"
style="border: 0; width: 100%; max-width: 460px; background: transparent;"
loading="lazy"
></iframe>
<script>
(() => {
const frame = document.getElementById("waka-trace-card");
if (!frame) return;
window.addEventListener("message", (event) => {
if (event.origin !== new URL(frame.src).origin || event.source !== frame.contentWindow) return;
const { type, height } = event.data || {};
if (type === "wt:height" && Number.isFinite(height) && height > 0 && height < 10000) {
frame.style.height = Math.ceil(height) + "px";
}
});
})();
</script>Custom portfolio sites, Astro/Next.js components, or terminal scripts can consume normalized metrics directly from GET /api/{username}/stats:
- Responds with HTTP
200,Content-Type: application/json; charset=utf-8,Access-Control-Allow-Origin: *,X-Content-Type-Options: nosniff, and the same edgeCache-Controlheaders as/api/{username}. - Accepts
source,range,display_name,max_langs,max_projects, andhide_other.
Example response envelope:
{
"status": "ok",
"complete": true,
"fromStore": false,
"data": {
"username": "LianHarman",
"displayName": "LianHarman",
"source": "wakatime",
"range": "last_7_days",
"rangeLabel": "Last 7 Days",
"totalSeconds": 124560,
"totalText": "34 hrs 36 mins",
"dailyAverageText": "4 hrs 56 mins",
"bestDay": { "date": "2026-11-28", "text": "7 hrs 18 mins", "totalSeconds": 26280 },
"languages": [{ "name": "TypeScript", "percent": 62.4, "text": "21 hrs 35 mins", "color": "#3178c6" }],
"editors": [{ "name": "VS Code", "percent": 82.0, "text": "28 hrs 22 mins", "color": "#8c72df" }],
"operatingSystems": [{ "name": "Windows", "percent": 100.0, "text": "34 hrs 36 mins", "color": "#8c72df" }],
"projects": [{ "name": "Waka-TRACE", "percent": 68.0, "text": "23 hrs 31 mins", "color": "#8c72df" }],
"categories": [{ "name": "Coding", "percent": 94.2, "text": "32 hrs 35 mins", "color": "#8c72df" }]
},
"error": null
}Clone Waka-TRACE to customize defaults, host behind your own domain, enable the optional Upstash Redis snapshot cache, or unlock private range=today telemetry for your own profile:
git clone https://github.com/LienThuan04/Waka-TRACE.git
cd Waka-TRACE
pnpm install --frozen-lockfile
cp .env.example .env
pnpm devNever commit .env (already listed in .gitignore). Full environment table from .env.example:
| Variable | Default / Required | Scope | Purpose |
|---|---|---|---|
WAKATIME_API_URL |
https://wakatime.com/api/v1 |
Server | Base URL for WakaTime v1 requests |
WAKAPI_API_URL |
https://wakapi.dev |
Server | Base URL for Wakapi compat routes (source=wakapi) |
WAKATIME_API_KEY |
Optional (empty) | Server only | Optional personal WakaTime API key unlocking range=today for WAKATIME_OWNER_USERNAME; never exposed to browsers or URL params |
WAKATIME_OWNER_USERNAME |
Optional (empty) | Server (page.tsx + client.ts) |
Exact WakaTime username or UUID matching WAKATIME_API_KEY so today is enabled only for your own handle |
NEXT_PUBLIC_SITE_URL |
Optional (empty) | Build / Public | Public origin embedded into generated Studio URLs; falls back to x-forwarded-host / host headers when empty |
NEXT_PUBLIC_DEMO_USERNAME |
Owner demo ID | Build / Public | Default preview user loaded in Studio when the Username input is left blank |
NEXT_PUBLIC_DEMO_DISPLAY_NAME |
LianHarman |
Build / Public | Display name paired with NEXT_PUBLIC_DEMO_USERNAME when no custom display name is typed |
FEEDBACK_URL |
https://github.com/LienThuan04 |
Server | Destination URL for Studio's Coming soon tile and footer feedback link |
KV_REST_API_URL (UPSTASH_REDIS_REST_URL) |
Optional (empty) | Server only | Upstash Redis REST endpoint used for snapshot fallback caching (https:// or localhost http:// only) |
KV_REST_API_TOKEN (UPSTASH_REDIS_REST_TOKEN) |
Optional (empty) | Server only | Bearer token for Upstash Redis REST API |
WAKA_STORE |
On when URL + token set (off disables) |
Server | Set WAKA_STORE=off to disable Redis snapshot reads/writes explicitly |
- Push your fork or clone to GitHub and import the repository in Vercel.
- Ensure Node.js Version matches
24.x(package.jsonengines.node) andpnpm@12.21.0(packageManager) — Vercel usespnpm install --frozen-lockfileandpnpm buildautomatically. - Optional environment variables in Project Settings → Environment Variables:
-
NEXT_PUBLIC_DEMO_USERNAMEandNEXT_PUBLIC_DEMO_DISPLAY_NAME(your own default handle and display name in Studio). -
NEXT_PUBLIC_SITE_URL(your productionhttps://...domain). -
WAKATIME_API_KEYandWAKATIME_OWNER_USERNAMEif you wantrange=todayon your personal instance. -
KV_REST_API_URLandKV_REST_API_TOKEN(from Upstash Redis / Vercel Marketplace Redis integration) to serve cached snapshots during WakaTime202compiling responses.
-
- Smoke test after deploy:
-
/— loads Card Studio with empty Username/Display name fields. -
/api/YOUR_WAKATIME_USERNAME— returnsContent-Type: image/svg+xml; charset=utf-8with HTTP200. -
/api/YOUR_WAKATIME_USERNAME/stats— returns normalized JSON with HTTP200. -
/live/YOUR_WAKATIME_USERNAME— renders transparent live card.
-
Waka-TRACE ships preconfigured for OpenNext (@opennextjs/cloudflare) via wrangler.jsonc and open-next.config.ts:
pnpm preview # opennextjs-cloudflare build && preview locally in workerd
pnpm deploy # build & deploy Worker to CloudflareStore WAKATIME_API_KEY, KV_REST_API_URL, and KV_REST_API_TOKEN using wrangler secret put — never hardcode secrets inside wrangler.jsonc. Complete setup, custom domains, compatibility flags, and troubleshooting steps are in docs/DEPLOY-CLOUDFLARE.md.
GitHub proxies every external Markdown image through GitHub Camo, which enforces a short upstream fetch deadline (~4 seconds) and caches image responses downstream. Waka-TRACE pairs fast timeouts with a two-tier cache policy (src/lib/cache-policy.ts):
| Response state |
Cache-Control header |
Behavior |
|---|---|---|
Complete snapshot (result.complete === true) |
public, max-age=0, s-maxage=300, stale-while-revalidate=3600 |
Browsers revalidate immediately; edge CDN serves warm snapshots for 5 minutes (300s) and can serve stale for 1 hour (3600s) while refreshing asynchronously so Camo never blocks |
Partial / Cached fallback / Compiling / Error (result.complete === false) |
public, max-age=0, s-maxage=30 |
Short 30-second edge TTL without stale-while-revalidate so private toggle changes, finished 202 compilations, or recovered upstreams clear rapidly |
Resilience details (src/lib/waka/client.ts & src/lib/waka/stats-store.ts):
- Upstream WakaTime/Wakapi fetches abort cleanly at
4000ms(UPSTREAM_TIMEOUT_MS), protecting GitHub Camo from gateway timeouts. - When optional Upstash Redis REST env vars are present (
KV_REST_API_URL/UPSTASH_REDIS_REST_*), every successful snapshot is written under keywaka-trace:v1:{source}:{username}:{range}with a 7-day TTL (604800s, fail-open1500mstimeout). - If WakaTime returns HTTP
202(compiling), HTTP5xx, an unreadable payload, or times out, Waka-TRACE serves the cached Redis snapshot (fromCache: true,complete: false, 30s edge TTL) instead of degrading to an error card.
Inspect live headers and payload size directly with curl:
curl -sI "https://your-deployment.vercel.app/api/YOUR_WAKATIME_USERNAME?theme=editorial"Every Waka-TRACE theme renders clean vector primitives and CSS variables without base64 bitmaps or embedded webfont blobs. Measured offline example sizes (public/examples/manifest.json):
-
badgepill: ~5.8 KB (5,836 B) -
compactstrip: ~8.0 KB (8,025 B) -
terminalcard: ~9.3 KB (9,260 B) - Standard full themes (
editorial,bento,glass,wave,neon,mesh,blueprint): ~13.6–15.5 KB -
editorialwithlang_icon=svg(5 inlinethesvglanguage vectors): ~20.2 KB (20,175 B)
Practical tips for fast README loads:
- Keep
lang_icon=dot(default) when embedding several full cards side by side, or uselang_icon=svgselectively on your hero card (still ~20 KB, well inside GitHub Camo limits). - Use
theme=compactortheme=badgeinside profile README badges or dense dashboard grids. - Omit options equal to their defaults (
theme=editorial&mode=darketc.) — Card Studio strips default parameters automatically to keep URLs clean. - Keep
hide_projects=true(default) unless showcasing project breakdowns, and passanimated=falsewhen preferring zero CSS animation overhead.
Card notice: Profile stats are private (status: "private", triggered on HTTP 401/403 or is_coding_activity_visible === false).
- Open WakaTime Settings → Profile.
- Enable both:
- Display code time publicly
- Display languages, editors, os, categories publicly
- Save profile settings and wait up to 30–60 seconds for edge cache (
s-maxage=30) to clear.
Card notice: No public coding activity yet (status: "empty", totalSeconds <= 0 and languages.length === 0).
- Brand-new WakaTime accounts or newly enabled public stats often report
0seconds until WakaTime finishes aggregating the first completed day in your public range. - Keep coding with the WakaTime plugin active, or verify whether your WakaTime account's public profile range matches an active window. Meanwhile, click Sample Data in Card Studio to design your card styling.
Card notice: Compiling coding stats (status: "compiling", HTTP 202 or is_up_to_date === false with zero metrics).
- WakaTime calculates statistics lazily when an uncached range is requested for the first time.
- Wait 1–2 minutes and refresh. Self-hosters who configure Upstash Redis (
KV_REST_API_URL/KV_REST_API_TOKEN) automatically serve the previous cached snapshot while WakaTime finishes compiling.
- WakaTime returns HTTP
400if?range=last_30_days(or another explicit range) is requested while your WakaTime public settings only expose a different window (for instancelast_7_daysorall_time). - Waka-TRACE detects
"time range"HTTP400responses automatically and retries/users/{username}/stats(range=auto), returning your configured public window seamlessly. To show another range on public profiles, change the public range inside WakaTime Settings.
-
todayis intentionally hidden unless all three conditions hold:source=wakatime, server env varsWAKATIME_API_KEY+WAKATIME_OWNER_USERNAMEare both set, and the active handle in Studio matchesWAKATIME_OWNER_USERNAME. - Double-check whether your WakaTime account uses a UUID User ID instead of a public username alias (
WAKATIME_OWNER_USERNAMEmust match the exact handle or UUID). - If deploying for personal use, configure both variables on Vercel or Cloudflare Workers and redeploy.
Card notice: WakaTime user not found (status: "not_found", HTTP 404).
- Verify spelling at
https://wakatime.com/@YOUR_USERNAME. - If you never claimed a WakaTime
@usernamealias, paste your UUID User ID instead (found in your WakaTime Profile URL or Account Settings).
Card notice: Invalid username (status: "invalid_username").
- Ensure the path segment
/api/{username}only usesA–Z,a–z,0–9,.,_, or-(1–64characters). Leading@is stripped cleanly in Studio and API helpers.
- Check
/api/YOUR_WAKATIME_USERNAMEdirectly in your browser. If it displays cleanly there, GitHub Camo is simply serving an older cached snapshot (s-maxage=300, SWR3600s+ Camo proxy TTL). Wait a few minutes or purge Camo by appending/removing a benign option change when updating your README. - Verify no reverse proxy or deployment protection (such as Vercel Deployment Protection SSO) intercepts anonymous GitHub Camo requests to
/api/*.
- Ensure you copied the entire Live iframe snippet including the inline
<script>. - Verify the listener checks
new URL(frame.src).originandframe.contentWindow— if a reverse proxy rewrites thesrchost or if an intermediate wrapper stripspostMessage, height updates (wt:height) are ignored for safety.
Prerequisites: Node.js 24.x, pnpm@12.21.0 (run pnpm.cmd on Windows PowerShell), and Python 3 (for doc/anchor link checking).
| Command | Purpose |
|---|---|
pnpm dev |
Start Next.js development server at http://localhost:3000
|
pnpm lint |
Run ESLint across all TypeScript/React/config files |
pnpm typecheck |
Run TypeScript typechecking (tsc --noEmit) |
pnpm test |
Execute full Vitest unit & integration suite (tests/*.test.ts[x]) |
pnpm examples |
Regenerate all 56 deterministic offline SVGs, public/examples/index.html, and public/examples/manifest.json
|
pnpm build |
Build production Next.js app (Vercel / Node) |
pnpm start |
Serve production Next.js build |
pnpm preview |
Build and preview locally on Cloudflare Workers runtime (opennextjs-cloudflare) |
pnpm deploy |
Build and deploy to Cloudflare Workers (opennextjs-cloudflare) |
python scripts/check-doc-links.py |
Validate all local paths, anchors, and repository image references across README.md, wiki/Home.md, and docs/DEPLOY-CLOUDFLARE.md (--remote checks live URLs too) |
scripts/generate-examples.ts renders 56 deterministic offline SVG fixtures without network calls:
-
20 theme dark/light previews (
10 themes × 2 modes) -
4 showcase states (
editorial-projects-dark,editorial-empty-dark,editorial-private-dark,wave-js-contrast-dark) -
32 style axis previews (
6chart_style,1lang_icon=svg,14pattern,6border,5font)
Output writes to public/examples/ with exact dimensions, byte weights, and SHA-256 checksums recorded in public/examples/manifest.json. Every generated SVG is validated by tests/examples.test.ts for strict XML well-formedness (@xmldom/xmldom), zero external http:///https:// image URLs, and consistent dimensions.
Follow docs/THEME-CONTRACT.md and docs/DESIGN.md:
- Implement
src/card/themes/<name>.tsxwith pure rendering (target: "svg" | "live"), deterministicmeasure(),IdeMark,LanguageMarker,<StyleLayers />, and explicitsupportedParams. - Register the theme in
src/lib/options.ts(THEME_CHOICES) andsrc/card/theme-registry.ts(themes&THEME_WIDTHS), plus its Studio blurb insrc/components/studio/CardStudio.tsx. - Add test coverage in
tests/themes.test.tsxandtests/registry.test.ts(including light/dark contrast, hide flags, project rows, and notice states). - Run
pnpm examples,pnpm lint,pnpm typecheck,pnpm test,python scripts/check-doc-links.py, andpnpm build, then updateREADME.mdand this wiki page.
- Architecture & Design Spec
- Theme Contract
- Editorial Design System
- Cloudflare Workers Deploy Guide
-
GitHub Actions CI Workflow (
quality,buildfor Vercel & Cloudflare Workers, andaudit)
More themes and telemetry integrations are always welcome. Suggest a new theme layout, pattern, language alias, IDE mark, or bug fix through:
- Open an Issue (using the Bug Report or Theme / Feature Request forms)
- LianHarman(LienThuan04) on GitHub
- Card Studio's Coming soon tile and footer Suggest a theme or feature link (
FEEDBACK_URL)