This repository contains the Legaci web app (frontend + backend) — an interactive, privacy-first memory & persona system with a 3D disco-ball UI, RAG, and optional voice features.
Quick links (important files)
backend/src/worker/embeddingsWorker.ts:1
backend/src/worker/voiceWorker.ts:1
backend/src/app/api/sources/ingest/route.ts:1
backend/src/lib/embeddings.ts:1
backend/src/lib/qdrant.ts:1
frontend/src/lib/shaders/discoBall.ts:1
frontend/src/components/DiscoBall.tsx:1
frontend/src/components/InspectorPanel.tsx:1
frontend/src/components/ChatPanel.tsx:1
backend/src/lib/auth.ts:1
backend/src/lib/session.ts:1
backend/src/lib/crypto.ts:1
backend/src/app/api/voice/consent/route.ts:1
, backend/src/app/api/voice/clone/route.ts:1
backend/src/app/api/voice/profiles/[id]/route.ts:1
Summary of recent additions
backend/src/lib/session.ts:1
/api/auth/logout
— backend/src/app/api/auth/logout/route.ts:1
/api/auth/sessions/revoke
— backend/src/app/api/auth/sessions/revoke/route.ts:1
voice_profiles
row: backend/src/app/api/voice/consent/route.ts:1
/api/voice/clone
enqueues a background job: backend/src/app/api/voice/clone/route.ts:1
backend/src/worker/voiceWorker.ts:1
/api/voice/profiles/:id
enqueues provider deletion + local purge: backend/src/app/api/voice/profiles/[id]/route.ts:1
backend/src/app/api/test/login-as/route.ts:1
playwright.config.ts:1
tests/e2e/voice-lifecycle.spec.ts:1
Development setup (local)
backend/.env
(see Environment variables below).Playwright E2E (local)
/api/test/login-as
to create a session cookie for a test user. This is gated by PLAYWRIGHT_TESTING=true
to avoid exposing the helper in production.Environment variables
Add a .env
in backend/
(or place in your deployment env). Minimum variables for dev/testing:
Common dev commands
How ingest → embeddings works (quick)
/api/sources/ingest
(backend/src/app/api/sources/ingest/route.ts:1
)/api/embeddings/status/:jobId
(backend/src/app/api/embeddings/status/[id]/route.ts:1
).Voice consent & cloning (summary)
/api/voice/consent
(protected by session). See backend/src/app/api/voice/consent/route.ts:1
./api/voice/clone
— enqueues a background job processed by backend/src/worker/voiceWorker.ts:1
./api/voice/profiles/:id
enqueues a deletion job handled by the voice worker. See backend/src/app/api/voice/profiles/[id]/route.ts:1
.Troubleshooting
npx prisma generate
ran in backend
and that @prisma/client
is installed.REDIS_URL
, and that bullmq
& ioredis
are installed in backend.QDRANT_URL
/ QDRANT_API_KEY
.NEXTAUTH_URL
correctly.Security & privacy reminders
backend/src/lib/crypto.ts:1
helpers for AES‑GCM field encryption.FIELD_ENCRYPTION_KEY
in KMS for production.Where to read code (important files)
backend/src/lib/auth.ts:1
backend/src/app/api/auth/register-passkey/route.ts:1
, backend/src/app/api/auth/register-passkey/verify/route.ts:1
, backend/src/app/api/auth/login-passkey/route.ts:1
, backend/src/app/api/auth/login-passkey/verify/route.ts:1
backend/src/lib/session.ts:1
backend/src/app/api/voice/consent/route.ts:1
, backend/src/app/api/voice/clone/route.ts:1
backend/src/worker/embeddingsWorker.ts:1
and voice worker backend/src/worker/voiceWorker.ts:1
backend/src/app/api/test/login-as/route.ts:1
tests/e2e/voice-lifecycle.spec.ts:1
If you want, I will:
docs/privacy-consent.md:1
); orWhich should I do next?
This project includes Playwright E2E tests ([
playwright.config.ts:1](playwright.config.ts:1)
and [
tests/e2e/voice-lifecycle.spec.ts:1](tests/e2e/voice-lifecycle.spec.ts:1)
). Below are recommended CI and local strategies for running the tests reliably, including provider-mock options.
1) CI overview (GitHub Actions)
npx prisma generate
for backend
.npx playwright test
.2) Mocking vs running the real provider
sim-...
voice IDs. This is supported by the worker implementation in [
backend/src/worker/voiceWorker.ts:1](backend/src/worker/voiceWorker.ts:1)
.3) Local developer flow for E2E
pnpm -C backend dev
node -r ts-node/register ./backend/src/worker/voiceWorker.ts
node -r ts-node/register ./backend/src/worker/embeddingsWorker.ts
PLAYWRIGHT_TESTING=true
in backend/.env
npx playwright test
[
/api/test/login-as](backend/src/app/api/test/login-as/route.ts:1)
to create a session cookie so tests can bypass WebAuthn; this helper is gated by PLAYWRIGHT_TESTING=true
and must not be enabled in production.4) Debugging CI failures
ELEVENLABS_API_KEY
).FIELD_ENCRYPTION_KEY
and DATABASE_URL
are set in the CI environment.5) Files to inspect
[
playwright.config.ts:1](playwright.config.ts:1)
[
tests/e2e/voice-lifecycle.spec.ts:1](tests/e2e/voice-lifecycle.spec.ts:1)
[
backend/src/app/api/test/login-as/route.ts:1](backend/src/app/api/test/login-as/route.ts:1)
[
backend/src/worker/voiceWorker.ts:1](backend/src/worker/voiceWorker.ts:1)
If you want, I can also:
.github/workflows/e2e.yml
.tests/mocks/provider-mock.ts
and a small helper that CI can run before tests.