Skip to content
WeftshPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Weft Deploy

Vercel simplicity on your own servers. weft.sh

Weft Deploy is an app platform that runs on servers you bring: any Linux box you can reach over SSH, with storage in your own S3-compatible bucket (or local disk). Sign in with GitHub, connect a server, pick a repo, get a URL. Every branch gets a preview protected by GitHub sign-in. Idle apps freeze to storage and wake on the next request, so one small server holds many projects.

Status: pre-alpha. A deploy is built on your server and served by its router, over HTTPS with certificates it gets itself. Idle previews freeze and wake, and apps get more replicas as traffic grows. Not yet: managed DNS, containers, apps moving between servers.

How it fits together

Two Rust binaries do the work:

  • The control plane holds accounts, projects, deployments and domains. It never runs your code. If it goes down, deploys pause and every app keeps serving.
  • The agent runs on each of your servers and dials out to the control plane. It builds your apps, runs them in containers (functions in isolates), routes and authenticates traffic, issues certificates, and freezes idle apps to your bucket.

SSH is used once to install the agent, then only for OS upgrades and break-glass.

Roadmap

Phase What ships Gate to move on
0. Spikes Checkpoint/restore on small servers, SSH install and outbound agent, isolate functions, TLA+ models Wake p95 under 2 s, or a spin-down fallback chosen
1. Core deploy Control plane, SSH connector, agent, router, domains and TLS, CLI, GitHub App, builds on your servers Server connected to a live URL in under 5 minutes
2. Previews and lifecycle Zero-trust previews, freeze and wake, rollback, streaming logs, dashboard, MCP server, bring-your-own S3 Every v1 user promise passes
3. Hosted beta Per-server billing, managed DNS, signed staged agent updates, autoscaling on DigitalOcean, Hetzner and Vultr 30 days on staging with chaos runs passing
4. GA External pentest, upgrade tests, docs GA gates met

Try it

Everything runs on one machine: the control plane, an agent that builds deploys, and the router that serves them (plain HTTP for now: TLS and DNS come next). The control plane keeps its data in memory unless you set WEFT_DATABASE_URL to a Postgres database, which it migrates at start, and WEFT_SECRET_KEY (openssl rand -hex 32) to seal environment variables under.

export WEFT_TOKEN=$(openssl rand -hex 32) WEFT_AGENT_TOKEN=$(openssl rand -hex 32)
cargo run -p weft-control-plane &                                  # the API on 127.0.0.1:4700
WEFT_DATA_DIR=/tmp/weft cargo run -p weft-router &                 # serves builds on 127.0.0.1:8080
WEFT_CONTROL_PLANE=http://127.0.0.1:4700 WEFT_SERVER_ID=srv_laptop WEFT_DATA_DIR=/tmp/weft \
  cargo run -p weft-agent &                                        # claims builds, clones, runs them
cargo run -p weft-cli -- projects create hello --repo <owner>/<a public repo>
cargo run -p weft-cli -- deploy hello --dry-run                    # where it would build, its URL, what it replaces
cargo run -p weft-cli -- deploy hello
curl -H "Host: hello.weft.localhost" http://127.0.0.1:8080/        # the build, with its own redirects and headers

To connect a real server, cargo run -p weft-cli -- servers connect <host> [--user deploy] makes it an SSH key of its own (the private half sealed, never shown) and prints the line that adds the public half to the server. Then weft servers install <id> connects over SSH with that key, checks the server (Ubuntu 22.04+ or Debian 12+ on x86-64 or arm64, systemd, root or passwordless sudo, for now: decision 0016) and installs nothing on one that fails, saying what to change. On one that passes it runs the install script as root: the agent and router as systemd services (the router on port 80), and the agent dials out. The server's own SSH key is kept the first time, and a server that presents another later is sent nothing. weft servers install-script <id> | ssh root@<host> bash does the same by hand. Each server's agent gets a key of its own, naming its team and itself, signed by the control plane: it acts as that server and no other, and sees only its own team's work (decision 0041). WEFT_AGENT_TOKEN is the operator's own, for an agent started by hand as above, and is never written onto a server. It downloads a release, which the hand-started Release workflow publishes; set WEFT_RELEASES_URL and WEFT_RELEASE_VERSION to use your own builds.

