LulaEdge – An open-source sharding orchestrator for Cloudflare D1

rodmanLula1 pts0 comments

GitHub - RodrigoManzanares/LulaEdge: Distributed SQL orchestration for Cloudflare D1. Plug and play edge sharding · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

RodrigoManzanares

LulaEdge

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>15 Commits<br>15 Commits

scripts

scripts

src

src

.env.example

.env.example

.gitignore

.gitignore

README.md

README.md

package-lock.json

package-lock.json

package.json

package.json

View all files

Repository files navigation

LulaEdge

Query hundreds of Cloudflare D1 databases as if they were a single relational system

LulaEdge orchestrates distributed SQL execution entirely inside your Cloudflare account using Cloudflare Workers

Why LulaEdge?

Keep data geographically local

Query globally across shards

Avoid centralized Postgres infrastructure

Built entirely on Cloudflare Workers

Designed for multi-tenant and AI workloads

How it works

Engine The LulaEdge engine only generates signed execution plans. Data queries execute entirely inside your Cloudflare account.

Your cluster (deployed by this script) --> Orchestrator + Executors live in your Cloudflare account. Only they talk to your D1 shards.

Your App → Engine (sign plan) → Orchestrator (execute) → Executors → D1 Shards

sql<br>SELECT region, SUM(revenue)<br>FROM tenant_orders<br>GROUP BY region

Execute across 100+ distributed D1 shards in parallel.

Quick Start

Prerequisites

Cloudflare account with D1 databases (your shards)

Node.js 18+

Cloudflare token permissions:

Account - Workers Scripts - Edit

Account - D1 - Edit

Account - Account Settings Read (Optional, but helps to Wrangler)

1. Clone and install

git clone https://github.com/your-org/lulaedge.git<br>cd lulaedge<br>npm install

2. Configure

.env<br># Edit .env with your Cloudflare credentials: CF_ACCOUNT_ID and CLOUDFLARE_API_TOKEN

3. Deploy

node scripts/deploy.js

That's it. The script will:

Detect all your D1 databases

Deploy executor workers

Deploy the orchestrator

Register you with the LulaEdge Engine

Print your orchestrator URL

Print your lulaEdge API_KEY

4. Open the console

Go to lulaedgeui.pages.dev and paste your orchestrator URL and API_KEY

Strategies

Strategy<br>What it does

join<br>Fetch rows from master DB, look them up across all shards

agg<br>SUM / AVG / COUNT / MIN / MAX across all shards

scatter<br>Broadcast a SELECT to all shards and collect results

migrate<br>Add / Rename column across all shards

telemetry<br>Get global telemetry across all shards checking the Capacity, Status, Latency...

Architecture

Your Cloudflare Account<br>└── Orchestrator Worker<br>├── D1: lulaedge-catalog (shard map, ranges,...)<br>└── Service bindings to Executors

└── Executor Workers<br>└── Service bindings to D1 shards

Limits (Free / Beta)

50 queries/day

100 shards

Security

Your data never leaves your account. Executors talk only to your D1 shards.

About

Distributed SQL orchestration for Cloudflare D1. Plug and play edge sharding

Resources

Readme

Uh oh!

There was an error while loading. Please reload this page.

Activity

Stars

star

Watchers

watching

Forks

forks

Report repository

Releases

No releases published

Packages

Uh oh!

There was an error while loading. Please reload this page.

Contributors

Uh oh!

There was an error while loading. Please reload this page.

Languages

JavaScript<br>100.0%

You can’t perform that action at this time.

cloudflare shards lulaedge account orchestrator reload

Related Articles