RustPad 0.0.1
Collaborative Markdown editor with standalone notes and workspaces.
Development setup
./dev.sh
The script creates data/db and data/files, builds the project, and runs it with Cargo. When Cargo is unavailable, it uses docker compose up --build.
Functions (Workspaces)
- real-time collaborative editing over WebSocket,
- nickname remembered in
localStorage, - change authors in history,
- line numbering enabled by default with a persistent toggle,
- owner color next to each line,
- upload images and files to
data/files/pads/<id>_<token>/lubdata/files/notes/<id>_<token>/, - automatic Markdown link insertion after upload,
- Markdown i diagramy Mermaid,
- history with snippets, previews, and version restore.
Data
- SQLite:
data/db/rustpad.db, - files:
data/files/pads/<id>_<token>/idata/files/notes/<id>_<token>/; the public URL has the form/f/<token>/<nazwa>.
In Docker, both directories are located under /data.
Publishing a note as a page
Use the Page button in the editor. RustPad creates a permanent public /s/<token> address, copies it to the clipboard, and opens it in a new tab. The page displays the current note content and renders Markdown, images, links, and Mermaid. Publishing a protected note requires the password, but the published link itself is public.
Limit uploadu
The maximum size of a single file is configured with UPLOAD_MAX_SIZE_MB w .env, np. UPLOAD_MAX_SIZE_MB=50. The default is 20 MB. After changing it, restart the project with ./dev.sh.
Wybór bazy danych
RustPad use db engine via DATABASE_URL:
- SQLite:
sqlite:///data/db/rustpad.db?mode=rwc&journal_mode=WAL&busy_timeout=5000 - PostgreSQL:
postgres://rustpad:rustpad@postgres:5432/rustpad - MySQL:
mysql://rustpad:rustpad@mysql:3306/rustpad
SQLite pozostaje domyślną bazą dla developmentu i małych instalacji. Tryb WAL pozwala czytać podczas zapisu, ale SQLite nadal wykonuje tylko jeden zapis naraz. busy_timeout=5000 powoduje krótkie oczekiwanie zamiast natychmiastowego błędu database is locked. Przy wielu równoczesnych edytorach lub wielu instancjach aplikacji zalecany jest PostgreSQL albo MySQL.
Opcjonalne db inDocker Compose:
# PostgreSQL
docker compose --profile postgres up -d postgres
DATABASE_URL=postgres://rustpad:rustpad@postgres:5432/rustpad docker compose up -d rustpad
# MySQL
docker compose --profile mysql up -d mysql
DATABASE_URL=mysql://rustpad:rustpad@mysql:3306/rustpad docker compose up -d rustpad
Migracje są rozdzielone w migrations/sqlite, migrations/postgres i migrations/mysql. Zapytania aplikacji znajdują się centralnie w src/queries.rs, a src/database.rs odpowiada za wybór sterownika i konfigurację połączenia.
Optional user accounts and password reset
Nicknames can still be used anonymously while they remain unregistered. Registering a nickname reserves it and requires a valid login session before it can be used in editor WebSocket connections. Configure PUBLIC_URL, SMTP_HOST, SMTP_PORT, SMTP_USERNAME, SMTP_PASSWORD, and SMTP_FROM to enable password-reset e-mails. Reset links expire after 30 minutes and are single-use.
Database query layout
All runtime SQL statements are centralized in src/queries.rs. Backend modules reference named constants, which keeps database-specific debugging and query review in one place.
Diagnostics and logging
Server logs use tracing. Configure verbosity with RUST_LOG, for example:
RUST_LOG=rustpad=debug,tower_http=info
Important lifecycle, database, authentication, password-reset and WebSocket events are logged. Passwords, session tokens, reset tokens, SMTP credentials and authorization headers are never logged.
Browser diagnostics are configured separately from backend logs with FRONTEND_LOG_LEVEL. Supported values are off, error, warn, info, and debug; the default is warn. URL parameters cannot enable diagnostics. Use debug only in trusted development environments. Production should normally use warn or error.
Rejestracja i SMTP
REGISTRATION_ENABLED=true włącza rejestrację. Po utworzeniu konta aplikacja wysyła przez SMTP wiadomość z nickiem i adresem PUBLIC_URL. ACCOUNT_CONFIRMATION_REQUIRED=true wymaga dodatkowo kliknięcia linku potwierdzającego przed logowaniem; domyślnie opcja jest wyłączona i wymaga skonfigurowanego SMTP.