With several servers, each app (a project's production, or its previews) is placed on the one with the most free memory when it is first built, and is built and served only there from then on (decision 0024). weft servers list shows each server's memory, what its apps set aside, and which apps it holds. Agents report their server's memory; WEFT_MEMORY_MB on an agent offers apps less than the whole server. A server takes production apps, previews and builds until you say otherwise: weft servers label srv_2 preview keeps production off it.

To let Weft create servers in your own cloud account instead (decision 0021): HCLOUD_TOKEN=... weft clouds connect hetzner --region fsn1 --max-servers 3 (or digitalocean with DIGITALOCEAN_TOKEN, vultr with VULTR_API_KEY; the token can also be piped in), then weft servers create hetzner. The server installs Weft on its first boot with cloud-init, no SSH, and shows as provisioning until its agent calls; weft servers destroy <id> removes it. Weft never runs more than the account's limit, and lists and removes only servers it made. To reach a provider's API through a proxy, set WEFT_DIGITALOCEAN_API_URL, WEFT_HETZNER_API_URL or WEFT_VULTR_API_URL on the control plane; the e2e stack points Hetzner's at a stand-in (tools/e2e/cloud.mjs).

Scaling works at two levels. First, an app gets more replicas on its own server as traffic grows (decision 0035). The router sends each request to the replica with the fewest in flight, and the agent runs enough replicas that none has more than eight at the busiest moment of the last ten seconds. It adds them at once, up to eight or what the server's memory fits, and removes them one a minute once traffic is calm. A deploy starts as many replicas as production runs, and the old ones leave only once the router has let go of them, so no request is dropped. Workers run once, and crons fire once, however many replicas there are.

A server that comes back with a new data folder (a disk replaced, the server reinstalled) builds its apps again by itself (decision 0036). It tells the control plane which routed revisions it has no build for, and each is built there from the commit it was deployed at, so it serves the same code; the deployments are left as they were.

Second, a connected account is autoscaled (decision 0025): every half minute the control plane looks at the pool, and when apps set aside more than 80% of the memory on active servers, or a build waits for an app no server has room for, it adds a server there, within the limit. weft activity says what it did and why, with the figures, beside every change people made, under who made it (decision 0029). weft clouds scaling hetzner dry-run makes it only say what it would do (off leaves the account to you). When the load is low, a server Weft made that runs no apps is drained and then destroyed; one that runs apps is kept, since apps do not move between servers yet, and weft servers destroy refuses it too. Servers you connected yourself are never removed. A server whose agent has not called in 15 minutes after it was made is given up on and destroyed, and a server whose creation went unanswered keeps its place under the limit until the provider is asked what it holds, so nothing is billed unseen or made twice (decision 0038).

To deploy on every push, set WEFT_GITHUB_WEBHOOK_SECRET on the control plane and add a webhook to the repository on GitHub: payload URL https://<control plane>/v1/webhooks/github, content type application/json, the same secret, the push and pull request events. Each pushed branch deploys at its commit: main goes live when it is ready, other branches get their preview (decision 0007). Give the control plane WEFT_GITHUB_TOKEN (a fine-grained token with "Pull requests: write" on the repositories) and every open pull request gets one comment with its preview's link and how its build stands, edited as builds finish (decision 0032).

Configuration and secrets are environment variables, set for production, previews or both, kept encrypted, and given to builds and apps from the next deploy (decision 0006):

cargo run -p weft-cli -- env set hello DATABASE_URL postgres://...     # or pipe the value in, out of shell history
cargo run -p weft-cli -- env set hello DATABASE_URL x --dry-run        # what it would replace; nothing changes
cargo run -p weft-cli -- env list hello                                # names and environments, never values
cargo run -p weft-cli -- env pull hello --environment preview > .env

On your own machine, weft link shop ties a folder to a project (or weft link finds it from the git remote), so weft deploy, weft logs and weft env list there need no name, and weft dev runs the app with the project's preview variables at http://<branch>--shop.localhost, the command a deploy would find (devCommand or the framework's dev script) (decision 0033).

Production also answers on custom domains: cargo run -p weft-cli -- domains add hello www.example.com, then point the domain's DNS at the server. A domain belongs to one project, and the platform's own domains are never a project's to claim.

An installed server's router serves HTTPS on port 443 (WEFT_ROUTER_TLS_LISTEN) with certificates it gets itself from Let's Encrypt, answering the HTTP-01 challenge on port 80, for every host whose build it has; it renews them 30 days before they run out, and sends plain HTTP to HTTPS once a host has one (decision 0018). WEFT_ACME_DIRECTORY points it at another ACME authority. Names reserved for tests and local networks (.localhost, .test and the like) stay on plain HTTP.

Previews are closed to anyone the router cannot identify. With GitHub sign-in on, a browser opening a preview is sent to sign in, and the router lets in the team's members (decision 0014): it checks each request itself, from a grant the control plane signed for that preview and that browser, and the members in its latest routing table, so removing a member closes their previews within seconds. CI and coding agents open previews with a bypass token (decision 0009): cargo run -p weft-cli -- bypass create hello prints one, once; send it in the x-weft-protection-bypass header. Set WEFT_ROUTER_SCHEME=https on a router behind TLS.

Each project says who else may open its previews (decision 0019): weft access allow shop org:acme (or team:acme/design, user:octocat), weft access deny shop team-members, and weft access protect-production shop on to ask for sign-in on production and its custom domains too. weft access show shop shows the policy; routers check it on every request. For a reviewer without GitHub, weft access allow shop share-links and then weft share shop --branch feature/login --days 3 prints a link to that preview that stops working when it runs out; denying share-links stops every link at once (decision 0020).

What every process prints is in one stream, with variables' values redacted (decision 0008): cargo run -p weft-cli -- logs hello --follow, or the get_logs MCP tool.

A repository needs no deploy config. Weft reads package.json and the lockfile, picks the package manager (npm, pnpm, Yarn or Bun) and the framework (Next.js, Astro, SvelteKit, React Router, Nuxt, Remix, Vite, Gatsby, Create React App, or a Node server with a start script), then installs, builds and serves it with that framework's preset, as Vercel does. A vercel.json or Procfile that leaves build settings out gets them from the same preset; what it sets always wins (decision 0011). A project in a monorepo names its directory, as Vercel's Root Directory does: weft projects create site --repo acme/monorepo --root-directory web/site (weft projects update changes it for the next deploy). Its config is read, its commands run and what it serves is found there.

A build that leaves .vercel/output (Vercel's Build Output API v3, which SvelteKit's adapter-vercel, Astro's @astrojs/vercel and Nuxt's Vercel preset write) is served from it, as Vercel would (decision 0023): its config.json routes decide between its static files, a redirect, and its Node functions, which run in one host process per deployment that the agent writes beside the build and freezes and wakes like any app. Edge functions run in that host too, under Node, until workerd does (decision 0027), and the deploy says so; middleware, prerender caching and route conditions are named on the deploy as not run yet.

A vercel.json with images gets Vercel's image optimisation from the router (decision 0022): /_vercel/image?url=/photo.png&w=640&q=75 answers the deployment's own image resized to one of its sizes, in WebP for browsers that take it, kept so each is made once. Images from the hosts its remotePatterns or domains allow are fetched once per deploy and optimised the same way, never from a private or local address whatever the patterns say (decision 0026).

