Skip to content

Dev-muse/doc-jam

Repository files navigation

DocJam Logo

DocJam

Real-Time Collaborative Document Editing Platform

A powerful online tool that allows multiple users to edit documents simultaneously in real-time. Perfect for teams, remote workers, and anyone who needs to collaborate on projects efficiently.


🌟 Features

  • Real-Time Collaboration - Multiple users can edit the same document simultaneously with live cursor tracking
  • Rich Text Editing - Full-featured text editor powered by Lexical with formatting options
  • User Authentication - Secure sign-in/sign-up with Clerk authentication
  • Access Control - Granular permissions system with editor and viewer roles
  • Document Management - Create, view, edit, and delete documents with ease
  • Active Collaborators - See who's currently working on the document
  • Smart Notifications - Stay updated with document activities
  • @Mentions - Tag and notify collaborators within documents
  • Share & Invite - Share documents with team members and control their access levels
  • Dark Theme - Beautiful dark-themed interface for comfortable editing
  • Responsive Design - Works seamlessly across desktop and mobile devices

πŸš€ Tech Stack

Frontend

Backend & Services

  • Clerk - Authentication and user management
  • Liveblocks - Real-time collaboration infrastructure
  • Lexical - Extensible text editor framework

Additional Tools

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18 or higher)
  • npm, yarn, pnpm, or bun package manager
  • A Clerk account (Sign up here)
  • A Liveblocks account (Sign up here)

βš™οΈ Installation & Setup

1. Clone the repository

git clone https://github.com/Dev-muse/doc-jam.git
cd doc-jam

2. Install dependencies

npm install
# or
yarn install
# or
pnpm install

3. Set up environment variables

Create a .env.local file in the root directory and add the following environment variables:

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key

# Clerk URLs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/

# Liveblocks
LIVEBLOCKS_SECRET_KEY=your_liveblocks_secret_key

Getting API Keys:

Clerk:

  1. Go to Clerk Dashboard
  2. Create a new application
  3. Navigate to API Keys section
  4. Copy the Publishable Key and Secret Key

Liveblocks:

  1. Go to Liveblocks Dashboard
  2. Create a new project
  3. Navigate to API Keys section
  4. Copy the Secret Key

4. Run the development server

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 in your browser to see the application.

πŸ“ Project Structure

doc-jam/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/                 # Authentication routes
β”‚   β”‚   β”œβ”€β”€ sign-in/           # Sign-in page
β”‚   β”‚   └── sign-up/           # Sign-up page
β”‚   β”œβ”€β”€ (root)/                # Main application routes
β”‚   β”‚   β”œβ”€β”€ documents/[id]/    # Individual document page
β”‚   β”‚   └── page.tsx           # Home page with document list
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── liveblocks-auth/   # Liveblocks authentication endpoint
β”‚   β”œβ”€β”€ Provider.tsx           # Liveblocks provider wrapper
β”‚   β”œβ”€β”€ layout.tsx             # Root layout with Clerk provider
β”‚   └── globals.css            # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ editor/                # Editor components
β”‚   β”œβ”€β”€ ui/                    # Reusable UI components
β”‚   β”œβ”€β”€ ActiveCollaborators.tsx
β”‚   β”œβ”€β”€ CollaborativeRoom.tsx  # Main collaborative workspace
β”‚   β”œβ”€β”€ Collaborator.tsx
β”‚   β”œβ”€β”€ DeleteModal.tsx
β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”œβ”€β”€ Notifications.tsx
β”‚   β”œβ”€β”€ ShareModal.tsx
β”‚   └── UserTypeSelector.tsx
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ actions/
β”‚   β”‚   β”œβ”€β”€ room.actions.ts    # Document/room server actions
β”‚   β”‚   └── user.actions.ts    # User-related server actions
β”‚   β”œβ”€β”€ liveblocks.ts          # Liveblocks client configuration
β”‚   └── utils.ts               # Utility functions
β”œβ”€β”€ public/
β”‚   └── assets/                # Static assets (icons, images)
β”œβ”€β”€ styles/                     # Theme styles
β”œβ”€β”€ middleware.ts              # Clerk middleware for auth
β”œβ”€β”€ liveblocks.config.ts       # Liveblocks type definitions
β”œβ”€β”€ tailwind.config.ts         # Tailwind configuration
└── package.json

🎯 Usage

Creating a Document

  1. Sign in to your account
  2. Click the "Create a document" button on the home page
  3. Start editing your new document

Collaborating in Real-Time

  1. Open a document
  2. Click the "Share" button in the header
  3. Add collaborators by email
  4. Choose their access level (Editor or Viewer)
  5. Collaborators can now edit simultaneously

Managing Documents

  • View all documents: Navigate to the home page
  • Edit a document: Click on any document from the list
  • Delete a document: Click the delete icon next to a document
  • Update document title: Click on the title in the document editor

Access Levels

  • Editor: Can read, write, and edit the document
  • Viewer: Can only read the document and see live changes

πŸ” Security Features

  • Secure Authentication: Industry-standard authentication with Clerk
  • Email Verification: Ensures user identity
  • Access Control: Granular permissions for each document
  • Secure API Routes: Protected with Clerk middleware
  • Environment Variables: Sensitive data stored securely

🚒 Deployment

Deploy on Vercel (Recommended)

  1. Push your code to GitHub
  2. Import your repository on Vercel
  3. Add environment variables in Vercel project settings
  4. Deploy

Deploy with Vercel

Build for Production

npm run build
npm run start

πŸ› οΈ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run lint - Run ESLint

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ‘¨β€πŸ’» Author

Dev-muse

πŸ™ Acknowledgments

πŸ“§ Support

For support, email dev-muse@example.com or open an issue in the GitHub repository.


Made with ❀️ by Dev-muse

⭐ Star this repo if you find it helpful!

About

Live document collaboration app - DocJam. Using nextjs , clerk for authentication and liveblocks library for real time update feature

Resources

Stars

Watchers

Forks

Contributors