Installation guide
Get the Collaborative Editor up and running on your local development environment.Prerequisites
Before you begin, ensure you have the following installed:- Node.js 20.x or higher
- npm, yarn, or pnpm package manager
- Git for cloning the repository
- A Clerk account (for authentication)
- A Liveblocks account (for real-time collaboration)
Clone the repository
First, clone the project repository to your local machine:Install dependencies
Install all required packages using your preferred package manager:- @clerk/nextjs (v5.2.4) - Authentication
- @liveblocks/client (v2.3.0) - Real-time collaboration
- @liveblocks/react (v2.3.0) - React bindings for Liveblocks
- @liveblocks/react-lexical (v2.3.0) - Lexical editor integration
- lexical (v0.16.1) - Rich text editor framework
- next (v14.2.5) - React framework
- tailwindcss (v3.4.1) - Styling
Environment setup
Create a.env.local file in the root directory to store your environment variables:
.env.local file:
Get your Clerk keys
Create a Clerk application
- Go to clerk.com and sign up or log in
- Create a new application
- Choose “Email” as your authentication method
Get your Liveblocks keys
Create a Liveblocks project
- Go to liveblocks.io and sign up or log in
- Create a new project
- Choose a project name
Run the development server
Start the Next.js development server:http://localhost:3000.
The development server supports hot module replacement, so changes to your code will be reflected immediately.
Verify your installation
To confirm everything is set up correctly:- Open
http://localhost:3000in your browser - You should see the sign-in page
- Click “Sign In” and create a test account
- After signing in, you should see the documents dashboard
- Try creating a new document by clicking “Start a blank document”
Available scripts
The project includes the following npm scripts:npm run dev- Start the development server with hot reloadnpm run build- Build the application for productionnpm run start- Start the production server (requires build first)npm run lint- Run ESLint to check for code quality issues
Build for production
When you’re ready to deploy, build the application:.next directory.
Troubleshooting
Module not found errors
If you encounter module resolution errors:- Delete
node_modulesand lock files - Reinstall dependencies:
Authentication not working
Verify your Clerk environment variables:- Check that keys are correctly copied without extra spaces
- Ensure you’re using the keys from the correct Clerk application
- Confirm the sign-in/sign-up URLs match your route structure
Real-time features not syncing
If collaboration features aren’t working:- Verify your Liveblocks keys are correct
- Check browser console for WebSocket connection errors
- Ensure you have a stable internet connection
- Try refreshing the page or clearing browser cache
What’s next?
Now that you have the application running locally:- Follow the quickstart guide to create your first document
- Learn about authentication configuration
- Explore the integrations to understand how real-time collaboration works
- Read about deployment options for production