POC demonstrating Approach 7 from APPROACHES.md. This commit can be
cleanly reverted with `git revert` if the approach is not adopted.
Changes:
- packages/redis/src/index.ts: Add createWidgetPrefetchCache() factory
that creates a cache channel per widget kind (5min TTL)
- packages/widgets/src/prefetch.ts: Check Redis cache before database
queries. On cache miss, falls back to original DB path and writes
through to Redis for the next request.
Expected behavior:
- First page load: cache miss → DB query → write to Redis (same as before)
- Subsequent loads within 5min: cache hit → skip DB queries entirely
- Redis unavailable: falls back to original behavior (no regression)
- Cache invalidation: automatic via 5-minute TTL
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
Documents two new performance optimization strategies in APPROACHES.md:
Approach 7 - Redis-Backed TanStack Query Initial Data:
- Use Redis cache as initialData for TanStack Query
- Cron jobs already populate Redis; read from cache instead of DB
- Estimated 2-5x faster TTFB, ~90% fewer DB queries per page load
- Includes implementation path and code examples
Approach 8 - Client-Side Rendering with ISR Static Shell:
- Serve static HTML shell, fetch data client-side
- Analysis shows this is NOT recommended for Homarr dashboards
- Causes layout shift, breaks hydration, doesn't work with auth
- ISR better suited for content sites, not interactive dashboards
Includes benchmark comparison table and recommendation.
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
Replaces inline docker:test script with scripts/docker-test.sh that:
- Detects and reports architecture (x86_64/arm64)
- Polls health endpoint with configurable timeout (60s)
- Verifies home page, health/live, health/ready endpoints
- Tests WebSocket endpoint reachability
- Proper cleanup on exit via trap
- Supports --skip-build flag for CI caching
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
Close WebSocket, tasks server, and HTTP server before calling
process.exit(1) in the error handler.
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
Documents 6 approaches (implemented, considered, and future) with PROs,
CONs, measured savings, and recommendations for each.
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
docker:build builds the Docker image. docker:test builds, starts the
container, waits 15s, checks port 7575 responds, prints tail logs, and
stops the container.
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
Aligns with Next.js custom server docs by using app.getUpgradeHandler()
to delegate non-WS upgrade requests (e.g. _next/webpack-hmr) to Next.js
instead of silently dropping them. Also adds server.once("error") handler.
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
- Add tasks dependencies (fastify, cron-job-api, cron-jobs, etc.) to nextjs app
- Import and start tasks (JobManager, jobGroup, Fastify cron API) in server.ts
- Update root package.json start script to remove tasks.cjs
- Update scripts/run.sh to run single process
- Update Dockerfile to not copy tasks.cjs
- Disable tasks dev script (no-op)
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>
- Create apps/nextjs/server.ts custom server integrating WebSocket via ws
- Update nextjs scripts to use custom server for dev and start
- Update root start script to remove separate ws server process
- Update client tRPC URL to connect to port 3000 in dev
- Update nginx.conf to route /websockets to port 3000
- Update Dockerfile and run.sh for integrated server
- Disable standalone ws server dev script
- Add benchmark-memory.sh script
Co-authored-by: ajnart <49837342+ajnart@users.noreply.github.com>