This document explains how a request flows through the SVG rendering pipeline.
flowchart TD
A[Client Request] --> B[app/api/streak/route.ts]
B --> C[lib/github.ts]
C --> D[lib/calculate.ts]
D --> E[lib/svg/generator.ts]
E --> F[SVG Response]
File: app/api/streak/route.ts
Receives incoming requests and handles request validation. It acts as the entry point for the SVG generation pipeline.
File: lib/github.ts
Fetches contribution and activity data from GitHub APIs and prepares the required information.
File: lib/calculate.ts
Processes fetched data and calculates statistics such as contribution streaks and related values.
File: lib/svg/generator.ts
Converts processed data into SVG elements and generates the final visual output.
Caching reduces repeated API requests and improves performance.
The system can cache GitHub responses and calculated results to:
- Reduce unnecessary API calls
- Improve response speed
- Reduce server load
- Prevent repeated processing for frequently requested data
Pipeline flow:
- Client sends request
- API route receives request
- GitHub data is fetched
- Data calculations are performed
- SVG is generated
- Response is returned