A vercel.json's crons run as Vercel's do: at each time the schedule names (UTC), the agent on the server running production calls the cron's path with a GET through its router, as vercel-cron/1.0, with Authorization: Bearer <CRON_SECRET> when the project sets CRON_SECRET. Previews never run crons. A schedule missed while the server was down runs once when it is back; each call's answer is in the logs, from cron (decision 0012). The agent reaches its router at WEFT_ROUTER_URL (default http://127.0.0.1:8080).

A repository whose Procfile has a web: line is an app: the agent starts it with a PORT once it is built, the deploy goes live only when it listens there, and the router passes it every request its files do not answer. A release: line (migrations, say) runs after the build; if it fails, the deploy does not go live. A process that crashes is started again at once, then after 10s, 20s, 40s and up to five minutes while it keeps crashing; a minute up and it is forgiven. Until the containerd runtime lands, apps run as plain processes of the agent's user (decision 0005).

A preview nobody has opened for 15 minutes is frozen, so one small server holds many; production stays on (decision 0017). The next request for it, once its sign-in or bypass check has passed, is held while the agent starts it again, and then answered; a browser waiting more than 2 s is shown a page saying it is waking, which reloads itself. Set WEFT_FREEZE_PREVIEWS_AFTER on the control plane (minutes, or never) to change it. The router asks the agent beside it over <data>/agent.sock; while apps are processes, frozen means stopped.

People sign in with GitHub (decision 0013). Create a GitHub OAuth app whose callback is <WEFT_PUBLIC_URL>/v1/auth/github/callback, give the control plane WEFT_GITHUB_CLIENT_ID, WEFT_GITHUB_CLIENT_SECRET and WEFT_PUBLIC_URL, and add the team's members by GitHub login with the operator's token: cargo run -p weft-cli -- members add <login>. On GitHub Enterprise Server, set WEFT_GITHUB_URL and WEFT_GITHUB_API_URL (https://github.example.com and .../api/v3) as well. A member then runs weft login, signs in in the browser, and the CLI keeps a token of their own (in ~/.config/weft/credentials.json). Anyone can sign in with GitHub, but only members get a token, and removing a member stops their token on its next use. A control plane open to everyone, as the hosted one is, sets WEFT_OPEN_SIGN_UP=1: then someone who signs in and is on no team gets a team of their own, named for their login, as its first member, and connects their own servers to it (decision 0041). Without it, only people a member adds may act.

A browser signed in with GitHub uses the API with its session, as the dashboard does (decision 0042): a member's session acts for their team, a change it asks for must come from the control plane's own pages (another site's is refused with 403), and POST /v1/auth/sign-out ends it everywhere. Point WEFT_DASHBOARD_DIR at the dashboard's built files (pnpm --dir web/dashboard build makes web/dashboard/out) and the control plane serves them at every path the API does not answer: a member signs in with GitHub and sees and makes their team's projects, through the same operations as the CLI and MCP. Someone signed in but on no team is told who can add them.

A coding agent gets a token of its own, which reaches one project, its previews only unless you say production too, for 30 days unless you say otherwise (decision 0030): weft tokens create --name claude --project shop prints it once (--reach production, --days 7). With it the agent can deploy branches, read logs, set preview variables and make preview bypass tokens; deploying the production branch, rolling back or touching another project is refused with exit code 4. weft tokens list shows what each token reaches and until when, weft tokens revoke <id> stops one at once, and weft activity names the agent token behind every change.

Any write can be sent again safely with an idempotency key (decision 0031): weft deploy shop --idempotency-key deploy-42 run twice deploys once and answers the same both times; MCP tools take idempotency_key, and the API reads the Idempotency-Key header. A different request under a used key is refused, and keys last a day.

Moving from Vercel: VERCEL_TOKEN=... cargo run -p weft-cli -- import vercel <project> makes a Weft project with the Vercel project's repository and root directory, sets its variables for production and previews, and adds its custom domains (decision 0015). What cannot carry over is listed with what to do instead: values Vercel keeps sensitive, development-only variables, *.vercel.app addresses, and build settings made on Vercel's dashboard rather than in vercel.json. The token is used for that import and never kept. To reach Vercel's API elsewhere, set WEFT_VERCEL_API_URL; the e2e stack points it at a stand-in (tools/e2e/vercel.mjs).

A hosted control plane given WEFT_POSTHOG_KEY sends product analytics to PostHog (decision 0028): every operation by its contract id, and the funnel's sign-in (with the site's UTM and referrer), first server and live URL, by team and never by person. Without the key nothing is sent anywhere.

Coding agents get the same operations as MCP tools: add weft mcp as a stdio MCP server (with WEFT_API_URL and WEFT_TOKEN in its environment) to Claude Code or any MCP client. The agent skill in skills/weft/SKILL.md (copy the folder into .claude/skills/ in a project, or ~/.claude/skills/) teaches an agent the loop: deploy a branch, wait for it, read why it failed, fix, redeploy, and test the preview with a bypass token. Its tests fail if it shows a command the CLI does not take or a tool weft mcp does not serve.

Every command takes --json, and exit codes say what happened: 0 success, 2 usage, 3 invalid input, 4 unauthorized, 5 not found, 6 conflict, 7 control plane unreachable.

Building

cargo xtask gates   # every gate CI runs

You need Rust (rustup installs the version pinned in rust-toolchain.toml), and for the full set of gates cargo-nextest, cargo-deny, Java 11+ (for the TLA+ model checker) and Postgres (the gates start a throwaway server for the Postgres adapter's tests). The marketing site, weft.sh, lives in web/site (Astro); its gate needs Node 22, pnpm and Google Chrome (web/site/README.md). CLAUDE.md is the working guide for people and agents: architecture, the development flow, testing standards and the gates.

License

Weft is available under the Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2). You can use, modify and self-host it for any purpose other than offering a competing commercial service. Each release becomes available under the Apache License 2.0 two years after it is published.

Contributions are welcome; we will ask external contributors to sign a contributor license agreement on their first pull request.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages