Home
Softono
kancelaria-dms

kancelaria-dms

Open source Apache-2.0 HTML
15
Stars
1
Forks
0
Issues
0
Watchers
4 weeks
Last Commit

About kancelaria-dms

# Kancelaria DMS — Apps Script Document Management for Polish Law Firms [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Apps Script](https://img.shields.io/badge/Apps_Script-V8-orange.svg)](https://developers.google.com/apps-script) [![Gemini](https://img.shields.io/badge/AI-Gemini-purple.svg)](https://ai.google.dev/) A complete Document Management System for law firms, built on Google Workspace (Sheets + Apps Script + Drive + Gmail Add-on). Manages cases, clients, deadlines, correspondence, leads (CRM), and Polish Post tracking. Built and used in production by a Polish attorney (radca prawny) for his own practice (ktzr.pl). ## Features - **Case management** — cases, parties, courts, signatures, attorneys - **Task & deadline tracking** — calendar integration, email reminders - **Email integration** — Gmail Add-on, automatic email-to-case matching with Gemini AI - **Document AI** — automatic summarization of Drive documents ...

Platforms

Web Self-hosted

Languages

HTML

Links

Kancelaria DMS — Apps Script Document Management for Polish Law Firms

License: Apache 2.0 Apps Script Gemini

A complete Document Management System for law firms, built on Google Workspace (Sheets + Apps Script + Drive + Gmail Add-on). Manages cases, clients, deadlines, correspondence, leads (CRM), and Polish Post tracking.

Built and used in production by a Polish attorney (radca prawny) for his own practice (ktzr.pl).

Features

  • Case management — cases, parties, courts, signatures, attorneys
  • Task & deadline tracking — calendar integration, email reminders
  • Email integration — Gmail Add-on, automatic email-to-case matching with Gemini AI
  • Document AI — automatic summarization of Drive documents (Gemini)
  • CRM — leads, contacts, follow-ups
  • Polish Post tracking — shipment book with status updates
  • Dashboard — modern responsive UI in sidebar / web app

Tech Stack

  • Google Apps Script (V8 runtime)
  • Google Sheets (as database)
  • Google Drive (file storage)
  • Gmail API + CardService (add-on)
  • Gemini API (document summarization, email matching)
  • Bootstrap 5 + Chart.js (UI)

Setup

  1. Create a new Google Sheet — this will be your DMS database.
  2. Extensions → Apps Script — paste contents of Code.gs, Index.html, and appsscript.json (you'll need to enable manifest editing in Project Settings).
  3. Project Settings → Script Properties — add the following keys. The code reads these automatically — no further edits needed.
    • GEMINI_API_KEY — get one from https://aistudio.google.com/apikey
    • CRM_DRIVE_PARENT_ID — Drive folder ID where lead folders will be created
    • DMS_DRIVE_PARENT_ID — Drive folder ID where case folders will be created
    • FIRM_DOMAIN — Your firm's email domain (e.g. yourfirm.com). Used for incoming/outgoing email classification. If left unset, all emails will be classified as "incoming".
  4. (Optional) External users access — If non-domain Google accounts need access to the web app, edit the ALLOWED_EXTERNAL array near the top of Code.gs with their emails. Leave empty for domain-only access.
  5. Deploy → New deployment → Web app (Execute as: User accessing the web app).
  6. First run will create all required sheets automatically.
  7. Populate the Prawnicy_DMS sheet with your team's names and emails (the PRAWNICY array in code is just a fallback when the sheet is empty).
  8. To use as a Gmail Add-on: Deploy → Test deployments → Install — the add-on icon appears in Gmail's right sidebar.

    Required OAuth Scopes

This app requests broad scopes — review them in appsscript.json before deploying. The most extensive ones:

  • mail.google.com/ — full Gmail access (labeling correspondence, threading emails to cases, reading attachments)
  • drive — full Drive (creating case folders, uploading documents)
  • spreadsheets — full Sheets (the DMS database)
  • calendar — full Calendar (deadline reminders)

If your firm requires least-privilege OAuth, you'll need to scope these down and disable the corresponding features.

Project Structure

.
├── Code.gs           # All server-side Apps Script logic (~1050 lines)
├── Index.html        # Single-page UI (Bootstrap 5 + vanilla JS, ~1550 lines)
├── appsscript.json   # Manifest — scopes, add-on config
├── README.md         # This file
├── LICENSE           # Apache 2.0
├── SECURITY.md       # Security policy
└── .gitignore

⚠️ Disclaimer

This is a personal project shared as-is, with no warranty. It was built for my own law practice and reflects Polish legal practice conventions (case numbering, court names, post tracking integration with Poczta Polska, etc.).

Before using in production:

  • Run your own security audit
  • Ensure GDPR compliance for your jurisdiction
  • Verify alignment with your professional secrecy obligations
  • This is NOT a certified legal software product
  • All client data stays in YOUR Google Workspace — nothing leaves it except document content sent to Gemini API for summarization (consider whether this aligns with your data processing obligations)

Roadmap

This codebase is feature-complete for my own use. Future development focuses on automation tooling around it.

Author

Adam Piotrowski — radca prawny, ktzr.pl

Contact: [email protected]

License

Apache License 2.0 — see LICENSE.