How kirasync2748/profile-pulse works
ProfilePulse serves GitHub profile view-count badges and a JSON count endpoint. A profile image request reaches either the standalone server or a Vercel entry point, then shared handlers validate parameters, atomically increment a Redis-backed counter, format the result, and render SVG or JSON. Health routes work without Redis; Upstash, local Redis, and no-op stores are selectable. The excerpts show the runtime wiring and principal stages; Vercel routing and some renderer details are documented but not independently inspected.
Main entry points: server.go Shared HTTP handlers · config.go Runtime configuration · badge.go Vercel badge route · count.go Vercel count route
Components 19
HTTP entry points
- Standalone server
cmd/server/main.go - Vercel badge route
api/badge/badge.go - Vercel count route
api/count/count.go - Vercel health route
api/health/health.go - Vercel root route
api/index/index.go
Request handling
- Shared HTTP handlers
internal/server/server.go - Input validation
internal/validation/validation.go - Runtime configuration
internal/config/config.go
Counting and storage
- Store selection
internal/server/server.go - Counter store contract
internal/counter/counter.go - Upstash REST store
internal/counter/redis.go - Local Redis store
internal/counter/redis.go - No-op store
internal/counter/counter.go
Response generation
- Count formatting
internal/badge/badge.go - SVG renderer
internal/badge/badge.go - JSON responses
internal/server/server.go
Other components
- Profile viewer
- Upstash Redis
- Local Redis
Connections 25
- Profile viewer → Vercel badge route: requests badge
README.md - Profile viewer → Vercel count route: requests count
README.md - Standalone server → Runtime configuration: loads config
cmd/server/main.go - Standalone server → Shared HTTP handlers: mounts handlers
cmd/server/main.go - Vercel badge route → Runtime configuration: loads config
api/badge/badge.go - Vercel badge route → Shared HTTP handlers: dispatches
api/badge/badge.go - Vercel count route → Runtime configuration: loads config
api/count/count.go - Vercel count route → Shared HTTP handlers: dispatches
api/count/count.go - Vercel health route → Runtime configuration: loads config
api/health/health.go - Vercel health route → Shared HTTP handlers: dispatches
api/health/health.go - Vercel root route → Runtime configuration: loads config
api/index/index.go - Vercel root route → Shared HTTP handlers: dispatches
api/index/index.go - Shared HTTP handlers → Input validation: validates inputs
internal/server/server.go - Shared HTTP handlers → Runtime configuration: parses base
internal/server/server.go - Shared HTTP handlers → Store selection: selects store
internal/server/server.go - Store selection → Upstash REST store: chooses first
internal/server/server.go - Store selection → Local Redis store: chooses next
internal/server/server.go - Store selection → No-op store: falls back
internal/server/server.go - Upstash REST store → Upstash Redis: sends INCR
internal/counter/redis.go - Local Redis store → Local Redis: increments key
internal/counter/redis.go - Shared HTTP handlers → Counter store contract: increments key
internal/server/server.go - Counter store contract → Count formatting: returns count
README.md - Shared HTTP handlers → Count formatting: formats count
internal/server/server.go - Shared HTTP handlers → SVG renderer: renders badge
internal/server/server.go - Shared HTTP handlers → JSON responses: encodes count
internal/server/server.go