u/Royal-Method-9965

I'm a lawyer who built a DMS/CRM running entirely on Google Workspace (Sheets + Apps Script + Gemini) — open-sourced

I'm a lawyer who built a DMS/CRM running entirely on Google Workspace (Sheets + Apps Script + Gemini) — open-sourced

Hey r/GoogleAppsScript,

I'm a Polish attorney running a small law firm (team of 7-8 people). Two years ago I started building a DMS (document management system) directly in Apps Script + Sheets because every commercial option was either too expensive (Clio: $109/user/month, even Polish alternatives are ~$50/seat) or didn't fit my Polish legal workflow.

Honestly — most commercial legal software feels like it was designed by engineers who never sat with an attorney during a deposition.

Today I open-sourced it: https://github.com/apiotrowski-afk/kancelaria-dms

The stack is shamelessly basic:

  • Sheets as database (no Cloud SQL, no Firebase)
  • Apps Script V8 backend (~1050 LOC)
  • Single-file HTML frontend with vanilla JS (~1550 LOC, Bootstrap 5)
  • Gemini API for document summarization + email-to-case matching
  • Gmail Add-on for assigning incoming emails to cases
  • Drive for file storage with auto-created case folders

What it actually does:

  • Tracks cases, parties, courts, deadlines, attorneys
  • Auto-classifies incoming emails to the right case using Gemini (with fallback to client-email matching)
  • Indexes Drive files with AI summaries (knowledge base per case)
  • Polish Post tracking integration (shipment book)
  • Lead/CRM pipeline with conversion tracking
  • Mobile-responsive web app + Sheets sidebar + Gmail Add-on (all from one Apps Script project)

Stuff I learned the hard way:

  • CacheService is your friend — without it, the dashboard was unbearably slow
  • Apps Script's 6-minute execution limit forces you to think about batching from day one
  • Gemini JSON mode (response_mime_type: "application/json") saved me ~80% of parsing logic
  • Drive folder creation in a loop will hit quotas fast — batch your createFolder calls
  • The OAuth scopes for Gmail+Drive+Sheets+Calendar combined create a scary consent screen for users (still no good solution beyond explaining it in onboarding)

Heads up on scope: This is built for EU (specifically Polish) legal workflows — case numbering, court hierarchy, Polish Post integration, GDPR-flavored data handling. Adapting it to US/UK law firms or other jurisdictions would need real work. That said, the architecture is generic enough that any small business running on Google Workspace and dealing with documents could fork it as a starting point.

A note on the code: I'm an attorney, not a professional developer. I use AI assistants heavily for syntax and implementation, but every architectural decision, every piece of domain logic, every integration pattern is mine. After 2 years of running this in production on real client data, I know exactly what each function does and why. The code isn't elegant by senior-dev standards, but it works and it's been battle-tested.

Why open source: Built it for myself, but if it helps another lawyer/dev who needs a starting point for a Workspace-native business app, even better. Apache 2.0 license, fork it, butcher it, ignore it — your call.

Happy to answer questions about Apps Script production gotchas, Gemini integration patterns, or why I think Sheets-as-database is actually fine for small businesses (until it isn't).

u/Royal-Method-9965 — 3 days ago