Skip to content

ajisth69/clashdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clash DB 🟢

License: MIT Version Maintenance Deploy with Vercel

A high-performance, schema-less JSON storage proxy optimized for Vercel Edge Functions and Upstash Redis. Clash DB eliminates the need for complex database drivers and ORMs in lightweight projects, providing a RESTful bridge to high-speed KV storage.

🚀 Why Clash DB?

Modern serverless applications often need simple state persistence without the overhead of a full SQL or NoSQL cluster. Clash DB provides:

  • Zero-Latency Logic: Designed to run on Vercel Edge for minimal overhead.
  • RESTful Simplicity: Pure HTTP interface; compatible with any language (JS, Python, Go, Rust, etc.).
  • Visual Control: Built-in hacker-themed dashboard for real-time data exploration.
  • Enterprise-Ready: Includes modular asset management and built-in security standards.

✨ Features

  • Instant Routing: URL paths automatically map to Redis keys (e.g., POST /api/user/config saves to the user:config key).
  • Built-in Data Explorer: Comes with a sleek, dark-mode frontend GUI to view, search, edit, and nuke your database visually.
  • Advanced Endpoints: Includes _dump to get all records, _search for wildcard key matching, and _flush to nuke everything.
  • CORS Enabled: Call it from any web app, browser, or script without cross-origin policy errors.
  • Secure: Every request is protected by a single x-api-key.

One-Click Deployment

  1. Click the Deploy with Vercel button above.
  2. Vercel will prompt you to add an Environment Variable: MASTER_API_KEY. Set this to a secure string (e.g., clash_secret_2026).
  3. Once the initial deployment finishes, go to the Storage tab in your Vercel project dashboard.
  4. Scroll down to Marketplace Database Providers and click Create next to Upstash.
  5. CRITICAL STEP: When prompted for the "Custom Environment Variable Prefix", you MUST set it to exactly: UPSTASH_REDIS_REST.
  6. Click "Connect Project".
  7. CRITICAL STEP: Go to the Deployments tab in Vercel, click the three dots on your latest deployment, and hit Redeploy. Environment variables never apply to live code until you build a fresh deployment!

API Usage

Always include your master key in the headers: x-api-key: your_master_key_here

Core Operations

  • Save Data: POST /api/path/to/key (Body: JSON or Text)
  • Get Data: GET /api/path/to/key
  • Delete Data: DELETE /api/path/to/key

Management Endpoints

  • Dump All Data: GET /api/_dump (Returns a JSON object of the entire DB)
  • Search Keys: GET /api/_search?q=pattern (Returns keys matching *pattern*)
  • Flush Database: DELETE /api/_flush (Wipes the entire DB clean)

Quick Examples

JavaScript (Fetch)

const url = 'https://your-domain.vercel.app/api/bot/config';
const headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'your-master-key'
};

// Save
await fetch(url, { method: 'POST', headers, body: JSON.stringify({ active: true }) });

// Read
const data = await fetch(url, { headers }).then(r => r.json());
console.log(data);

Python (Requests)

import requests

url = 'https://your-domain.vercel.app/api/bot/config'
headers = {'x-api-key': 'your-master-key'}

# Save
requests.post(url, json={'active': True}, headers=headers)

# Read
data = requests.get(url, headers=headers).json()
print(data)

Built between JEE mock tests by Ajisth (@ajisth69).

About

An efficient, no sql , json based , upstash highly scalable data management and storage system acting as the backbone for high-demand applications.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors