.
๐ GDlite โ Real-Time Collaborative Editor
GDlite is a real-time collaborative text editor built with a modern full-stack architecture. It supports user authentication, document management, and is designed to scale using WebSockets and PostgreSQL.
๐ Features
๐ User Authentication (JWT-based)
๐ Create & manage documents
๐ค Real-time collaboration (planned via WebSockets)
๐๏ธ PostgreSQL for persistent storage
โก Fast development setup with Vite + React
๐งฉ Modular backend architecture
๐๏ธ Tech Stack Backend
Node.js
Express.js
PostgreSQL
pg (node-postgres)
dotenv
JWT Authentication
Frontend
React
Vite
React Router DOM
๐ Project Structure collab-editor/ โ โโโ server/ โ โโโ src/ โ โ โโโ index.js # Server entry point โ โ โโโ db.js # PostgreSQL connection โ โ โโโ routes/ โ โ โ โโโ documents.js # Document routes โ โ โโโ controllers/ โ โ โโโ documentsController.js โ โโโ package.json โ โโโ .env โ โโโ client/ โโโ Editor/ # React frontend (Vite)
โ๏ธ Backend Setup 1๏ธโฃ Install Dependencies cd server npm install
2๏ธโฃ PostgreSQL Setup
Create the database and tables:
CREATE DATABASE GDlite;
CREATE TABLE users ( id SERIAL PRIMARY KEY, email VARCHAR(255) UNIQUE NOT NULL, password_hash VARCHAR(255) NOT NULL );
3๏ธโฃ Environment Variables
Create a .env file inside server/:
DATABASE_URL=postgresql://postgres:<your_password>@localhost:5432/GDlite PORT=5000
4๏ธโฃ Start Backend Server npm run dev
You should see:
Connected to postgres Server running on port 5000
๐จ Frontend Setup 1๏ธโฃ Install Dependencies cd client/Editor npm install
2๏ธโฃ Run Development Server npm run dev
Open:
๐ง Architecture Overview
Controllers handle business logic
Routes define API endpoints
Database pool manages PostgreSQL connections
JWT tokens secure API requests
React Router manages client-side navigation
๐ฎ Planned Improvements
๐ WebSocket-based real-time editing
๐ฅ Multi-user cursors & presence
๐ Document versioning
๐ก๏ธ Role-based access control
๐ Production deployment (Docker + Nginx)
๐งช Common Issues
Blank page in frontend โ Check App.jsx, routes, and exports
Postgres connection errors โ Verify password & .env loading
Vite import errors โ Ensure dependencies are installed
๐ License
This project is licensed under the MIT License.
๐จโ๐ป Author
Prajjwal Dwivedi ๐ Full-Stack Developer | Systems & Backend Enthusiast.