API Overview
GitAscii provides both an HTTP API deployed on Next.js serverless edge functions and a headless TypeScript engine insrc/engine/.
HTTP Endpoints
Query Parameters for SVG Endpoints
Every SVG route supports query parameters to override theme, template, and widget selection on the fly:'dark' | 'light'
default:"dark"
Sets the global color mode. When set to
light, the background switches to pure #ffffff and default text to dark tones.string
default:"terminal"
Applies a preset template style ID if no custom profile configuration is found on storage.
Supported presets:
blank, terminal, minimal, dracula, synthwave, tokyonight, gruvbox, bento, githubdark, nordic, hackerspace, contributor, galaxy, devcard.string
default:"undefined"
Comma-separated list of widget IDs or aliases to isolate.
When provided, the engine shrink-wraps the output SVG viewBox to only encapsulate the targeted widgets.Aliases supported:
statsstats,github-readme-stats,metrics-card,terminal-infostreakstreak-stats,asciiprofile-heatmap,godprofile-trophieslanguageslanguages,tech-stackstacktech-stack,codeweb-retro-grid,godprofile-neuralasciiascii-art,ascii-text,asciiprofile-portrait,asciiprofile-infoterminalterminal-info,godprofile-terminalavataravatar,asciiprofile-portraitbiobio,terminal-infosnakecontribution-snaketrophiesgodprofile-trophies,profile-trophyviewsviews-counterquotesreadme-quotes
Caching & ETag Strategy
Responses served bygenerateProfileSvgResponse implement aggressive caching and ETag revalidation for GitHub’s Camo CDN proxy:
- Cache Hits: If the client sends an
If-None-Matchheader matching the computed SVG hash, the endpoint immediately responds with304 Not Modifiedwith zero body transfer. - Degraded Cache: If an external widget failed to load,
s-maxagedrops to300(5 minutes) to retry quickly without poisoning CDNs.