Imported from bare git on Zurich
Go to file
James 31d6cb6f86 fix: skip store copy if file already exists (reprocess safety)
When reprocessing a document whose PDF is already in the store,
copyFile() would fail with 'open /srv/docsys/inbox/...: no such file
or directory' because the upload wrote to a temp inbox path that was
already cleaned up by the time async OCR completed.

The store is keyed by content hash so if the file is already there,
the copy is a no-op — skip it rather than error out.
2026-03-23 14:27:38 -04:00
static Initial commit 2026-02-04 13:37:26 -05:00
templates chore: auto-commit uncommitted changes 2026-02-28 06:01:28 -05:00
.gitignore Initial commit 2026-02-04 13:37:26 -05:00
AGENTS.md Initial commit 2026-02-04 13:37:26 -05:00
BOOTSTRAP.md Initial commit 2026-02-04 13:37:26 -05:00
HEARTBEAT.md Initial commit 2026-02-04 13:37:26 -05:00
IDENTITY.md Initial commit 2026-02-04 13:37:26 -05:00
README.md Initial commit 2026-02-04 13:37:26 -05:00
SOUL.md Initial commit 2026-02-04 13:37:26 -05:00
TOOLS.md Initial commit 2026-02-04 13:37:26 -05:00
USER.md Initial commit 2026-02-04 13:37:26 -05:00
ai.go fix: skip store copy if file already exists (reprocess safety) 2026-03-23 14:27:38 -04:00
ai.go.bak-20260228-005328 chore: auto-commit uncommitted changes 2026-02-28 06:01:28 -05:00
db.go fix: format=md endpoint now returns full OCR text (full_text field) 2026-03-23 14:07:20 -04:00
docsys.bak-20260225-134659 chore: auto-commit uncommitted changes 2026-02-25 18:01:27 -05:00
docsys.service Initial commit 2026-02-04 13:37:26 -05:00
go.mod Initial commit 2026-02-04 13:37:26 -05:00
go.sum Initial commit 2026-02-04 13:37:26 -05:00
install.sh Initial commit 2026-02-04 13:37:26 -05:00
main.go fix: format=md endpoint now returns full OCR text (full_text field) 2026-03-23 14:07:20 -04:00
migrate-ids.sh Add migration script for hash-based IDs to date-slug format (31 docs migrated) 2026-02-10 00:34:44 -05:00
progress.go Initial commit 2026-02-04 13:37:26 -05:00
smb.go Initial commit 2026-02-04 13:37:26 -05:00
test_stats.go Initial commit 2026-02-04 13:37:26 -05:00

README.md

DocSys 📁

A beautiful, modern document management web UI built in Go.

Dashboard

Features

  • 🎨 Modern UI - Clean design with Sora font, Tailwind CSS, smooth animations
  • 🌙 Dark Mode - Toggle between light and dark themes
  • 🔍 Full-Text Search - Search across all OCR content using SQLite FTS5
  • 📱 Mobile Responsive - Works great on all devices
  • 📄 PDF Viewer - Inline PDF viewing with PDF.js
  • 🏷️ Categories - Organize documents by type (taxes, bills, medical, etc.)
  • 📤 Drag & Drop Upload - Easy file upload to inbox
  • ✏️ Edit Metadata - Update titles, categories, and notes
  • 📊 Export CSV - Export filtered results for analysis
  • htmx Powered - Fast, lightweight interactivity without heavy JS

Tech Stack

  • Backend: Go with Chi router
  • Database: SQLite with FTS5 for full-text search
  • Frontend: Tailwind CSS, htmx, PDF.js
  • Font: Sora (Google Fonts)

Installation

Prerequisites

  • Go 1.22+
  • Documents directory at ~/documents/ with:
    • records/{category}/*.md - Document record files
    • store/*.pdf - PDF files
    • index/ - Database directory

Build

cd /home/johan/dev/docsys

# Build with FTS5 support
CGO_ENABLED=1 go build -tags "fts5" -o docsys .

Run

./docsys
# Server starts at http://localhost:9201

Install as Service

chmod +x install.sh
./install.sh

Configuration

The app uses these default paths:

Path Purpose
~/documents/records/{category}/*.md Document record files
~/documents/store/*.pdf PDF storage
~/documents/index/docsys.db SQLite database
~/documents/inbox/ Upload inbox

API Endpoints

Endpoint Method Description
/ GET Dashboard
/browse GET Category browser
/browse/{category} GET Documents in category
/document/{id} GET Document detail view
/search?q= GET Search page
/pdf/{hash} GET Serve PDF file
/api/search POST HTMX search
/api/documents GET List documents (JSON)
/api/upload POST Upload file to inbox
/api/document/{id} PUT Update document
/api/document/{id} DELETE Delete document
/api/export GET Export to CSV
/api/reindex POST Rebuild index

Document Record Format

Documents are stored as Markdown files:

# Document Record

**ID:** abc123def
**Original File:** invoice.pdf
**Processed:** 2026-01-15T10:30:00
**Category:** bills
**Type:** invoice

## Extracted Info

| Field | Value |
|-------|-------|
| Date | January 15, 2026 |
| Vendor | Example Corp |
| Amount | $99.99 |

## Summary

Brief summary of the document...

## Full Text

OCR text content here...


## Files

- **PDF:** [store/abc123def.pdf](../../store/abc123def.pdf)

License

MIT