Initial commit — Drive, an S3 file browser with WOPI editing

Lightweight replacement for the upstream La Suite Numérique drive
(Django/Celery/Next.js) built as a single Deno binary.

Server (Deno + Hono):
- S3 file operations via AWS SigV4 (no SDK) with pre-signed URLs
- WOPI host for Collabora Online (CheckFileInfo, GetFile, PutFile, locks)
- Ory Kratos session auth + CSRF protection
- Ory Keto permission model (OPL namespaces, not yet wired to routes)
- PostgreSQL metadata with recursive folder sizes
- S3 backfill API for registering files uploaded outside the UI
- OpenTelemetry tracing + metrics (opt-in via OTEL_ENABLED)

Frontend (React 19 + Cunningham v4 + react-aria):
- File browser with GridList, keyboard nav, multi-select
- Collabora editor iframe (full-screen, form POST, postMessage)
- Profile menu, waffle menu, drag-drop upload, asset type badges
- La Suite integration service theming (runtime CSS)

Testing (549 tests):
- 235 server unit tests (Deno) — 90%+ coverage
- 278 UI unit tests (Vitest) — 90%+ coverage
- 11 E2E tests (Playwright)
- 12 integration service tests (Playwright)
- 13 WOPI integration tests (Playwright + Docker Compose + Collabora)

MIT licensed.
This commit is contained in:
2026-03-25 18:28:37 +00:00
commit 58237d9e44
112 changed files with 26841 additions and 0 deletions

41
server/db.ts Normal file
View File

@@ -0,0 +1,41 @@
import postgres from "postgres";
import { OTEL_ENABLED, withSpan } from "./telemetry.ts";
const DATABASE_URL =
Deno.env.get("DATABASE_URL") ??
"postgres://driver:driver@localhost:5432/driver_db";
const _sql = postgres(DATABASE_URL, {
max: 10,
idle_timeout: 20,
connect_timeout: 10,
});
/**
* Traced SQL tagged-template proxy.
*
* When OTEL is enabled every query is wrapped in a `db.query` span whose
* `db.statement` attribute contains the SQL template (parameters replaced
* with `$N` placeholders — no user data leaks into traces).
*
* When OTEL is disabled this is the raw postgres.js instance.
*/
// deno-lint-ignore no-explicit-any
const sql: typeof _sql = OTEL_ENABLED
? new Proxy(_sql, {
apply(_target, _thisArg, args) {
// Tagged-template call: sql`SELECT ...`
const [strings] = args as [TemplateStringsArray, ...unknown[]];
const statement = Array.isArray(strings)
? strings.join("$?")
: "unknown";
return withSpan(
"db.query",
{ "db.statement": statement, "db.system": "postgresql" },
() => Reflect.apply(_target, _thisArg, args),
);
},
})
: _sql;
export default sql;