A collaborative document editor built with Next.js, featuring real-time collaboration, authentication, and organizational support. This application provides a Google Docs-like experience with rich text editing, live cursors, comments, and document management.
- Real-time Collaboration: Multiple users can edit documents simultaneously with live cursors and instant updates
- Rich Text Editor: Powered by TipTap with support for headings, formatting, tables, images, and more
- Authentication: Secure user authentication with Clerk, supporting organizations and personal accounts
- Document Management: Create, edit, delete, and organize documents with search functionality
- Organizational Support: Share documents within organizations and manage team collaboration
- Responsive Design: Modern UI built with Tailwind CSS and shadcn/ui components
- Template Gallery: Pre-built document templates for common use cases
- Frontend: Next.js 15, React 19, TypeScript
- Backend: Convex for real-time database and API
- Authentication: Clerk with organization support
- Real-time Collaboration: Liveblocks for collaborative editing
- Editor: TipTap with collaborative extensions
- Styling: Tailwind CSS, shadcn/ui components
- State Management: Zustand
Before setting up the project, ensure you have:
- A Convex account
- A Clerk account
- A Liveblocks account
git clone https://github.com/Davronov-Alimardon/google-docs.git
cd google-docs-clone
npm install
Note: Use
npm install --legacy-peer-deps
flag if you encounter version conflicts during installation.
Create a .env.local
file in the root directory with the following variables:
# Convex
NEXT_PUBLIC_CONVEX_URL=your-convex-deployment-url
# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your-clerk-publishable-key
CLERK_SECRET_KEY=your-clerk-secret-key
# Liveblocks
LIVEBLOCKS_SECRET_KEY=your-liveblocks-secret-key
npm install -g convex
npx convex dev
- Go to your Convex dashboard
- Navigate to Settings > Authentication
- Add Clerk as an authentication provider
- Use your Clerk domain:
https://your-clerk-domain.clerk.accounts.dev
- Set the application ID to:
convex
npx convex deploy
- Sign up at clerk.com
- Create a new application
- Enable organizations in your Clerk dashboard:
- Go to Configure > Organizations
- Enable organizations feature
- Configure organization settings as needed
- In your Clerk dashboard, go to Configure > JWT Templates
- Create a new template called
convex
- Add the following claims:
{
"aud": "convex",
"name": "{{user.full_name}}",
"email": "{{user.primary_email_address}}",
"picture": "{{user.image_url}}",
"nickname": "{{user.username}}",
"given_name": "{{user.first_name}}",
"updated_at": "{{user.updated_at}}",
"family_name": "{{user.last_name}}",
"phone_number": "{{user.primary_phone_number}}",
"email_verified": "{{user.email_verified}}",
"organization_id": "{{org.id}}",
"phone_number_verified": "{{user.phone_number_verified}}"
}
Update convex/auth.config.ts
with your Clerk domain:
export default {
providers: [
{
domain: "https://your-clerk-domain.clerk.accounts.dev",
applicationID: "convex"
}
]
}
- Sign up at liveblocks.io
- Create a new project
- Get your public and secret keys from the dashboard
npm run dev
The application will be available at http://localhost:3000
.
src/
├── app/ # Next.js app directory
│ ├── (home)/ # Home page and document listing
│ ├── api/ # API routes
│ ├── documents/ # Document editing interface
│ └── layout.tsx # Root layout
├── components/ # Reusable components
│ ├── ui/ # shadcn/ui components
│ └── ... # Custom components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions
└── store/ # Zustand stores
convex/
├── documents.ts # Document CRUD operations
├── schema.ts # Database schema
└── auth.config.ts # Authentication configuration
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request