docs: rewrite README for Electron migration
Update documentation to reflect the transition from Tauri to Electron: - Document Electron as primary desktop runtime - Update development workflow and npm scripts - Add project structure and security sections - Note packaging status (Electron Forge needed for releases) - Keep reference to legacy Tauri script
This commit is contained in:
164
README.md
164
README.md
@@ -1,85 +1,139 @@
|
||||

|
||||
|
||||
# Tauri + React + Typescript
|
||||
# Nextcloud Notes Desktop
|
||||
|
||||
# Nextcloud Notes - Cross-Platform Desktop App
|
||||
A desktop client for [Nextcloud Notes](https://apps.nextcloud.com/apps/notes) built with React, TypeScript, Vite, and Electron.
|
||||
|
||||
A modern, cross-platform desktop application for [Nextcloud Notes](https://apps.nextcloud.com/apps/notes) built with Tauri + React + TypeScript.
|
||||
This project started life as a Tauri app and has now been migrated to Electron for desktop runtime support, PDF export, and simpler cross-platform desktop behavior during development.
|
||||
|
||||
## Features
|
||||
## What It Does
|
||||
|
||||
- ✅ **Cross-platform**: macOS, Linux, Windows
|
||||
- ✅ **Lightweight**: ~600KB binary (vs 150MB+ Electron)
|
||||
- ✅ **Modern UI**: React + TailwindCSS
|
||||
- ✅ **Full sync**: Create, edit, delete, favorite notes
|
||||
- ✅ **Search & filter**: Find notes quickly, filter by favorites
|
||||
- ✅ **Auto-save**: Changes save automatically after 1.5s
|
||||
- ✅ **Secure**: Credentials stored in system keychain (localStorage for now)
|
||||
- ✅ **Background sync**: Auto-sync every 5 minutes
|
||||
- Sign in to a Nextcloud server with Notes enabled
|
||||
- Sync notes from WebDAV and favorite state from the Notes API
|
||||
- Create, edit, move, rename, and delete notes
|
||||
- Organize notes into categories, including nested categories
|
||||
- Mark notes as favorites
|
||||
- Cache notes locally for faster startup and offline viewing
|
||||
- Upload and render note attachments
|
||||
- Preview Markdown while editing
|
||||
- Export notes to PDF
|
||||
- Use a focus mode for distraction-free editing
|
||||
|
||||
## Prerequisites
|
||||
## Current Runtime
|
||||
|
||||
- **Rust**: Install from https://rustup.rs/
|
||||
- **Node.js**: v18+ recommended
|
||||
- **Nextcloud instance** with Notes app enabled
|
||||
- Primary desktop runtime: Electron
|
||||
- Frontend: React 19 + TypeScript + Vite
|
||||
- Styling: Tailwind CSS
|
||||
- Local cache: IndexedDB
|
||||
- Nextcloud integration:
|
||||
- WebDAV for note files, folders, attachments, and category color storage
|
||||
- Notes API for favorite metadata
|
||||
|
||||
Some Tauri-related code and dependencies are still present in the repository, mainly because parts of the app were built during the earlier Tauri phase. The Electron path is the actively used desktop runtime.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node.js 18 or newer
|
||||
- npm
|
||||
- A Nextcloud instance with the Notes app enabled
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Run the Electron app with the Vite dev server:
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
npm run dev:desktop
|
||||
```
|
||||
|
||||
# Run in development mode
|
||||
npm run tauri dev
|
||||
Useful scripts:
|
||||
|
||||
# Build for production
|
||||
npm run tauri build
|
||||
```bash
|
||||
npm run dev:renderer # Vite frontend only
|
||||
npm run dev:electron # Electron only, expects renderer on port 1420
|
||||
npm run build # TypeScript + Vite production build
|
||||
npm run desktop # Run Electron against the built dist/
|
||||
```
|
||||
|
||||
## Production-Like Local Run
|
||||
|
||||
Build the frontend, then start Electron against the generated `dist/` files:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
npm run desktop
|
||||
```
|
||||
|
||||
## First Launch
|
||||
|
||||
1. Enter your Nextcloud server URL (e.g., `https://cloud.example.com`)
|
||||
1. Enter your Nextcloud server URL, for example `https://cloud.example.com`
|
||||
2. Enter your username
|
||||
3. Enter your password or **App Password** (recommended)
|
||||
- Generate at: Settings → Security → Devices & Sessions in Nextcloud
|
||||
4. Click **Connect**
|
||||
3. Enter your password or, preferably, a Nextcloud app password
|
||||
4. Wait for the initial sync to finish
|
||||
|
||||
## Building for Distribution
|
||||
Using an app password is strongly recommended.
|
||||
|
||||
### macOS
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/macos/
|
||||
## Notable Behavior
|
||||
|
||||
### Sync model
|
||||
|
||||
- Note files are synced through WebDAV
|
||||
- Favorite status is synced through the Nextcloud Notes API
|
||||
- Notes are cached locally and can still be viewed when offline
|
||||
- Background sync runs periodically while the app is open
|
||||
|
||||
### PDF export
|
||||
|
||||
- In Electron, the toolbar export action saves a PDF directly to disk
|
||||
- Embedded note images are resolved before export when possible
|
||||
|
||||
### Category colors
|
||||
|
||||
- Category color preferences are stored in `.category-colors.json` inside your Nextcloud Notes WebDAV folder
|
||||
|
||||
## Project Structure
|
||||
|
||||
```text
|
||||
electron/ Electron main process and preload bridge
|
||||
src/api/ Nextcloud API and WebDAV client logic
|
||||
src/components/ React UI
|
||||
src/db/ Local IndexedDB cache
|
||||
src/services/ Desktop runtime helpers and sync logic
|
||||
src/printExport.ts Shared print/PDF document generation
|
||||
```
|
||||
|
||||
### Linux
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/appimage/ or .deb
|
||||
```
|
||||
## Security Notes
|
||||
|
||||
### Windows
|
||||
```bash
|
||||
npm run tauri build
|
||||
# Output: src-tauri/target/release/bundle/msi/
|
||||
```
|
||||
- Electron runs with `contextIsolation: true`
|
||||
- `nodeIntegration` is disabled in renderer windows
|
||||
- Network requests that need desktop privileges are routed through Electron IPC instead of renderer-side browser fetch
|
||||
|
||||
## Tech Stack
|
||||
Current limitation:
|
||||
|
||||
- **Tauri**: Rust-based native wrapper (~600KB)
|
||||
- **React 18**: UI framework
|
||||
- **TypeScript**: Type safety
|
||||
- **TailwindCSS**: Utility-first styling
|
||||
- **Vite**: Fast build tool
|
||||
- Login credentials are still persisted in `localStorage`
|
||||
|
||||
## Advantages over Native Swift App
|
||||
That is convenient for development, but it is not the right long-term storage mechanism for a production desktop app. A future improvement should move credentials into the OS keychain or another secure secret store.
|
||||
|
||||
- ✅ **Cross-platform**: One codebase for macOS, Linux, Windows
|
||||
- ✅ **No SwiftUI state issues**: React's state management is mature
|
||||
- ✅ **Smaller binary**: Tauri is much lighter than Electron
|
||||
- ✅ **Easier to maintain**: Web technologies vs platform-specific code
|
||||
- ✅ **No Xcode required**: Build on any platform
|
||||
## Packaging Status
|
||||
|
||||
## Recommended IDE Setup
|
||||
Electron packaging for release builds is not set up yet.
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
||||
Right now, the repository supports:
|
||||
|
||||
- local development with `npm run dev:desktop`
|
||||
- local production-style execution with `npm run build && npm run desktop`
|
||||
|
||||
If you want distributable `.dmg`, `.AppImage`, `.deb`, or `.exe` artifacts, the next step is to add an Electron packaging tool such as Electron Forge or electron-builder.
|
||||
|
||||
## Legacy Tauri Script
|
||||
|
||||
There is still a `npm run tauri` script in `package.json`, but the README and current workflow are centered on Electron.
|
||||
|
||||
## License
|
||||
|
||||
No license file is currently included in this repository.
|
||||
|
||||
Reference in New Issue
Block a user