This is a modified version of Excalidraw optimized for deployment on Cloudflare Workers. It enables the Share Link feature using Cloudflare KV storage, eliminating the dependency on the official Excalidraw backend or Firebase.
这是一个 Excalidraw 的修改版本,专门针对 Cloudflare Workers 部署进行了优化。它使用 Cloudflare KV 存储实现了 分享链接 (Share Link) 功能,从而消除了对 Excalidraw 官方后端或 Firebase 的依赖。
- 🚀 Serverless Deployment: Runs entirely on Cloudflare Workers (Edge Network).
- 无服务器部署: 完全运行在 Cloudflare Workers(边缘网络)上。
- 🔗 Shareable Links: Fully functional sharing feature using Cloudflare KV.
- 分享链接: 使用 Cloudflare KV 实现功能完整的分享功能。
- 🎨 Core Experience: All standard Excalidraw features (drawing, export, etc.).
- 核心体验: 保留所有 Excalidraw 标准功能(绘图、导出等)。
- 🛠️ No Firebase Required: Modified to use local API routes for data persistence.
- 无需 Firebase: 修改为使用本地 API 路由进行数据持久化。
- Node.js (v18 or later / v18 或更高版本)
- Yarn (v1.22.22 or later / v1.22.22 或更高版本)
- Wrangler (Cloudflare CLI)
-
Clone the repository / 克隆仓库:
git clone <your-repo-url> cd excalidraw
-
Install dependencies / 安装依赖:
yarn install
-
Login to Cloudflare / 登录 Cloudflare:
npx wrangler login
You need a Cloudflare KV Namespace to store shared drawings. 你需要一个 Cloudflare KV 命名空间来存储分享的绘图数据。
yarn wrangler kv:namespace create "EXCALIDRAW_KV"Copy the id from the output (e.g., aaf653e38de14c3f8285f1c8a4ee5cb7).
复制输出中的 id(例如 aaf653e38de14c3f8285f1c8a4ee5cb7)。
Open excalidraw-app/wrangler.toml and update the kv_namespaces section with your ID:
打开 excalidraw-app/wrangler.toml 并用你的 ID 更新 kv_namespaces 部分:
[[kv_namespaces]]
binding = "EXCALIDRAW_KV"
id = "<YOUR_KV_ID>"
preview_id = "<YOUR_KV_ID>"Ensure .env.production (or your build environment variables) points to the local worker API:
确保 .env.production(或你的构建环境变量)指向本地 Worker API:
VITE_APP_BACKEND_V2_GET_URL=/api/v2/
VITE_APP_BACKEND_V2_POST_URL=/api/v2/post/To run the app locally: 在本地运行应用:
yarn startTo deploy the application to Cloudflare Workers: 将应用部署到 Cloudflare Workers:
yarn workspace excalidraw-app deployOnce deployed, you will receive a URL (e.g., https://excalidraw-app.<your-subdomain>.workers.dev or similar).
部署完成后,你将获得一个 URL(例如 https://excalidraw-app.<your-subdomain>.workers.dev 或类似地址)。
- Share Link fails / 分享链接失败: Check if the KV Namespace ID in
wrangler.tomlmatches what you created in Cloudflare.- 检查
wrangler.toml中的 KV Namespace ID 是否与你在 Cloudflare 中创建的一致。
- 检查
- Build errors / 构建错误: Ensure you are using the correct Node.js version and have run
yarn install.- 确保你使用的是正确的 Node.js 版本,并且已经运行了
yarn install。
- 确保你使用的是正确的 Node.js 版本,并且已经运行了
- Firebase errors / Firebase 错误: The code has been patched to gracefully handle missing Firebase configuration, but ensure you haven't accidentally re-enabled strict checks.
- 代码已经过修补,可以优雅地处理缺少 Firebase 配置的情况,但请确保你没有意外重新启用严格检查。
This project is a fork of Excalidraw. 本项目是 Excalidraw 的一个分支。