Add TRUST_PROXY so Express honors X-Forwarded-Proto from e.g. Nginx Proxy Manager. Without it, SECURE_COOKIES=true behind the proxy meant the session cookie was never set and login didn't stick. Document the NPM setup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Notes
A small PWA for jotting down short notes while reading — e.g. an interesting sentence from a book. Each note is tagged with a topic (existing or new) and can optionally include a page number. Notes are saved as markdown directly into pages of a Nextcloud Collective, one page per topic, nested under a parent page (default: "Reading Notes"). A note's text can be typed by hand or filled in by scanning a photo of the page (on-device OCR via tesseract.js — no image or text ever leaves the device for this step).
Stack
npm workspaces monorepo:
shared/— TypeScript types & Zod schemas shared by client and serverserver/— Express API: session auth, and a Nextcloud integration that talks to both the Collectives OCS API (page metadata/creation) and WebDAV (page content read/append)client/— React + Vite PWA
Setup
- Copy
.env.exampleto.envand fill in:SESSION_SECRET,ADMIN_USERNAME,ADMIN_PASSWORD— the app's own loginNEXTCLOUD_URL,NEXTCLOUD_USERNAME,NEXTCLOUD_APP_PASSWORD— generate an app password under Nextcloud Settings → Security → App passwordsCOLLECTIVE_NAME— the exact name of an existing collective the user has access to
- Install dependencies:
npm install - Run in dev mode:
npm run dev(client onhttp://localhost:5173, proxies/apito the server on port 3000)
Build & run
npm run build
npm run start
Docker
docker compose up --build
Reads secrets from .env in the project root (same variables as above).
Behind Nginx Proxy Manager (HTTPS)
HTTPS is required for the camera scan and the PWA install. Let the proxy terminate TLS and forward to the container over plain HTTP:
- In
.env, setSECURE_COOKIES=trueandTRUST_PROXY=1. WithoutTRUST_PROXYthe server thinks requests are plain HTTP and won't set the secure session cookie, so login doesn't stick. - In Nginx Proxy Manager, add a proxy host: scheme
http, forward to the container's host/IP andHOST_PORT(ornotes:3000if NPM shares a Docker network with it), request an SSL certificate, and enable Force SSL.