Docsyra is a collaborative document workspace with a Notion-like editor, threaded comments, live presence, notifications, document sharing, and Cloudflare-based hosting.
Docsyra lets teams create and edit documents together in real time while keeping comments, notifications, sharing, and document history in sync.
- Rich text editor built with TipTap and ProseMirror.
- Real-time collaboration with Yjs awareness for live cursors, selections, and typing indicators.
- Threaded comments with range anchors, replies, resolve/reopen flow, and fallback rehydration when content changes.
- In-app notifications for comments and mentions, plus email delivery.
- User authentication with email/password, OAuth, passkeys, OTP, 2FA, password reset, and email verification.
- Document sharing with visibility controls, collaborator invites, and role-based access checks.
- Version/history support, restore flows, and document activity logging.
- GitHub synchronization tools for connecting, previewing, and pulling remote content.
- Dashboard shell with notifications, account controls, and document navigation.
docsyra_app/- Main Next.js application.docsyra-collab/- Separate Cloudflare Worker and Durable Object service for Yjs collaboration.
- Next.js 15
- React 19
- TypeScript
- TipTap
- Yjs
- Cloudflare Pages
- Cloudflare Workers
- Cloudflare Durable Objects
- Cloudflare D1
- Cloudflare R2
- Node.js 20 or newer
- npm
- Wrangler CLI for Cloudflare deploy and preview commands
Run this in each project folder that you want to work on:
cd docsyra_app
npm installcd ../docsyra-collab
npm installFrom docsyra_app/:
npm run devOpen http://localhost:3000 in your browser.
From docsyra_app/:
npm run buildFrom docsyra_app/:
npm run previewThis builds the app for the Pages runtime and starts a local Wrangler Pages preview.
Docsyra is designed to be deployed in two parts:
The main app is deployed as a Cloudflare Pages-compatible Next.js build.
From docsyra_app/:
npm run pages:build
npm run deployIf you are deploying through Cloudflare Pages, the build output is configured for next-on-pages.
The collaboration service runs separately as a Cloudflare Worker with a Durable Object.
From docsyra-collab/:
npm run deployYou will need these Cloudflare resources configured for a full deployment:
- A D1 database for application data.
- An R2 bucket for document assets.
- A Durable Object namespace for collaboration rooms.
- Pages or Worker deployment for the main app.
- Worker deployment for the collaboration service.
The main app uses Cloudflare bindings and runtime variables defined in wrangler.jsonc.
ENV_NAME- Current environment name.NEXT_PUBLIC_APP_URL- Public app URL.NEXT_PUBLIC_R2_BASE_URL- Base URL for asset delivery.NEXT_PUBLIC_COLLAB_WS_BASE_URL- WebSocket base URL for collaboration.GOOGLE_CLIENT_ID- OAuth client ID for Google sign-in.GITHUB_CLIENT_ID- OAuth client ID for GitHub sign-in.PASSKEY_RP_ID- WebAuthn relying party ID.PASSKEY_ORIGIN- Allowed WebAuthn origin.PASSKEY_RP_NAME- Display name shown in authenticator prompts.BASE_URL- Main app base URL.DB- D1 database binding.R2- R2 bucket binding.
These are required for auth and encryption flows and should stay server-side:
TWO_FACTOR_SECRET_KEY- Encrypts TOTP secrets at rest.- Any provider secrets required by OAuth, email delivery, or deployment tooling.
The in-editor AI features (/api/ai) are multi-provider. Configuration is read
from the environment:
AI_PROVIDER- Which provider to use:anthropic(default),openai,groq, orgemini.ANTHROPIC_API_KEY/OPENAI_API_KEY/GROQ_API_KEY/GEMINI_API_KEY- The API key for the chosen provider (secret).ANTHROPIC_MODEL/OPENAI_MODEL/GROQ_MODEL/GEMINI_MODEL- Optional model override; each provider has a sensible default.
Local development: create docsyra_app/.dev.vars (git-ignored), set
AI_PROVIDER and the matching *_API_KEY, then restart npm run dev.
Production / preview: set the API key as a Wrangler secret —
npx wrangler pages secret put ANTHROPIC_API_KEY — and set AI_PROVIDER
either as a secret or in wrangler.jsonc vars.
Without a configured key, the AI UI still opens but /api/ai returns an error.
The collaboration worker in docsyra-collab/ hosts Yjs document rooms behind a Durable Object.
- The client opens a websocket connection for a document room.
- The worker uses a Durable Object instance per document ID.
- Yjs state updates are broadcast to connected clients.
- Awareness data is used for presence features such as live cursors and typing indicators.
The application stores documents, comments, notifications, invitations, sessions, and user metadata in D1.
Run the migration files in docsyra_app/migrations/ against your database before deploying.
npm run dev
npm run build
npm run start
npm run lint
npm run pages:build
npm run preview
npm run deploy
npm run cf-typegennpm run deploy- Make sure the main app and the collaboration worker point at the correct production URLs.
- Update
NEXT_PUBLIC_APP_URLandNEXT_PUBLIC_COLLAB_WS_BASE_URLfor the environment you deploy. - Keep D1 and R2 bindings aligned between local, preview, and production environments.
- If passkeys are enabled,
PASSKEY_RP_IDandPASSKEY_ORIGINmust match the deployed domain.
docsyra_app/- Application UI, API routes, database queries, editor components, auth, notifications, and server code.docsyra-collab/- WebSocket collaboration worker and Durable Object room logic.structure.txt- Folder tree snapshot for the workspace.
- The main app build is validated with
npm run build. - The collaboration service has no separate build step beyond Wrangler deployment.