Skip to content
Kuldip Kumar SahSenior Frontend Engineer
All articles
Product Architecture9 min read

What Changes When the User Owns the Database

TallyLite stores business data in a Google Sheet selected by the user. That sounds simple until persistence becomes part of the product UX.

Next.jsGoogle SheetsRepository PatternTallyLiteData Ownership

Key takeaways

01

User-owned storage changes failure states, not just persistence code.

02

A repository boundary keeps Google-specific details out of the domain.

03

The UI should never claim a remote write is saved before it really is.

The product constraint

The spreadsheet is not an export. It is the actual datastore.

In TallyLite the user picks a Google Sheet and authorizes the app to use it. Customers, products, inventory movements, invoices, payments and ledger entries are persisted there.

I liked the ownership model, but it immediately changed the engineering assumptions. Network latency matters more. Writes can be throttled. Reconnection matters. Users can also inspect the data outside the app, so the stored shape needs to remain understandable.

UI
Use cases
Domain
Repositories
Google Sheets
InvoiceCustomerTotalStatus
INV-1042Acme₹12,840Paid
INV-1043Nexa₹8,290Due
INV-1044Orbit₹4,560Draft

Keeping Google out of the domain

The Google API sits behind a repository, not inside feature code.

Invoice logic does not know which sheet tab stores an invoice. Inventory rules do not know row numbers. The application calls repository contracts and the Google Sheets adapter handles the tabular details.

That made local tests much easier, but the bigger benefit is replaceability. The business rules are not permanently shaped around one persistence API.

  • UI: interaction and status.
  • Application: use-case orchestration.
  • Domain: invoice, GST, payment and inventory rules.
  • Repository: persistence contract.
  • Google adapter: sheet reads and writes.
Working principle

User-owned storage changes failure states, not just persistence code.

The part users notice

Saving needs honest states.

A write can be pending, rate-limited, retried or failed. A single spinner is not enough when the datastore is remote and user-owned.

TallyLite exposes saving and recovery states instead of silently pretending a write succeeded. Production mutation paths also do not fall back to temporary in-memory state, because that would make the UI look correct while the durable data is wrong.

If the UI says “saved”, I want that to mean the persistent store accepted the write.
Working principle

User-owned storage changes failure states, not just persistence code.

A useful side effect

Visible data forces cleaner decisions.

Because users can open the sheet themselves, strange internal shortcuts are harder to justify. Records need to remain readable, imports and exports need to be predictable, and recovery has to work without hidden server magic.

That constraint ended up improving the architecture. It pushed more business logic into explicit domain code and kept the persistence layer honest.

Working principle

User-owned storage changes failure states, not just persistence code.