Skip to content

lazycache-com/lazycache

Repository files navigation

LazyCache Platform

An Upstash-like Redis-as-a-Service platform built on AWS

Go Version Node Version Terraform License


Overview

A fully-featured Redis-as-a-Service platform that enables users to provision and manage Redis databases through a REST API and web dashboard. The platform supports multi-region deployments, shared Redis pools for free-tier users, and dedicated instances for paid tiers.

Key Features

  • Multi-Region Support: Deploy across us-east-1, eu-central-1, and ap-southeast-1
  • Shared Redis Pool: Cost-effective solution for free-tier users with namespace isolation
  • Dedicated Instances: Isolated Redis clusters for paid tiers
  • REST API: Full HTTP API for Redis operations
  • TCP Proxy: Native Redis protocol support (Phase 2)
  • Auto-Scaling: Intelligent scaling based on usage metrics
  • Usage-Based Billing: Stripe integration for metered billing

Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                              Global Load Balancer                            │
│                          (Route53 + Global Accelerator)                      │
└─────────────────────────────────────────────────────────────────────────────┘
                    │                    │                    │
         ┌──────────┴────────┐ ┌─────────┴─────────┐ ┌───────┴──────────┐
         │    us-east-1      │ │   eu-central-1    │ │  ap-southeast-1  │
         │                   │ │                   │ │                  │
         │  ┌─────────────┐  │ │  ┌─────────────┐  │ │  ┌────────────┐  │
         │  │     ALB     │  │ │  │     ALB     │  │ │  │    ALB     │  │
         │  └──────┬──────┘  │ │  └──────┬──────┘  │ │  └─────┬──────┘  │
         │         │         │ │         │         │ │        │         │
         │  ┌──────┴──────┐  │ │  ┌──────┴──────┐  │ │  ┌─────┴──────┐  │
         │  │  ECS API    │  │ │  │  ECS API    │  │ │  │  ECS API   │  │
         │  │  Service    │  │ │  │  Service    │  │ │  │  Service   │  │
         │  └──────┬──────┘  │ │  └──────┬──────┘  │ │  └─────┬──────┘  │
         │         │         │ │         │         │ │        │         │
         │  ┌──────┴──────┐  │ │  ┌──────┴──────┐  │ │  ┌─────┴──────┐  │
         │  │ ElastiCache │  │ │  │ ElastiCache │  │ │  │ElastiCache │  │
         │  │   Redis     │  │ │  │   Redis     │  │ │  │  Redis     │  │
         │  └─────────────┘  │ │  └─────────────┘  │ │  └────────────┘  │
         │                   │ │                   │ │                  │
         └───────────────────┘ └───────────────────┘ └──────────────────┘
                                        │
                              ┌─────────┴─────────┐
                              │  RDS PostgreSQL   │
                              │  (Primary + RR)   │
                              └───────────────────┘

Project Structure

.
├── infrastructure/                 # Terraform IaC
│   └── terraform/
│       ├── environments/           # Environment-specific configs
│       │   ├── dev/
│       │   ├── staging/
│       │   └── prod/
│       └── modules/                # Reusable Terraform modules
│           ├── vpc/
│           ├── rds/
│           ├── elasticache/
│           └── s3/
│
├── services/
│   ├── api/                        # REST API (Go)
│   │   ├── cmd/api/                # Application entrypoint
│   │   ├── internal/
│   │   │   ├── handlers/           # HTTP handlers
│   │   │   ├── middleware/         # Auth, rate limiting
│   │   │   ├── models/             # Data models
│   │   │   ├── repository/         # Database layer
│   │   │   ├── services/           # Business logic
│   │   │   └── auth/               # JWT, password hashing
│   │   └── migrations/             # SQL migrations
│   │
│   ├── dashboard/                  # Web Dashboard (React + TypeScript)
│   │   ├── src/
│   │   │   ├── components/         # Reusable UI components
│   │   │   └── pages/              # Page components
│   │   └── public/
│   │
│   ├── worker/                     # Background Jobs (Go) [Planned]
│   ├── proxy/                      # TCP Redis Proxy (Go) [Planned]
│   └── orchestrator/               # Auto-scaling Service (Go) [Planned]
│
├── docs/                           # Documentation
│   ├── api/                        # OpenAPI specs
│   ├── guides/                     # User guides
│   └── examples/                   # SDK examples
│
├── scripts/                        # Utility scripts
│   ├── init-db.sql                 # Database initialization
│   └── dev-setup.sh                # Development setup script
│
├── docker-compose.yml              # Local development environment
├── Makefile                        # Build automation
└── TODO.md                         # Project roadmap and tasks

Tech Stack

Component Technology
Backend Go 1.21+ (Gin framework)
Frontend React 18 + TypeScript + TailwindCSS
Database PostgreSQL 15 (RDS)
Cache Redis 7.x (ElastiCache)
Infrastructure Terraform 1.6+, AWS ECS Fargate
Container Docker, Docker Compose
CI/CD GitHub Actions

Quick Start

Prerequisites

  • Go 1.21+
  • Node.js 20+
  • Docker & Docker Compose
  • Terraform 1.6+
  • AWS CLI (configured)

Local Development

  1. Clone the repository

    git clone git@github.com:canerdogan/upstash.git
    cd upstash
  2. Start the development environment

    make dev-up

    This starts:

    • PostgreSQL on localhost:5432
    • Redis on localhost:6380
    • MinIO (S3-compatible) on localhost:9000
    • Mailhog (email testing) on localhost:8025
  3. Run the API

    make api-run
  4. Run the Dashboard (in a separate terminal)

    make dashboard-install  # First time only
    make dashboard-dev
  5. Access the services

Available Commands

Run make help to see all available commands:

# Development
make dev-up              # Start local development environment
make dev-down            # Stop local development environment
make dev-logs            # Show development environment logs
make dev-reset           # Reset development environment (destroys data)

# API Service
make api-build           # Build API service
make api-run             # Run API service locally
make api-test            # Run API tests
make api-lint            # Lint API code

# Dashboard
make dashboard-install   # Install dashboard dependencies
make dashboard-dev       # Run dashboard in development mode
make dashboard-build     # Build dashboard for production

# Infrastructure
make tf-init             # Initialize Terraform
make tf-plan             # Plan Terraform changes
make tf-apply            # Apply Terraform changes

# Database
make db-migrate          # Run database migrations
make db-migrate-down     # Rollback last migration

API Endpoints

Authentication

Method Endpoint Description
POST /auth/register Register a new user
POST /auth/login Login and get JWT token
POST /auth/refresh Refresh JWT token
POST /auth/logout Logout and invalidate token

Databases

Method Endpoint Description
GET /databases List user's databases
POST /databases Create a new database
GET /databases/:id Get database details
DELETE /databases/:id Delete a database
POST /databases/:id/reset-password Reset database password

Redis Operations

Method Endpoint Description
POST /databases/:id/command Execute Redis command
POST /databases/:id/pipeline Execute pipeline commands
GET /databases/:id/get/:key Get a key value
POST /databases/:id/set Set a key value
DELETE /databases/:id/keys/:key Delete a key

Configuration

Environment Variables

API Service

Variable Description Default
ENV Environment (development/staging/production) development
PORT API server port 8080
DATABASE_URL PostgreSQL connection string -
REDIS_URL Redis connection string -
JWT_SECRET Secret key for JWT signing -
JWT_EXPIRY JWT token expiry duration 15m

Deployment

AWS Infrastructure

  1. Initialize Terraform

    make tf-init
  2. Review the plan

    make tf-plan
  3. Apply the infrastructure

    make tf-apply

CI/CD Pipeline

The project uses GitHub Actions for continuous integration and deployment:

  • On Push to main: Run tests, build Docker images, push to ECR, deploy to ECS
  • On Push to infrastructure/: Plan & apply Terraform (with approval)

Pricing Tiers

Tier Price Commands/mo Storage Connections
Free $0 500K 256MB 100
Hobby $5/mo 5M 1GB 500
Pro $29/mo 50M 10GB 2,000
Business $149/mo 500M 100GB 10,000

Development Roadmap

Phase 1: MVP (Week 1-8) - In Progress

  • Project structure and development environment
  • Core API with authentication
  • Database management endpoints
  • Shared Redis pool with namespace isolation
  • Dashboard UI
  • AWS infrastructure deployment

Phase 2: Monetization & TCP Proxy (Week 9-14)

  • Stripe billing integration
  • Usage-based billing
  • TCP proxy with RESP protocol
  • Dedicated instance provisioning

Phase 3: Production Hardening (Week 15-18)

  • Security audit and penetration testing
  • Load testing and chaos engineering
  • Disaster recovery procedures
  • SOC 2 preparation

Phase 4: Growth Features (Ongoing)

  • VPC peering
  • SSO/SAML support
  • Additional products (Kafka, Vector DB)

Contributing

This is currently a private project. See CONTRIBUTING.md for guidelines if you have access.


Security

For security concerns, please see SECURITY.md.


License

This project is proprietary software. All rights reserved.


Support

For questions or support, please contact the development team.

About

LazyCache - Serverless Redis Platform

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •