No description
  • Go 41.3%
  • TypeScript 39.5%
  • CSS 9.7%
  • PLpgSQL 5.1%
  • JavaScript 3.9%
  • Other 0.4%
Find a file
2026-09-10 09:52:51 +08:00
backend chore: snapshot current Layla Note baseline 2026-09-10 09:52:51 +08:00
deploy feat: initialize Layla Note core application 2026-09-03 18:54:05 -07:00
frontend chore: snapshot current Layla Note baseline 2026-09-10 09:52:51 +08:00
scripts Harden database migrations and encrypted settings 2026-09-08 08:08:09 -07:00
.dockerignore build: add production Docker image 2026-09-08 03:03:21 -07:00
.env.example Harden database migrations and encrypted settings 2026-09-08 08:08:09 -07:00
.gitignore Harden database migrations and encrypted settings 2026-09-08 08:08:09 -07:00
Dockerfile build: minimize Docker runtime image 2026-09-08 03:06:48 -07:00
README.md Harden database migrations and encrypted settings 2026-09-08 08:08:09 -07:00

Layla Note

Layla Note is a single-user web notebook built around Monaco Editor, explicit Save/Commit semantics, immutable full-text versions, and PostgreSQL-backed resources.

Development

Requirements: Go 1.24+, Node.js 22+, pnpm 11+, PostgreSQL 17+.

cp .env.example .env
cd frontend && pnpm install && pnpm dev
cd backend && go run ./cmd/noteserver

The Vite development server proxies /api to http://127.0.0.1:8080.

CONFIG_ENCRYPTION_KEY is required and must be a stable, independent secret of at least 32 characters. Changing or losing it makes stored AI/Git credentials unreadable. Set MIGRATE_ONLY=true to apply database migrations and exit without starting the HTTP server or background Git worker.

Data semantics

  • Save overwrites document_current and never creates a version.
  • Commit always appends a full-text version, even when content is unchanged.
  • Restore copies historical text to current content without deleting history.
  • Browser edits are protected in IndexedDB before they are explicitly saved.
  • Picture and File resources are referenced as pict://pic_xxx and file://file_xxx.

Workspace search and editor settings

  • The top search field searches saved document names and current content in the selected workspace. Press Enter to search; results are paginated (20/page). Matching is case-insensitive literal substring matching, including % and _; trash and historical versions are excluded.
  • English/Chinese fonts and sizes are presets under My → Editor. Save settings explicitly, then refresh to apply them. Fonts not installed on the client fall back to system fonts.
  • AI references default to the current document and can be removed or extended to up to eight currently opened documents using the paperclip control in the composer. Closing a tab removes its reference. Only Send reads references, using local editing text where available. Oversized context is rejected with a visible message, never silently truncated.
  • AI settings include editable prompt presets and a connectivity test. The test uses the unsaved form values, does not read documents or save settings, and may incur a small provider charge.
  • Document details show live Unicode character counts (with/without whitespace), Chinese characters, English words, line count and UTF-8 bytes, including unsaved edits. These per-document display statistics do not query the database.
  • Settings are stored in PostgreSQL. AI and Git keys are encrypted with AES-256-GCM using CONFIG_ENCRYPTION_KEY and are never returned by the API. Leaving a key blank preserves it; the explicit clear option removes it. Database backups and the encryption key must be protected separately.
  • Notebook creation/import must specify a valid workspace ID. Deleting a space requires clearing notebooks including those in trash.

Regression checks

Run go test ./... and go vet ./... in backend; run the frontend build and tests in frontend. scripts/regression.cjs additionally exercises the deployed API and headless Edge UI using Playwright. It reads login credentials from the local .env, creates uniquely named test spaces, restores the editor settings and removes its own test notebooks/spaces in cleanup. Run only against the development/test environment. TEST_BASE_URL overrides the default development server; NODE_PATH may point to an existing Playwright runtime. AI responses are mocked to avoid provider calls or charges.

Git synchronization

  • Git configuration is scoped per project workspace and stored in PostgreSQL. Disabled configurations never enqueue new Git work; pending work pauses until re-enabled.
  • A document submit snapshots its new database version and one Git file in the same database transaction. A notebook submit snapshots each selected document. Git is pushed asynchronously in submission order; a push/path failure never rolls back or duplicates the database version and can be retried or abandoned from My → GIT repository configuration.
  • Paths are optional-prefix/notebook/folder/document. Layla Note updates only submitted paths and does not delete repository files. It refuses to overwrite a same-path remote file it does not recognize or that changed outside Layla Note.
  • Only HTTPS repositories are accepted. Tokens are not returned by the API or included in Git command arguments; encrypted tokens are stored separately from ordinary settings.
  • TestGitIntegration is opt-in (LAYLA_INTEGRATION_DATABASE_URL) and uses a disposable HTTPS Git server plus uniquely named database rows to verify single-file and notebook behavior, queue pausing, idempotent retry, file preservation, and collision protection.