Speed up the app, run production build, remove chunk ink, start App.jsx split

Performance:
- Lazy-load pages, docx, and mammoth (initial JS 1,298 KB -> ~290 KB)
- Gzip responses and cache hashed assets for a year
- Memoize DrawCanvas strokes so ink isn't redrawn on every render
- Precompute whole-Bible search index and defer the query while typing
- Reload once if a lazy chunk is missing after a deploy

Deployment:
- setup.sh builds and runs one production server on APP_PORT (default
  5173); --dev keeps the old Vite dev setup
- Session cookie uses secure: 'auto' so login works behind any proxy

Chunk editor:
- Remove the Draw layout, Ink Notes panel, and ink in HTML export
  (existing inkStrokes data is left in saved projects)

Refactor:
- Move module-level helpers out of App.jsx into src/utils/*
- Extract Bible reader state and logic into hooks/useBibleReader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Opus 5.5 committed 2026-09-22 14:34:13 -04:00
1 parent 00932dee4a
commit ade7f1af6f
20 files changed
+1314 -1252

No files matched your search

+14 -12
View File
@@ -12,7 +12,7 @@ A self-hosted Bible study tool with notes, projects, and user accounts.
---
## Quick Start (Development)
## Quick Start
```bash
git clone https://github.com/nmemmert/study-bible-project.git
@@ -20,24 +20,26 @@ cd study-bible-project
bash setup.sh
```
`setup.sh` installs dependencies, finds a free port, and starts both servers:
`setup.sh` installs dependencies, builds the optimized frontend, and runs one
production server (frontend + API) on **http://localhost:5173**. Set `APP_PORT`
to use a different port. If the build fails, the previously running server is
left untouched. `bash restart.sh` pulls the latest code and does the same.
| Server | Default URL |
|--------|-------------|
| API (Express) | http://localhost:3001 |
| Frontend (Vite) | http://localhost:5173 |
**Stop the servers:**
**Stop / logs:**
```bash
kill $(cat .api.pid) $(cat .vite.pid)
kill $(cat .api.pid)
tail -f .api.log
```
**View logs:**
### Development mode (hot reload)
```bash
tail -f .api.log # API server
tail -f .vite.log # Vite dev server
bash setup.sh --dev
```
Starts the API on http://localhost:3001 and the Vite dev server on
http://localhost:5173. Dev mode is much slower, so don't use it for real users.
---
## Production Install (Ubuntu / systemd)