← All work
Tooling · 2025

Serverless Crypto Price API (AWS Lambda + Redis + CoinGecko)

Overview

A serverless REST API on AWS Lambda that serves real-time and historical cryptocurrency prices from CoinGecko, with Redis caching, token validation, and AWS-native configuration. It is the production-grade, AWS counterpart to the Cloudflare edge pricing proxy.

Why It Exists

Apps need fast, rate-limit-safe access to crypto market data without hammering or exposing the upstream provider. Wrapping CoinGecko in a cached, validated, throttled Lambda API gives clients a stable contract and protects the upstream key and quota.

What We Built

A TypeScript Serverless Framework v4 service with getPrices (/prices?tokens=BTC,ETH) and getHistorical (/historical?token=BTC&days=7) handlers, a coingecko.service, a redis.service for TTL caching, and config.service/logger.service. A tokenValidator enforces a whitelist; httpResponse and perfMetrics utilities standardise responses and timing. Infra is AWS-native: API Gateway with API keys and a 100 req/min usage-plan throttle, Parameter Store and Secrets Manager for config/secrets, and an ElastiCache Redis subnet group. Local development runs the full stack via Docker + LocalStack + serverless-offline, and the handlers and validator ship with Jest tests.

Technologies & Approach

TypeScript on Node 22 Lambdas, deployed with Serverless Framework v4. Redis provides cache-aside with configurable TTL; API Gateway handles rate limiting; Parameter Store/Secrets Manager keep config out of code. LocalStack mirrors AWS locally so the whole system, including Redis and Secrets Manager endpoints, runs offline.

Outcome / Impact

A well-structured, tested serverless API that demonstrates production AWS patterns end to end: caching, validation, throttling, secrets management, and a faithful local dev environment. Reusable as a template for any cached third-party data API.

Capabilities Demonstrated

  • Serverless REST APIs on AWS Lambda + API Gateway
  • Redis cache-aside with configurable TTL
  • AWS-native configuration and secrets (Parameter Store, Secrets Manager)
  • API Gateway API keys and rate limiting
  • Local IaC dev parity with Docker + LocalStack + serverless-offline
  • Unit-tested handlers and validators (Jest)
More work See all →