Collaborative document authoring and automation platform built with Next.js 16, React 19, Tiptap 3, Firebase, Clerk, and integrated AI tooling.
- Project Overview
- Tech Stack
- Prerequisites
- Getting Started
- Available Scripts
- Architecture Highlights
- Quality & Tooling
- Deployment
- Contributing
- License
DocuShare provides real-time document editing with AI-assisted authoring, robust formatting, sharing, and billing flows. Core capabilities include:
- 🔐 Clerk authentication with protected application routes (
dashboard,profile, payment flows). - 📝 Collaborative editor powered by Tiptap 3 (
@tiptap/* 3.14.0) with custom blocks, real-time carets (@tiptap/extension-collaboration-caret@3.14.0), and AI menus. - 🤖 AI assistance (OpenAI, Anthropic, Google Gemini, Mistral) through the
ai@6.0.3SDK layer. - ☁️ Firebase persistence plus Firestore-triggered stats and document sharing endpoints.
- 💳 Stripe payments (
stripe@20.1.0,@stripe/react-stripe-js@5.4.1,@stripe/stripe-js@8.6.0) for upgrade and billing scenarios. - 📊 Document statistics + activity feeds backed by Firestore queries.
| Category | Libraries / Versions (from package-lock.json) |
|---|---|
| Framework | next@16.1.1, react@19.2.3, react-dom@19.2.3 |
| Editor / Collab | @tiptap/core@3.14.0, @tiptap/react@3.14.0, @tiptap/extension-collaboration@3.14.0, @tiptap/extension-collaboration-caret@3.14.0, yjs@13.6.28, y-webrtc@10.3.0 |
| Authentication | @clerk/nextjs@6.36.5, @clerk/express@1.7.60 |
| Persistence | firebase@12.7.0, firebase-admin@13.6.0 |
| AI + LLMs | ai@6.0.3, @ai-sdk/openai, @ai-sdk/anthropic, @ai-sdk/google, @ai-sdk/mistral |
| Payments | stripe@20.1.0, @stripe/react-stripe-js@5.4.1, @stripe/stripe-js@8.6.0 |
| UI / Styling | tailwindcss@4.1.18, @floating-ui/react@0.27.16, lucide-react@0.562.0 |
- Node.js: >= 20.9.0 (required by
next@16.1.1) - npm: >= 10 (bundled with Node 20+)
- Accounts / credentials for:
git clone https://github.com/<your-org>/docushare.git
cd docushare
npm installNote: Standard
npm installworks across local and CI builds because all Tiptap 3 peer dependencies are aligned.
Create a .env.local (Next.js) with the following keys (set all secrets before running the app):
| Variable | Description |
|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY |
Clerk publishable key for client SDK |
CLERK_SECRET_KEY |
Clerk secret key for server-side auth |
NEXT_PUBLIC_STRIPE_KEY |
Stripe publishable key for client Elements |
STRIPE_SECRET_KEY |
Stripe secret key for backend actions/webhooks |
FIREBASE_PROJECT_ID / FIREBASE_CLIENT_EMAIL / FIREBASE_PRIVATE_KEY |
Firebase Admin credentials |
NEXT_PUBLIC_FIREBASE_APIKEY / NEXT_PUBLIC_FIREBASE_AUTHDOMAIN / NEXT_PUBLIC_FIREBASE_PROJECTID / NEXT_PUBLIC_FIREBASE_STORAGEBUCKET / NEXT_PUBLIC_FIREBASE_MESSAGINGSENDERID / NEXT_PUBLIC_FIREBASE_APPID / NEXT_PUBLIC_FIREBASE_MEASUREMENTID |
Firebase client SDK values |
DOCUMENT_COLLECTION (optional override) |
Firestore collection name for docs (docs default) |
IS_UAT |
When set to 1, the AI layer returns canned responses for staging |
Add any provider-specific AI keys (OpenAI, Anthropic, Google, Mistral, Fireworks) as needed. See
src/actions/generateActions.tsfor usage.
# Start dev server with hot reload
npm run dev
# Lint (Next.js ESLint config)
npm run lint
# Production build & type-check
npm run build
# Start production server
npm run startVisit http://localhost:3000 to access the app once npm run dev is running.
| Script | Description |
|---|---|
npm run dev |
Development server with Turbopack HMR |
npm run build |
Creates optimized production build, runs TypeScript checks |
npm run start |
Starts Next.js in production mode (requires npm run build first) |
npm run lint |
Runs ESLint (configured via eslint-config-next) |
- App Router (
src/app/) with server components, route handlers (/api/*), and page-level layouts. - Editor System:
src/components/CollaborativeEditor.tsxorchestrates Tiptap editor, custom menus, AI controls, and Firestore persistence.- Rich menu components under
src/components/menusand custom extensions insrc/extensions.
- State & Context:
zustandstores (e.g.,useAuthStore,useProfileStore) manage UI state.ActiveDocContextcoordinates document selection across sidebar/editor.
- API Routes:
/api/docs,/api/docs/stats,/api/share,/api/ai,/api/imageimplement CRUD, sharing, stats, and AI/image utilities.
- Authentication Guard:
src/proxy.ts(Next.js 16 proxy/middleware) uses Clerk to protect routes like/dashboard,/profile,/payment-*.
Refer to the source tree for deeper exploration (src/components, src/extensions, src/zustand, etc.).
- ESLint: Next.js default rules + TypeScript support (
npm run lint). - TypeScript: Enabled across the repo;
npm run buildfails on type errors (as seen during upgrades). - Prettier / Formatting: Not enforced via scripts but encouraged for contributions.
- Testing: (Not yet implemented) — contributions welcome to add unit/integration tests.
- Ensure environment variables are configured (Vercel, Docker, or your platform of choice).
- Run
npm run buildto produce the.nextproduction bundle. - Execute
npm run startbehind your process manager (PM2, Docker, Vercel serverless, etc.).
The project targets Node.js runtime for Next.js 16 proxies. Edge runtime is not currently used.
Contributions are welcome! Please:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'feat: add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request describing the changes and testing performed.
For substantial changes, consider opening an issue to discuss the proposal first.
This project is distributed under the GNU Affero General Public License v3.0 (AGPL-3.0-only). See LICENSE.md for details.
Happy building! 🛠️