DocuDesk
A document hub for small teams: upload files, find any sentence inside them, and get answers that point to the exact page.
1 Problem
Important knowledge sits inside PDFs and Word files — contracts, policies, reports. Shared drives can only search file names, so finding one clause means opening documents one by one and reading.
2 Target users
- Small offices and agencies with many contracts and policies
- Operations and HR people who answer questions from documents
- Anyone who needs to show where an answer came from
3 User pain points
- Search only matches file names, not what is inside
- No way to tell which version of a file is current
- Answers from memory cannot be checked
- Sharing a file by email loses control of who has it
4 Existing workflow limitations
- Folders and naming rules break down as files grow
- Comparing two versions means reading both side by side
- Sharing links never expire
- AI chat tools answer confidently without showing their source
What people use today: Shared drives and email attachments, or large document-management suites that need set-up and training.
5 Product solution
DocuDesk reads the text of every PDF, Word and text file on upload, stores it page by page in a PostgreSQL full-text index, and answers questions by quoting the best-matching passages with their page numbers. Versions, line-by-line comparison, expiring share links, trash and restore make it safe to use day to day.
6 User journey
- Upload a PDF, Word or text file (type checked from its bytes)
- The text is read and split into page passages
- Search with normal words, or ask a question
- Open the source at the page that answers it
- Upload a new version, compare the changes, restore if needed
- Share a read-only link that expires
7 Technical architecture
Shared by all 11 products
- Monorepo with one shared core package (sign-in, database, migrations, file storage, AI helper, rate limits, UI shell) and one Next.js app per product.
- Next.js 16 App Router with React 19 Server Components; changes go through server actions, and every action checks the session again on the server.
- PostgreSQL through postgres.js; schema changes are ordered migrations stored in the code. Development uses an embedded PostgreSQL (PGlite).
- Files go to storage behind one interface: the local disk while developing, a private cloud bucket in production.
- Optional Claude features go through one helper with spending limits per workspace and per server; if there is no key or a call fails, a free built-in method answers instead.
Specific to DocuDesk
- Upload: the file type is decided from its first bytes; PDFs are read with unpdf, Word files with a small built-in .docx reader (a .docx is a ZIP with XML inside), text files directly.
- Indexing: each page becomes passages in a table with a generated tsvector column; documents also get a weighted vector (title A, text B).
- Questions: meaningful words become an OR query, passages are ranked with ts_rank_cd, and the best sentence of the top passage is quoted.
- Insights (summary, key facts, document type) are built-in and extractive by default, so they never invent text; Claude can write them when a key is set.
8 Database design
Documents, page passages (with a generated full-text vector), versions, folders, share links, favourites and views, activity and saved insights. Every row carries its workspace id and every query filters on it.
10 tables, read from the migrations in the code:
dd_folders 5 columns
id, workspace_id, name, created_at, restricted
dd_documents 22 columns
id, workspace_id, folder_id, title, file_name, mime, size_bytes, pages, storage_key, content, tags, uploaded_by, created_at, updated_at, tsv, trashed_at, archived_at, version, version_note, sha256, meta, category
dd_chunks 7 columns
id, document_id, workspace_id, idx, page, body, tsv
dd_activity 7 columns
id, workspace_id, user_id, document_id, action, detail, created_at
dd_favorites 3 columns
user_id, document_id, created_at
dd_views 3 columns
user_id, document_id, viewed_at
dd_versions 13 columns
id, document_id, workspace_id, version, note, file_name, mime, size_bytes, pages, storage_key, sha256, uploaded_by, created_at
dd_insights 8 columns
document_id, workspace_id, version, source, summary, category, facts, created_at
dd_shares 8 columns
token, document_id, workspace_id, created_by, expires_at, revoked_at, views, created_at
dd_settings 2 columns
workspace_id, trash_days
9 API implementation
Most work runs through server actions. Two file routes stream stored files with safe headers: one for the signed-in team, one for expiring share links.
16 screens and 4 route handlers, read from the code:
GET /api/account/exportGET /api/exportGET /api/files/:idGET /api/health//app/app/account/app/activity/app/ask/app/compare/app/doc/:id/app/help/app/notifications/app/start/forgot/invite/:token/login/reset/:token/s/:token/signup10 Important technical decisions
Ranked search with stemming is built in, needs no extra service, and stays cheap to run. Answers quote real passages, so they can always be checked.
Every answer can say which page it came from, so a person can verify it in seconds.
Without a key the app quotes the best passage; with a key Claude writes a short answer that must cite the passages — if it cites none, the answer is marked “unverified”.
Fewer dependencies to maintain; both are small and tested.
11 Trade-offs
Keyword full-text search, not semantic search
Cost: A question worded differently from the document (“holiday” vs “annual leave”) can miss. Stemming helps; synonyms do not.
Read the text layer only, no OCR
Cost: Scanned PDFs upload but have no text to search. OCR needs a paid service, so it waits.
Quote passages instead of writing answers by default
Cost: Answers read less smoothly than a chat reply, but every word can be checked on its page.
12 AI capabilities
- Question answering grounded in the team's own documents, with page citations
- Summary, key facts and document type — marked unverified until a person checks them
- Spending limits per workspace and per server, with a free fallback when the limit is reached
13 Security and permissions
- Every query is scoped to the signed-in workspace; ids from the browser are never trusted alone
- File types are detected from bytes; scripts (SVG, HTML) are refused
- Files are served as downloads with nosniff and a sandboxing policy
- Share links are random tokens with an expiry date and can be revoked
- Passwords hashed with scrypt; session tokens stored only as SHA-256 hashes
14 Testing
Browser tests click through the real flows (upload, search, ask, versions, compare, share, trash) against a fresh demo workspace; unit tests cover the text comparison, the .docx reader, question terms and the built-in insights.
Counted from the code on 27 November 2026.
15 Challenges and debugging
Bug: Answers quoted a PDF heading glued to the sentence below it.
Fix: Line breaks now count as sentence boundaries when picking the best sentence. A remaining limit is documented: the built-in summary can keep a heading that shares a line with text.
Bug: A Claude answer could sound right without pointing at any passage.
Fix: Answers that cite none of the retrieved passages are labelled “unverified”, so nobody mistakes them for a sourced answer.
Bug: Comparing two very large versions could hang the server.
Fix: The line-by-line comparison caps its input size and says when a document is too long to compare in full.
Bug: While adding AI usage tracking, “Ask your docs” turned out to call Claude with its own client, skipping the shared spending limit.
Fix: All Claude calls now go through one core helper that applies the limits, an operator off-switch and a usage record (tokens and estimated cost, never the text).
16 Final outcome
A working document hub with search inside files, sourced answers, versions with compare and restore, and expiring share links — usable without any AI key, and with Claude as an optional upgrade.
17 Evidence of results
- Covered by 21 browser test steps and 19 unit tests (counted from the code on 27 November 2026).
- Production build: about 178 KB of gzipped JavaScript on first load, inside a 250 KB budget checked by scripts/perf-budget.mjs.
- Security suite: 14 browser checks pass on DocuDesk (sign-in limits, roles, two-step sign-in, security headers).
- AI evaluation tests replay recorded Claude outputs: invented facts are flagged, wrong page numbers fixed, and an answer citing no passage is marked unverified.
Usage numbers: none yet — the product is not public. Real numbers will be added after launch, never estimates.
18 User feedback
No outside users yet. Feedback from the first testers will be added here word for word, with what changed because of it.
19 Future improvements
- OCR for scanned PDFs (needs a paid service)
- Malware scanning of uploads
- Semantic search alongside keyword search
- Folder access per person (today: per role — owners and admins only, or everyone)