A real-time collaborative document editing application built with Next.js, Liveblocks, and Clerk authentication.
- Framework: Next.js 14 with React 18
- Styling: Tailwind CSS with Radix UI components
- Authentication: Clerk (
@clerk/nextjs) - Real-time Collaboration: Liveblocks (
@liveblocks/react,@liveblocks/react-lexical) - Text Editor: Lexical (
@lexical/react) - State Management: React Context (Liveblocks)
- Icons: Lucide React
- Error Tracking: Sentry (
@sentry/nextjs)
- Runtime: Node.js with Next.js API Routes
- Real-time Server: Liveblocks Node.js (
@liveblocks/node) - Authentication: Clerk middleware
- Error Tracking: Sentry (
@sentry/nextjs)
├── app/
│ ├── (auth)/ # Authentication pages (sign-in, sign-up)
│ ├── (root)/ # Main application routes
│ │ └── documents/ # Document management
│ ├── api/ # API routes
│ │ └── liveblocks-auth/ # Liveblocks authentication endpoint
│ └── layout.tsx # Root layout
├── components/ # React components
│ ├── editor/ # Lexical editor components
│ ├── ui/ # Reusable UI components (Radix)
│ └── *.tsx # Feature components (CollaborativeRoom, Comments, etc.)
├── lib/ # Utility functions and server actions
│ ├── actions/ # Server actions for document operations
│ ├── liveblocks.ts # Liveblocks server configuration
│ └── utils.ts # Helper utilities
├── middleware.ts # Clerk authentication middleware
├── liveblocks.config.ts # Liveblocks type definitions
└── types/ # TypeScript type definitions
- Real-time collaborative document editing
- User authentication and management (sign-in/sign-up)
- Document creation, sharing, and deletion
- Real-time cursor presence and collaborator indicators
- Comment threads on documents
- Document sharing with permission controls
- Responsive UI with modern design
- Server-side authentication via Clerk middleware
- Liveblocks room authorization
- Document CRUD operations via server actions
- Real-time synchronization through Liveblocks WebSocket connection
- Sentry error monitoring and performance tracking
- Node.js 18+
- npm or yarn
- Clerk account (for authentication)
- Liveblocks account (for real-time collaboration)
- Sentry account (for error tracking)
- Clone the repository:
git clone <repository-url>
cd live_docs- Install dependencies:
npm install- Set up environment variables in
.env.local:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
NEXT_PUBLIC_CLERK_SIGN_IN_URL=
NEXT_PUBLIC_CLERK_SIGN_UP_URL=
LIVEBLOCKS_SECRET_KEY=
SENTRY_DSN=- Run the development server:
npm run dev- Open http://localhost:3000 in your browser.
npm run dev- Start development servernpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLint
MIT