crafyne
v0.6.0
Published
Deploy static sites, edge functions, and fullstack workers to Crafyne — HTTPS URL, one-click rollback.
Downloads
1,225
Maintainers
Readme
crafyne
CLI to deploy static sites, edge functions, and fullstack workers to Crafyne. Zero dependencies for static sites (needs Node 18+; edge functions need esbuild in your project).
Install
Install once, globally, so the crafyne command is available everywhere:
npm install -g crafyneOr skip the install — replace crafyne with npx -y crafyne in any command below.
Sign in (once, via the browser)
crafyne loginYour browser opens on crafyne.app — click Allow, done. The token is stored in ~/.crafyne/config.json.
No token copy-pasting.
Your sites are served from crafyne.site — a separate registrable domain from the dashboard, so your JavaScript never runs on the same origin as the Crafyne session cookie. A custom domain always wins if you've attached one.
Deploy (auto-build)
From a project folder (one with a package.json), Crafyne detects the framework, runs the build, and
uploads the output:
crafyne deploy→ • Detected: Vite → → Build: npm run build → ↑ Uploading … → ✓ Live at https://namek.crafyne.site.
No project yet? You don't need the dashboard. If the slug doesn't exist, the CLI offers to create it
(using the folder name as a first guess) and saves it to crafyne.json so the next deploy doesn't ask
again. In CI (no TTY), pass --create so nothing hangs.
Supported: Vite, Astro, Next (export), Nuxt, SvelteKit, CRA, Vue, Angular, Gatsby.
Already have a built folder (or a plain static site)? Skip the build:
crafyne deploy ./dist # upload the folder as-is
crafyne deploy --no-build # use ./dist without buildingIf output detection guesses wrong, say so: --output <dir>.
Edge functions (Pro plan)
Add a functions/ folder in your project root — each file becomes a serverless route, while everything
else stays static (and free to serve):
functions/api/contact.js → /api/contact
functions/api/rsvp/[id].js → /api/rsvp/[id] ([id] matches one path segment)Each file exports an onRequest handler:
export function onRequest({ request, env, params }) {
return Response.json({ ok: true, id: params.id });
}Deployed automatically on crafyne deploy. Requires esbuild in your project: npm i -D esbuild.
Fullstack / SSR (Pro plan)
Ship a real server worker. If your build produces a _worker.js in the output folder (the Cloudflare
adapter convention used by Astro SSR, SvelteKit, Qwik, and others), Crafyne deploys it as a fullstack
worker — every request runs your code, and the rest of the folder is served as fast, free static assets
via env.ASSETS:
export default {
async fetch(request, env) {
const url = new URL(request.url);
if (url.pathname === "/api/hello") return Response.json({ ok: true });
return env.ASSETS.fetch(request); // static files
},
};No _worker.js at the root? Point to it in crafyne.json: { "type": "worker", "main": "dist/_worker.js" }.
Preview before going live
crafyne deploy --previewThe deploy is still stored (immutable, with its own hash) but does not replace your live site. You get
https://namek--a1b2c3.crafyne.site to check first. Happy with it? Promote it:
crafyne deploys # version history (● = live)
crafyne rollback --deploy a1b2c3 # make that version liveCommands
| Command | What it does |
|---|---|
| crafyne login | sign in via the browser, store the token locally |
| crafyne logout | remove the saved credentials |
| crafyne whoami | show the signed-in account |
| crafyne deploy [folder] | build (optional) + upload; deploys functions/ and _worker.js too; creates the project if missing |
| crafyne deploy --preview | upload without going live |
| crafyne projects | list your projects and their URLs |
| crafyne deploys | version history of this project |
| crafyne rollback --deploy <hash> | make an older version live again |
| crafyne delete --project <slug> | delete a project and all its deploys (permanent) |
| crafyne open | open the site in your browser |
| crafyne --version | installed CLI version |
Deleting a project
crafyne delete --project blog7Deleting takes the site down and erases every deploy in its history — there is no undo. That's why the
confirmation asks you to retype the slug rather than press y. In CI, pass --yes (and think twice).
CI/CD (no browser)
Use a token from the dashboard (Account → API & CLI → Regenerate). Add --create so the project is
created automatically when it doesn't exist — nobody can answer a prompt in CI:
CRAFYNE_TOKEN=crfy_live_xxx npx crafyne deploy ./dist --project namek --createcrafyne.json (optional)
{ "project": "namek", "output": "./dist" }Then plain crafyne deploy is enough. The CLI writes this file for you when it creates a project.
Publishing (Crafyne maintainers)
cd cli
npm version patch
npm publish
npm view crafyne version # confirm it went live — npm may hold it in staging for approvalHow login works
POST /api/cli/start→ returns a code + an authorization URL (/cli?code=…).- The browser opens that page; your logged-in session (cookie) calls
POST /api/cli/approve, which mints a token and ties it to the code. - The CLI polls
POST /api/cli/poll→ receives the token once, then stores it locally.
