How ravish-ranjan/encode works
This is an Express QR-code generation API with a small browser-facing frontend. Clients submit typed QR data through either the backward-compatible v1 routes or the shorter v2 routes; middleware parses and validates the request, generates or retrieves a PNG, and the controller returns it. The formatter supports the documented text/URL, contact, network, messaging, location, event, Bitcoin, and UPI formats. Redis is optional for image caching and rate-limit storage. The graph follows visible route and middleware wiring; frontend-to-API calls are not asserted because the sampled evidence does not establish them.
Main entry points: app.ts Express Application · qrv1.route.ts v1 Routes · qrv2.route.ts v2 Routes · cache.middleware.ts Image Cache
Components 16
HTTP API
- Express Application
src/app.ts - v1 Routes
src/routers/qrv1.route.ts - v2 Routes
src/routers/qrv2.route.ts - Request Parser
src/middlewares/parse.middleware.ts - Validation Errors
src/services/apperror.service.ts - PNG Response
src/controllers/qrcode.controller.ts
QR Generation
- Image Cache
src/middlewares/cache.middleware.ts - Payload Formatter
src/services/qrcode.service.ts - QRCode Library
Runtime Services
- Redis Client
src/configs/redis.ts - Redis Store
- Environment Config
src/configs/env.ts
Other components
- API Client
- Browser User
Connections 18
- API Client → Express Application: sends requests
README.md - Express Application → v1 Routes: mounts at /api
src/app.ts - Express Application → v2 Routes: mounts at /api/v2
src/app.ts - v1 Routes → Request Parser: parses requests
src/routers/qrv1.route.ts - v2 Routes → Request Parser: parses requests
src/routers/qrv2.route.ts - Request Parser → Validation Errors: creates errors
src/middlewares/parse.middleware.ts - v1 Routes → Image Cache: runs middleware
src/routers/qrv1.route.ts - v2 Routes → Image Cache: runs middleware
src/routers/qrv2.route.ts - v1 Routes → PNG Response: returns PNG
src/routers/qrv1.route.ts - v2 Routes → PNG Response: returns PNG
src/routers/qrv2.route.ts - Image Cache → Payload Formatter: generates image
src/middlewares/cache.middleware.ts - Payload Formatter → QRCode Library: encodes payload
src/services/qrcode.service.ts - Image Cache → Redis Client: reads and writes
src/middlewares/cache.middleware.ts - Redis Client → Redis Store: connects optionally
src/configs/redis.ts - Redis Client → Environment Config: reads settings
src/configs/redis.ts - Express Application → Redis Client: uses rate-limit store
src/app.ts - Express Application → Web UI: serves frontend
src/app.ts - Browser User → Web UI: opens interface