Memorains Note - Project Documentation
Documents a full-stack note-taking app with rich text, canvas drawing, real-time collaboration, and containerized deployment.
What this file does
Documents a full-stack note-taking app with rich text, canvas drawing, real-time collaboration, and containerized deployment.
When to use it
- Setting up a collaborative note-taking application with Yjs CRDT
- Deploying a React + Express app with MariaDB and Nginx via Podman
- Building a desktop Electron wrapper around a web-based editor
- Understanding the architecture of a multi-editor (Quill, Excalidraw, todo list) system
Assumes this stack
Memorains Note - Project Documentation
Project Overview
Memorains is a comprehensive note-taking application that integrates rich text editing with canvas drawing capabilities. It supports both online and offline use, as well as multi-user and multi-device collaboration.
Core Technologies
Client (Frontend):
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Rich Text Editor: Quill (with extensions for tables, cursors, image compression, markdown shortcuts)
- Canvas Drawing: Excalidraw
- Collaboration: Yjs (CRDT-based conflict-free synchronization)
- UI Library: Material-UI (MUI) v6
- Desktop App: Electron
- Routing: React Router v6
Server (Backend):
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: MariaDB
- Real-time Communication: WebSocket (ws)
- Authentication: JSON Web Tokens (JWT)
Infrastructure:
- Containerization: Podman/Docker
- Web Server: Nginx (reverse proxy + SSL termination)
- Database: MariaDB
Architecture
The project follows a client-server architecture with real-time collaboration:
┌─────────────────┐ ┌──────────────────┐ ┌──────────────┐
│ Web Browser │ │ Nginx (HTTPS) │ │ MariaDB │
│ Desktop App │◄───────►│ Reverse Proxy │◄───────►│ Database │
│ Mobile App │ └──────────────────┘ └──────────────┘
└─────────────────┘ │
│
▼
┌──────────────────┐
│ Node.js Server │
│ (Express + WS) │
└──────────────────┘
Key Features:
- Three note types: Rich text editor, Infinite canvas, and Todo list editor
- Conflict-free collaboration using Yjs CRDT
- Multi-device/user real-time sync
- Online & offline support
- Cross-platform clients: Web, Desktop (Linux/Windows/macOS), Mobile (Android/iOS)
Todo List Editor Features
The TodoListEditor (client/src/editor/TodoListEditor.tsx) provides:
- Task creation and management
- Task completion tracking
- Deadline setting with visual indicators (overdue, urgent, upcoming)
- Real-time collaborative editing via Yjs
- Clear completed tasks functionality
- Edit and delete individual tasks
- Sort by completion status
Building and Running
Prerequisites
- Podman or Docker (for containerized deployment)
- Node.js (for development)
- SSL Certificate (for HTTPS)
Development Setup
Client Development
cd client
npm install
npm run dev
This starts a Vite dev server at http://localhost:5173 (or similar).
Server Development
cd server
npm install
npm run build # Compile TypeScript
npm run server # Start server (requires running database)
For full development with containers:
cd server
npm run dev # Starts containers + TypeScript watch mode
Production Deployment
1. Build Application Package
cd script
bash build_package.sh
This creates package.tar.gz containing:
- Compiled client (
client/dist) - Server source + build (
server/src,server/build) - Database schema (
server/DB) - Docker/Podman compose files
- Nginx configuration
2. Prepare SSL Certificate
On the server:
mkdir ~/certificate
# Place your SSL certificate and key here:
# ~/certificate/cert.pem
# ~/certificate/cert.key
3. Deploy and Run
tar -zxvf package.tar.gz
cd package
podman compose up -d
# or: docker compose up -d
4. Access Application
Open in browser: https://your-host/doc/client/
Development Conventions
Code Style
TypeScript:
- Strict mode enabled (
"strict": true) - ES2020 target for server
- CommonJS module system for server
- ESM for client
Linting:
- ESLint configured for both client and server
- Prettier for code formatting
- Pre-commit hooks recommended
Client Structure:
client/src/
├── components/ # Reusable UI components
├── const/ # Constants and configurations
├── DB/ # Database/local storage utilities
├── editor/ # Editor components
│ ├── CommonEditor.tsx # Base editor interface
│ ├── QuillEditor.tsx # Rich text editor
│ ├── ExcalidrawEditor.tsx # Canvas drawing editor
│ └── TodoListEditor.tsx # Task management editor
├── hooks/ # Custom React hooks
├── interface/ # TypeScript interfaces/types
├── internationnalization/ # i18n support
├── pages/ # Route pages
└── utils/ # Utility functions
Server Structure:
server/src/
├── build/ # Compiled JavaScript output
├── DB/ # Database schema and migrations
├── src/ # TypeScript source files
└── post-test/ # Test utilities
Testing
Client:
- No formal test framework currently configured
- Desktop testing:
npm run desktop:test(placeholder)
Server:
- No test framework currently configured
npm run testreturns error placeholder
Build Process
Client Build:
- TypeScript compilation
- Vite bundling
- Excalidraw assets copy (fonts)
- Version management (sw-version.js)
Server Build:
- TypeScript compilation to
build/directory - Output is executable Node.js code
Package Build:
- Build client assets
- Copy server source + compiled code
- Include database schema
- Include infrastructure configs (docker-compose, nginx)
- Create tarball
Environment Variables
Server:
NODE_ENV=production(in docker-compose)IS_DEV=true(for development mode)
Database (docker-compose):
MYSQL_ROOT_PASSWORD=123456MYSQL_DATABASE=documentMYSQL_USER=docMYSQL_PASSWORD=123456
Networking
Docker Network:
- Bridge network:
reno_note_app_network - Services communicate via container names:
reno_note_mariadbreno_note_nodejsreno_note_nginx
Ports:
- 80: HTTP (nginx)
- 443: HTTPS (nginx with SSL)
- 8000: Node.js server (internal)
- Dynamic WebSocket ports: Range 8000-8999 (proxied via nginx)
WebSocket Proxy:
- Nginx routes
/doc/websocket/port_XXXX/*to Node.js on portXXXX - Supports long-lived connections (1800s timeout)
Key Dependencies
Client
@excalidraw/excalidraw: Canvas drawingquill: Rich text editoryjs: CRDT for collaborationy-quill: Quill binding for Yjs@mui/material: UI componentsreact-router-dom: Routingelectron: Desktop app framework
Server
express: Web frameworkws: WebSocket servermariadb: Database driverjsonwebtoken: Authenticationyjs: CRDT support
Third-Party Licenses
See third-party-license/ directory for detailed license information.
Main libraries:
- quill - Rich text editor
- excalidraw - Canvas drawing
- material-ui - UI components (used in all editors)
- yjs - CRDT for collaboration (used in all editors)
Notes for Future Development
-
Database Initialization: The README mentions database initialization is no longer needed (commented out). Verify if migrations are handled automatically.
-
Electron Desktop App: Client has Electron configuration (
forge.config.cjs,electron/directory) for desktop builds. Usenpm run desktop:packageordesktop:makefor platform-specific builds. -
Mobile Support: While mentioned in features, mobile implementation details are not visible in the current structure. May require separate mobile app or PWA setup.
-
Testing: Both client and server lack formal test suites. Consider adding Jest/Vitest for client and Jest/Mocha for server.
-
Security: Current setup uses hardcoded credentials in docker-compose. For production, use environment variables or secrets management.
-
SSL: Certificate must be manually placed in
~/certificate/on the server. Consider automated certificate management (Let's Encrypt). -
Offline Support: Yjs provides offline capabilities, but implementation details should be verified for data persistence.
-
Multi-platform Builds: Desktop app supports Linux/Windows/macOS via Electron Forge. Use
desktop:make:winfor Windows cross-compilation.
Quick Reference Commands
# Development
cd client && npm run dev
cd server && npm run build && npm run server
# Production Build
cd script && bash build_package.sh
# Deployment
tar -zxvf package.tar.gz && cd package && podman compose up -d
# Desktop App
cd client && npm run desktop:dev
cd client && npm run desktop:package
cd client && npm run desktop:make
# Server Management
cd server && npm run build
cd server && npm run dev # with containers
Project Metadata
- Version: Client v0.8.65, Server v1.0.0
- License: MIT
- Repository: https://github.com/redTreeOnWall/memorains
- Demo: https://note.lirunlong.com/doc/client/
What's inside
9 sections covering overview, architecture, setup, conventions, dependencies, licenses, future notes, commands, and metadata
Change this for your project
- Replace
redTreeOnWall/memorainswith your repository URL - Replace
note.lirunlong.comwith your own domain - Replace
MYSQL_ROOT_PASSWORD=123456and other database credentials - Replace
~/certificate/path with your SSL certificate location
Where it goes
Save in docs/ or the repository root. Gives agents and new contributors a map of the codebase.
Worth borrowing
- Using Yjs for conflict-free real-time collaboration across editors
- Proxying WebSocket connections through Nginx with dynamic port ranges
- Packaging client, server, database schema, and infrastructure configs into a single deployable tarball
Related Documents
PCB Design Sources for Industry-Scale Testing
Lists GitHub repos and communities where you can download real PCB designs for testing optimization at scale.
Design Document: BharatSeva AI
Describes a 10-agent AWS system that helps India's informal workers access government schemes via voice-first, serverless architecture.
OpenClaw Enterprise Transformation Plan
Transforms a single-user AI agent into a dual-mode platform supporting both viral open-source and Fortune 500 enterprise deployments through phased security, IAM, audit, multi-tenancy, and Kubernetes features.
Qwen Image and Edit: Open-sourcing and Local GGUF Generations with Lightning
Documents the Qwen-Image and Qwen-Image-Edit models, covering architecture, training, benchmarks, ComfyUI setup, and prompting techniques for local GGUF deployment.