Skip to content

archief2910/Scriptly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Scriptly ๐Ÿ“

A real-time collaborative document editor with advanced version control, built with modern web technologies.

Scriptly Banner React Node.js Socket.IO MongoDB

๐Ÿš€ Features

โœจ Core Functionality

  • Real-Time Collaboration: Multiple users can edit documents simultaneously with live cursor tracking
  • Rich Text Editor: Powered by Quill.js with comprehensive formatting options
  • Version Control: Automatic document versioning with restore capabilities
  • Live Chat: In-document messaging for seamless team communication
  • User Authentication: Secure JWT-based authentication system
  • Document Sharing: Granular permission system (read/write/admin) with public/private options

๐Ÿ”ง Technical Features

  • Auto-Save: Automatic document saving every 2 seconds
  • Typing Indicators: Real-time typing status for all collaborators
  • Document Permissions: Owner/collaborator management with role-based access
  • Responsive Design: Mobile-friendly interface with Tailwind CSS
  • Error Handling: Comprehensive error management and user feedback

๐Ÿ—๏ธ Architecture

Backend (Node.js)

  • Express.js REST API server
  • Socket.IO for real-time WebSocket connections
  • MongoDB with Mongoose ODM for data persistence
  • JWT Authentication for secure user sessions
  • CORS configuration for cross-origin requests

Frontend (React)

  • React 18 with TypeScript for type safety
  • Vite for fast development and optimized builds
  • Socket.IO Client for real-time communication
  • Quill.js for rich text editing
  • Tailwind CSS for responsive styling

Database Schema

  • Users: Authentication and profile management
  • Documents: Content storage with ownership and collaboration
  • Versions: Complete version history with restore functionality

๐Ÿ“‹ Prerequisites

Before running this project, make sure you have:

  • Node.js (v18 or higher)
  • npm or yarn package manager
  • MongoDB Atlas account (or local MongoDB installation)
  • Git for version control

๐Ÿ› ๏ธ Installation & Setup

1. Clone the Repository

git clone https://github.com/rebornstar1/Scriptly.git
cd Scriptly

2. Backend Setup

# Navigate to backend directory
cd backend

# Install dependencies
npm install

# Create environment file
cp .env.example .env

# Configure environment variables
# Edit .env file with your configurations:
PORT=3001
MONGODB_URI=mongodb+srv://your-username:[email protected]/scriptly?retryWrites=true&w=majority
JWT_SECRET=your-super-secret-jwt-key-here
NODE_ENV=development

3. Frontend Setup

# Navigate to frontend directory (from project root)
cd frontend

# Install dependencies
npm install

# Create environment file
touch .env.local

# Configure environment variables
# Add to .env.local:
VITE_API_URL=http://localhost:3001/api

๐Ÿš€ Running the Application

Development Mode

Start Backend Server

cd backend
npm run dev
# Server will run on http://localhost:3001

Start Frontend Development Server

cd frontend
npm run dev
# Application will run on http://localhost:5173

Production Build

Backend

cd backend
npm start

Frontend

cd frontend
npm run build
npm run preview

๐Ÿ“‚ Project Structure

Scriptly/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.config.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ db.js
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.middleware.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ socket.middleware.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ validation.middleware.js
โ”‚   โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ document.model.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ user.model.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Version.js
โ”‚   โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.routes.js
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ document.routes.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ version.routes.js
โ”‚   โ”‚   โ”œโ”€โ”€ socket/
โ”‚   โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.utils.js
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ db.utils.js
โ”‚   โ”‚   โ””โ”€โ”€ server.js
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ .env
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ chat/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ sharing/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ui/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ VersionHistory/
โ”‚   โ”‚   โ”œโ”€โ”€ contexts/
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ””โ”€โ”€ pages/
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ .env.local
โ””โ”€โ”€ README.md

๐ŸŒ Deployment

Backend (Render)

  1. Connect your GitHub repository to Render
  2. Create a new Web Service
  3. Configure:
    • Build Command: npm install
    • Start Command: npm start
    • Environment Variables: Add all variables from .env

Frontend (Vercel)

  1. Connect your GitHub repository to Vercel
  2. Configure:
    • Framework Preset: Vite
    • Build Command: npm run build
    • Output Directory: dist
    • Environment Variables: Add VITE_API_URL with your backend URL

๐Ÿ“ก API Endpoints

Authentication

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/me - Get current user

Documents

  • GET /api/documents - Get user's documents
  • POST /api/documents - Create new document
  • GET /api/documents/:id - Get specific document
  • PUT /api/documents/:id - Update document
  • DELETE /api/documents/:id - Delete document

Version Control

  • GET /api/versions/:documentId - Get document versions
  • GET /api/versions/:documentId/:versionNumber - Get specific version

๐Ÿ”Œ Socket.IO Events

Client to Server

  • get-document - Join document room and load content
  • send-changes - Send text changes to other users
  • save-document - Save document content
  • get-versions - Request version history
  • load-version - Load specific version
  • send-chat-message - Send chat message
  • user-typing - Send typing status

Server to Client

  • load-document - Initial document load
  • receive-changes - Receive text changes from other users
  • document-saved - Document save confirmation
  • versions-list - Version history data
  • version-loaded - Specific version content
  • receive-chat-message - Incoming chat message
  • user-typing - Other user typing status

๐Ÿงช Testing

Backend Testing

cd backend
npm test

Frontend Testing

cd frontend
npm test

๐Ÿค Contributing

  1. Fork the repository
  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

Development Guidelines

  • Follow ESLint and Prettier configurations
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation for API changes
  • Ensure TypeScript compliance

๐Ÿ› Known Issues & Limitations

  • Large documents (>50MB) may experience performance issues
  • Mobile editing experience can be improved
  • Maximum 50 concurrent users per document room

๐Ÿ”ฎ Future Enhancements

  • File upload and attachment support
  • Document templates
  • Advanced formatting options
  • Integration with Google Drive/Dropbox
  • Offline mode with sync
  • Document export to PDF/Word
  • Advanced user roles and permissions
  • Real-time cursor positions
  • Comment and suggestion system

๐Ÿ“„ License

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

โญ Star this repository if you found it helpful!

About

https://scriptly-steel.vercel.app/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors