No description
  • TypeScript 56.8%
  • Go 41.9%
  • CSS 0.7%
  • Dockerfile 0.3%
  • Nix 0.2%
Find a file
cola 3fc41f793d fix: serve correspondent master from parties table
The correspondent endpoints read and wrote the legacy `correspondents`
table while `post_document` resolves `correspondentId` as a party id.
Both tables have their own autoincrement, so once a party existed that
was not a correspondent the ids drifted and external clients — which
take an id from the correspondent list and post it back — attached
documents to whoever else held that number. Serve the list, create,
update and delete from `parties` so the id a client reads is the id the
archive resolves.

Creating through the legacy endpoint now reuses the existing party
instead of failing on UNIQUE(type, name), and linking a document to an
id that is not a party reports it plainly rather than surfacing a bare
foreign key error.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-03 13:40:33 +07:00
apps/web fix: streamline related party editing 2026-08-21 17:45:47 +07:00
cmd/archive-server feat: redesign archive workspace and search 2026-08-10 06:07:07 +07:00
docs feat: add scoped SIA document integration 2026-08-07 22:45:16 +07:00
internal fix: serve correspondent master from parties table 2026-09-03 13:40:33 +07:00
.dockerignore innitial 2026-05-02 06:05:21 +07:00
.env.example feat: add scoped SIA document integration 2026-08-07 22:45:16 +07:00
.env.production.example feat: initialize project with check.go, configure local settings and syncthing markers, and update gitignore patterns 2026-07-01 19:13:36 +07:00
.gitignore feat: add check.go utility and update .gitignore with production and local configuration patterns 2026-07-01 19:17:40 +07:00
check.go feat: add check.go utility and update .gitignore with production and local configuration patterns 2026-07-01 19:17:40 +07:00
docker-compose.yml chore: update service configurations in docker-compose.yml 2026-05-02 14:13:40 +07:00
Dockerfile fix: copy frontend dist into runtime stage and fix container paths 2026-05-02 14:19:08 +07:00
flake.lock build: add Nix development shell 2026-08-07 19:50:39 +07:00
flake.nix build: add Nix development shell 2026-08-07 19:50:39 +07:00
go.mod innitial 2026-05-02 06:05:21 +07:00
go.sum innitial 2026-05-02 06:05:21 +07:00
Makefile innitial 2026-05-02 06:05:21 +07:00
README.md feat: add scoped SIA document integration 2026-08-07 22:45:16 +07:00

Arsip Dokumen Internal

Aplikasi internal untuk arsip dokumen sekolah dengan metadata Jenis Arsip, Koleksi, Pihak Terkait, status klasifikasi, OCR searchable PDF, pencarian full text (SQLite FTS5), dan Casdoor SSO.

Panduan model klasifikasi dan penggunaan metadata tersedia di docs/archive-metadata.md. Panduan upload dan pembatasan akses siswa untuk SIA tersedia di docs/sia-integration.md.

Arsitektur singkat

  • Backend Go (chi, modernc SQLite, alexedwards/scs, coreos go-oidc)
  • SQLite untuk metadata + FTS5
  • Storage abstraction: lokal atau S3
  • OCR: ocrmypdf + tesseract + img2pdf (dipanggil lewat runner yang bisa di-mock saat test)
  • Frontend React + Vite + Tailwind (tema Civic Ledger) + shadcn-style tokens
  • Auth via Casdoor OIDC, sesi disimpan di memori scs
  • Vite dev mem-proxy /api ke backend Go, sedangkan build apps/web/dist diserve langsung oleh backend Go

Local Development

NixOS / Nix development shell

Repository menyediakan flake.nix dan flake.lock untuk menyiapkan Go, Node.js, serta seluruh tool OCR tanpa instalasi global. Pastikan Nix dengan dukungan flakes sudah aktif, lalu dari root repository jalankan:

nix develop

Dev shell menyediakan Go, Node.js 22, npm, OCRmyPDF, Tesseract dengan data bahasa Indonesia dan Inggris, img2pdf, pdftotext, serta Python dengan pdfminer. Pastikan tool OCR tersedia dengan:

go version
node --version
ocrmypdf --version
tesseract --list-langs
pdftotext -v

Output tesseract --list-langs harus memuat ind dan eng.

Setelah masuk ke dev shell, siapkan aplikasi dan jalankan test:

cp .env.example .env
cd apps/web && npm install && cd ../..
go test ./...
cd apps/web && npm test

Pada NixOS, jalankan backend dan frontend di dua terminal yang masing-masing sudah masuk melalui nix develop:

# Terminal 1
go run ./cmd/archive-server
# Terminal 2
cd apps/web
npm run dev

flake.lock mengunci versi nixpkgs agar seluruh pengembang memperoleh toolchain yang sama. Perbarui lockfile secara sengaja dengan nix flake update, lalu commit perubahannya bersama hasil pengujian.

Setup manual

  1. Salin .env.example ke .env dan isi kredensial Casdoor serta storage.

  2. Install dependensi frontend:

    cd apps/web && npm install
    
  3. Jalankan test:

    go test ./...
    cd apps/web && npx vitest run
    
  4. Install browser Playwright sekali:

    cd apps/web && npx playwright install chromium
    
  5. Jalankan server dan frontend:

    make dev
    

    Alternatif terpisah:

    make dev-api
    make dev-web
    
  6. Jalankan smoke e2e:

    cd apps/web && npx playwright test tests/e2e/archive-smoke.spec.ts
    

Build artefak

make build

Menghasilkan bin/archive-server.exe dan bundle Vite di apps/web/dist.

Environment variables utama

  • SESSION_SECRET (wajib)
  • DATABASE_PATH (default data/app.db)
  • STORAGE_BACKEND local atau s3
  • LOCAL_STORAGE_ROOT (default data/files)
  • S3_BUCKET, S3_REGION, S3_ENDPOINT, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY
  • CASDOOR_ISSUER_URL, CASDOOR_CLIENT_ID, CASDOOR_CLIENT_SECRET, CASDOOR_REDIRECT_URL
  • OCR_LANGUAGES (default ind+eng)
  • OCRMYPDF_BIN, TESSERACT_BIN, IMG2PDF_BIN

Struktur folder

  • cmd/archive-server — entrypoint Go
  • internal/app — wiring dependency
  • internal/config — parsing env
  • internal/db — sqlite + migrasi + seed
  • internal/archive — domain arsip (repository, service, indexer, search, OCR job state)
  • internal/masterdata — jenis arsip, koleksi, pihak terkait, dan tags
  • internal/users — repo user lokal yang mirror Casdoor
  • internal/auth — OIDC client + session
  • internal/http — router dan handlers
  • internal/http/handlers — arsip, auth, master data, dashboard, admin
  • internal/http/middleware — require auth / require admin
  • internal/ocr — pipeline OCR dengan command runner yang bisa di-mock
  • internal/dashboard — ringkasan admin
  • internal/storage — abstraksi local + S3
  • apps/web — React/Vite SPA