A real-time collaborative document editor built with React and Appwrite, featuring automatic version history tracking.
- π User Authentication - Secure email/password authentication
- π Rich Text Editor - Full-featured document editing with ReactQuill
- π Real-time Collaboration - Live synchronization across multiple users
- π Version History - Automatic snapshots with timeline view
- πΎ Auto-save - Automatic document saving every 2 seconds
- π± Responsive Design - Works on desktop and mobile devices
- Frontend: React 18 + Vite
- Styling: Tailwind CSS
- Backend: Appwrite (BaaS)
- Editor: ReactQuill
- Routing: React Router v6
- Icons: Lucide React
git clone <your-repo>
cd quickdoc-app
npm install
Copy .env.example
to .env
and configure:
VITE_APPWRITE_URL=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your-project-id-here
VITE_APPWRITE_DATABASE_ID=your-database-id-here
VITE_APPWRITE_DOCUMENTS_COLLECTION_ID=documents
VITE_APPWRITE_VERSIONS_COLLECTION_ID=document_versions
- Sign up at Appwrite Cloud
- Create a new project
- Copy the Project ID to your
.env
file
Create a database called quickdoc-db
with these collections:
Collection 1: documents
Attributes:
- title (string, size: 255, required: false)
- content (string, size: 65535, required: false)
- owner (string, size: 255, required: true)
- createdAt (datetime, required: true)
- updatedAt (datetime, required: true)
Permissions:
- Create: Users
- Read: Document Owner
- Update: Document Owner
- Delete: Document Owner
Collection 2: document_versions
Attributes:
- documentId (string, size: 255, required: true)
- title (string, size: 255, required: false)
- content (string, size: 65535, required: false)
- timestamp (datetime, required: true)
- authorId (string, size: 255, required: true)
Permissions:
- Create: Any authenticated user
- Read: Any authenticated user
- Update: None
- Delete: None
- Go to Auth β Settings
- Enable Email/Password provider
- Configure session limits as needed
- Go to Functions β Create Function
- Name:
document-version-creator
- Runtime: Node.js 18
- Copy the Appwrite Function code provided
- Add environment variables:
APPWRITE_FUNCTION_ENDPOINT
: https://cloud.appwrite.io/v1APPWRITE_FUNCTION_PROJECT_ID
: your-project-idAPPWRITE_FUNCTION_API_KEY
: (create API key with database permissions)DATABASE_ID
: quickdoc-dbDOCUMENTS_COLLECTION_ID
: documentsVERSIONS_COLLECTION_ID
: document_versions
- Deploy the function
- Go to Database β documents collection β Settings β Webhooks
- Create webhook:
- Name:
version-creator-webhook
- Events:
databases.*.collections.*.documents.*.update
- URL: Your function's execution URL
- HTTP Method: POST
- Name:
npm run dev
Visit http://localhost:5173
to see the app in action!
quickdoc-app/
βββ public/
βββ src/
β βββ appwrite/
β β βββ config.js # Appwrite client & services
β βββ components/
β β βββ auth/
β β β βββ Login.jsx # Login form component
β β β βββ Signup.jsx # Registration form
β β βββ editor/
β β β βββ TextEditor.jsx # ReactQuill wrapper with auto-save
β β β βββ VersionHistory.jsx # Version history sidebar
β β βββ Layout.jsx # Main app layout
β βββ contexts/
β β βββ AuthContext.jsx # Global authentication state
β βββ pages/
β β βββ Dashboard.jsx # Document list page
β β βββ DocumentPage.jsx # Main editor page
β β βββ Home.jsx # Landing page
β βββ App.jsx # Main app component
β βββ main.jsx # React entry point
β βββ index.css # Tailwind imports & custom styles
βββ .env.example # Environment variables template
βββ package.json
βββ tailwind.config.js
βββ vite.config.js
βββ index.html
- Uses Appwrite Realtime to subscribe to document changes
- Updates are automatically synced across all connected clients
- Prevents update conflicts with proper state management
- Automatic snapshots created via Appwrite Functions + Webhooks
- Timeline view showing all document versions
- Click any version to view historical content (read-only)
- Automatic cleanup of old versions (keeps last 50)
- Debounced saving every 2 seconds after content changes
- Manual save button for immediate saving
- Visual feedback showing save status
- Prevents data loss during editing
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLint
- Uses functional components with hooks
- TypeScript-ready (though using JavaScript for simplicity)
- Tailwind CSS for styling
- ESLint configuration included
- Build the app:
npm run build
- Deploy the
dist
folder to your preferred hosting service - Configure environment variables on your hosting platform
- Set up production Appwrite instance
- Configure proper security rules
- Set up monitoring and backups
- Update CORS settings for your domain
Authentication not working:
- Check Appwrite project ID and endpoint
- Verify auth provider is enabled
- Check browser network tab for CORS errors
Real-time not syncing:
- Verify Appwrite Realtime is enabled
- Check document permissions
- Look for WebSocket connection errors in browser console
Version history not creating:
- Check webhook is properly configured
- Verify function has correct permissions
- Check function logs in Appwrite console
Build errors:
- Clear node_modules and reinstall:
rm -rf node_modules package-lock.json && npm install
- Check Node.js version compatibility
- Verify all environment variables are set
For production use, consider:
- Implementing pagination for document lists
- Adding lazy loading for version history
- Optimizing bundle size with code splitting
- Setting up CDN for static assets
- Implementing proper caching strategies
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open a pull request
For questions and support:
- Check the Appwrite Documentation
- Join the Appwrite Discord
- Open an issue in this repository
Built for the hackathon with β€οΈ using React and Appwrite