Skip to content

elydelva/stashless

Repository files navigation

Stashless Logo

Stashless

Blazingly fast Redis-over-HTTP adapter - Self-hosted alternative to Upstash, built with Rust.

License: MIT Rust Upstash Compatible CI CD

Why Stashless?

Ever wanted to use Redis from edge functions or serverless environments but hit walls? Services like Upstash work, but they lock you in and can get expensive at scale.

Stashless is a self-hosted HTTP adapter for Redis that's fully compatible with the Upstash SDK. Get the same API without vendor lock-in or per-request pricing. Just pure Redis performance over HTTP.

Use it for:

  • Edge functions (Cloudflare Workers, Vercel Edge)
  • Serverless environments (Lambda, Cloud Functions)
  • Local development with Upstash-compatible apps
  • Anywhere you need Redis over HTTP

Installation

Quick Start with Docker Standalone

If you already have Redis running:

# Pull the image
docker pull ghcr.io/elydelva/stashless:latest

# Run the container
docker run -d \
  -p 3000:3000 \
  -e SLASHLESS_REDIS_HOST=your-redis-host \
  -e SLASHLESS_REDIS_PORT=6379 \
  -e SLASHLESS_TOKEN=your-secret-token \
  ghcr.io/elydelva/stashless:latest

That's it! The API is available at http://localhost:3000.

Docker Compose

git clone https://github.com/elydelva/slashless.git
cd slashless

# Set your token
export SLASHLESS_TOKEN=your-secret-token-here

# Start everything
docker-compose up -d

From Source

git clone https://github.com/elydelva/slashless.git
cd slashless
cargo build --release

# Set environment variables
export SLASHLESS_REDIS_HOST=127.0.0.1
export SLASHLESS_REDIS_PORT=6379
export SLASHLESS_TOKEN=your-secret-token

# Run
./target/release/stashless

Configuration

All configuration is done via environment variables. Only SLASHLESS_TOKEN is required.

Creating a New Configuration

To create a new configuration, you can use a .env file in your project root:

# Generate a secure token first (or use stashless generate-token)
# Then create a .env file:

cat > .env << EOF
SLASHLESS_TOKEN=your-secret-token-here
SLASHLESS_REDIS_HOST=127.0.0.1
SLASHLESS_REDIS_PORT=6379
SLASHLESS_HOST=0.0.0.0
SLASHLESS_PORT=3000
SLASHLESS_MAX_CONNECTION=3
SLASHLESS_MAX_RETRY=-1
SLASHLESS_MODE=standard
EOF

Or use the stashless generate-token command to generate a secure token, then add it to your .env file.

Configuration Variables

Variable Default Description
SLASHLESS_REDIS_HOST 127.0.0.1 Redis host
SLASHLESS_REDIS_PORT 6379 Redis port
SLASHLESS_HOST 0.0.0.0 HTTP bind address
SLASHLESS_PORT 3000 HTTP port
SLASHLESS_TOKEN Required Bearer token for auth
SLASHLESS_MAX_CONNECTION 3 Connection pool size
SLASHLESS_MAX_RETRY -1 Maximum Redis connection retry attempts (-1 for unlimited)
SLASHLESS_MODE standard Console display mode (standard or rich)

Console Modes

Stashless supports two console display modes:

  • standard (default): Simple text-based output with standard logging. Best for production environments, CI/CD pipelines, and when running in the background.
  • rich: Enhanced terminal UI with real-time status updates, colored output, and interactive console. Best for local development and monitoring.

Set the mode using the SLASHLESS_MODE environment variable:

# Standard mode (default)
export SLASHLESS_MODE=standard

# Rich mode
export SLASHLESS_MODE=rich

You can also use a .env file - just export it before running.

Usage

With Upstash SDK (TypeScript/JavaScript)

Works exactly like Upstash:

import { Redis } from "@upstash/redis";

const redis = new Redis({
  url: "http://localhost:3000",
  token: "your-secret-token",
});

await redis.set("key", "value");
const value = await redis.get("key");

With curl

# Set a value
curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"command": "SET", "args": ["hello", "world"]}'

# Get a value
curl -X POST http://localhost:3000/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"command": "GET", "args": ["hello"]}'

Pipelines & Transactions

# Pipeline
curl -X POST http://localhost:3000/pipeline \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"commands": [{"command": "SET", "args": ["key1", "value1"]}]}'

# Transaction
curl -X POST http://localhost:3000/multi-exec \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"commands": [{"command": "INCR", "args": ["counter"]}]}'

Stashless supports all standard Redis commands - strings, lists, sets, hashes, sorted sets, keys, and transactions.

Contributing

Contributions welcome! Here's how:

  1. Fork and clone
  2. Create a branch: git checkout -b feature/your-feature
  3. Make your changes
  4. Run tests: cargo test && bun test
  5. Format code: cargo fmt && cargo clippy
  6. Commit following Conventional Commits
  7. Push and open a PR

License

MIT License - see LICENSE for details.

Copyright (c) 2024 Stashless Contributors

About

Blazingly fast Redis-over-HTTP adapter - Self-hosted alternative to Upstash

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors