Skip to main content

API Overview

GitAscii provides both an HTTP API deployed on Next.js serverless edge functions and a headless TypeScript engine in src/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:
  • stats \rightarrow stats, github-readme-stats, metrics-card, terminal-info
  • streak \rightarrow streak-stats, asciiprofile-heatmap, godprofile-trophies
  • languages \rightarrow languages, tech-stack
  • stack \rightarrow tech-stack, codeweb-retro-grid, godprofile-neural
  • ascii \rightarrow ascii-art, ascii-text, asciiprofile-portrait, asciiprofile-info
  • terminal \rightarrow terminal-info, godprofile-terminal
  • avatar \rightarrow avatar, asciiprofile-portrait
  • bio \rightarrow bio, terminal-info
  • snake \rightarrow contribution-snake
  • trophies \rightarrow godprofile-trophies, profile-trophy
  • views \rightarrow views-counter
  • quotes \rightarrow readme-quotes

Caching & ETag Strategy

Responses served by generateProfileSvgResponse implement aggressive caching and ETag revalidation for GitHub’s Camo CDN proxy:
  • Cache Hits: If the client sends an If-None-Match header matching the computed SVG hash, the endpoint immediately responds with 304 Not Modified with zero body transfer.
  • Degraded Cache: If an external widget failed to load, s-maxage drops to 300 (5 minutes) to retry quickly without poisoning CDNs.