Skip to content
t0ma5Public
forked from spliit-app/spliit

About

Spliit fork adapted to deploy on Vercel hobby account

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

96 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spli7

spli7 is an open source expense-tracking app based on Spliit. This fork deploys on Vercel (project spli7) with Turso (libSQL/SQLite) as the database — not Prisma/Postgres.

Live: https://spli7.vercel.app

Do not host this app on Cloudflare Workers Free, CPU capped at 10 ms per request. OpenNext SSR for this app measured ~23–90 ms (cold 700 ms), so two people opening a group at once exceeded resource limits. CF Workers Paid ($5/month) raises the CPU cap. This fork uses Vercel Hobby 300 s duration, 4 CPU-hours/month.

Features

Legend: 🟢 from original Spliit · 🔴 new in this Vercel / Turso fork

  • 🟢 Create a group and share it with friends
  • 🟢 Create expenses with description
  • 🟢 Display group balances
  • 🟢 Create reimbursement expenses
  • 🟢 Progressive Web App (spli7 home-screen name; service worker + offline page + update prompt)
  • 🟢 Select all/no participant for expenses
  • 🟢 Split expenses unevenly
  • 🟢 Mark a group as favorite
  • 🟢 Tell the application who you are when opening a group
  • 🟢 Assign a category to expenses
  • 🟢 Search for expenses in a group
  • 🟢 Export a group to JSON or CSV
  • 🔴 Import a group from a Spliit JSON export (creates a new group with remapped IDs)
  • 🔴 Import a group from a Tricount GDPR CSV or Splitwise CSV export (participants + expenses)
  • 🔴 Notes + activity history + document links in JSON export/import (exportVersion: 3)
  • 🔴 Copy an existing expense into a new draft
  • 🔴 Math expressions in the amount field
  • 🔴 Even-split cent remainder (no missing cents)
  • 🔴 Group default split mode
  • 🔴 Optional group PIN (server-enforced HTTP-only cookie; PBKDF2; rate limited)
  • 🔴 Share group via QR code
  • 🔴 Soft-delete / restore groups (30-day grace) + 24-month inactivity expiry
  • 🔴 Security headers, CSV formula escape, Zod input caps, expense date bounds
  • 🔴 Error boundaries + Drawer accessibility titles
  • 🔴 Field-array validation messages (no literal “undefined”)
  • 🔴 Expense date defaults to local today (not UTC)
  • 🔴 Paste-friendly amount parsing (US/EU grouped currency)
  • 🔴 Keyboard navigation restored in category/currency selectors
  • 🔴 Mobile group tab icons
  • 🔴 Stats: period selector, summary, spending over time / by participant / by category, recurring estimate, drill-downs, monthly stacked chart, and balance timeline
  • 🔴 Global balance across groups on My groups
  • 🔴 Settle reimbursements in a currency other than the group’s
  • 🔴 Unified share math (balances, stats, CSV, and the expense form agree)
  • 🔴 Locale-aware week grouping on expenses and activity
  • 🔴 Translated page titles
  • 🔴 CSV export as per-expense saldo (reimbursements as Cost=0)
  • 🔴 Optional calendar-month expense grouping
  • 🔴 Drag-reorder / Sort A–Z participants
  • 🔴 Multiple payers per expense (legacy single paidById migrated on read)
  • 🔴 Extra currencies: ARS, TRY, COP, JOD, MKD, MOP, MYR, VND
  • 🔴 Large groups: keyset-paginated expense/activity lists, compact stats/balance reads, and create/update/delete that do not load the whole group
  • 🔴 Pay button on reimbursements: SEPA bank-transfer QR (EPC), MobilePay, Swish, Bizum, Venmo, PayPal.me and Revolut.me, from payment details each participant adds in group settings
  • 🔴 Receipt photos on expenses, stored in a private Vercel Blob store and served only to people who can open the group (PIN respected)
  • 🔴 Daily automatic backups of the whole database to private Blob storage (30 days + 12 monthly copies)
  • 🔴 Add expenses offline: saved on the device and sent automatically when you are back online, without duplicates
  • 🔴 Test database: one command copies live data into a Turso test DB for safe UI and migration checks
  • ❌ Create expense by scanning a receipt (removed — see below)

Stack

  • Next.js for the web application
  • TailwindCSS for the styling
  • shadcn/UI for the UI components
  • Turso (libSQL/SQLite) for persistence (SQL, transactions, optimistic concurrency)
  • Vercel for hosting (project spli7)

Data model notes

  • Groups, participants, expenses, payers, shares, and activity live in SQLite tables on Turso (see migrations/0001_init.sql, 0002_keyset_indexes.sql).
  • Concurrent edits use an integer version column and retry on conflict (not last-write-wins KV).
  • Expense lists and activity history page with keyset cursors (expense_date/created_at/id, not OFFSET). Adding or editing one expense writes only that row (plus an activity), not the whole group. Stats still read every expense but skip documents and recurring links.
  • Balance ledger (migration 0006): each paid-for row stores its exact owed amount (the same largest-remainder split as getBalances), and participant_balances keeps per-participant paid/owed sums, rebuilt in the same transaction as every expense write. The balances page and the cross-group balance on /groups read one row per participant instead of loading the whole expense history. Groups written before 0006 have balances_ready = 0: their first balance read sums in memory as before, then fills the ledger after the response (skipped if the group changed meanwhile). Backups leave the derived table out; restore-db.mjs resets balances_ready so restored groups refill.
  • Optional group PIN is hashed with PBKDF2, never returned to clients, and enforced on tRPC + export routes via an HTTP-only cookie (PIN_SECRET).
  • Groups track lastActivityAt on mutations and lastSeenAt on reads. After 24 months without either, cleanup soft-deletes them; soft-deleted groups can be restored for 30 days, then are hard-deleted.
  • Cron (Bearer CRON_SECRET): GET/POST /api/cron/cleanup-groups, /api/cron/recurring, /api/cron/backup. Vercel Cron runs cleanup + recurring daily. Legacy KV import (/api/cron/migrate-kv) returns 410.
  • Generated recurring copies do not count as activity, so an abandoned group with a recurring expense still expires.
  • Expense search uses a search_text column lowercased in JavaScript (SQLite LOWER() only folds ASCII). After migration 0004, run node --env-file=.env.local scripts/backfill-search-text.mjs once.
  • Rate limits: PIN guesses per address and per group, group creation 30/hour and imports 10/hour per address, receipt uploads 60/hour.
  • Participants can hold payment methods (participants.payment_methods, JSON, migration 0005). The registry in src/lib/payment-methods/ validates them (IBAN checksum, phone and username formats) and builds the QR codes and links. JSON export is exportVersion: 4; version 3 files still import.
  • Receipt photos are stored at receipts/{groupId}/{docId} in a private Vercel Blob store. Expenses store the app route /api/groups/{groupId}/documents/{docId}, which checks group access before streaming. Removing a photo, deleting its expense or purging the group deletes the blob; a JSON import copies receipts into the new group.

Backups

  • Daily, automatic: Vercel Cron calls /api/cron/backup at 05:00 UTC. It gzips every table into the private Blob store as backups/spli7-backup-<date>.json.gz and keeps the last 30 days plus the first backup of each of the last 12 months.
  • List or fetch: node --env-file=.env.local scripts/download-backup.mjs lists them; add latest or a date (2026-10-24) to download into backups/ (gitignored).
  • Manual dump: node --env-file=.env.local scripts/backup-db.mjs reads Turso directly; /api/cron/backup?download=1 (Bearer CRON_SECRET) returns the dump over HTTP.
  • Restore: scripts/restore-db.mjs <file> (.json or .json.gz) loads a dump into an empty database that already has the migrations; it refuses to run if the target has groups.
  • Turso Free point-in-time restore only covers 24 hours, so the daily copies are the real safety net.

Pay buttons (this fork)

In Settings → Participants, open Payment details under a person and add how they want to be paid. On Balances, each suggested reimbursement to that person gets a Pay button with the amount and a message (spli7 · <group>) filled in, then Record as paid.

Method Countries What the payer gets Currency
Bank transfer (SEPA) euro area EPC QR code most banking apps scan (IBAN, name, amount, message) EUR
MobilePay Finland, Denmark Phone, amount and message to copy EUR, DKK
Swish Sweden Prefilled Swish QR code SEK
Bizum Spain Phone, amount and message to copy EUR
Venmo US Link that opens Venmo with amount and note USD
PayPal.me worldwide Link with the amount and currency any
Revolut.me worldwide Profile link plus amount to copy any
  • Methods that cannot pay in the group's currency are hidden.
  • Payment details are visible to everyone who can open the group (and has its PIN, if set).
  • Bizum and MobilePay have no public "pay this amount" link for person-to-person payments, so they show copyable details. The Venmo link and Swish QR formats come from third-party descriptions; the dialog asks the payer to check the details in the app.
  • Add a country's app: write one file in src/lib/payment-methods/methods/ (a zod schema, form fields and an instructions() function that returns a QR payload, a link and/or values to copy), list it in src/lib/payment-methods/index.ts, and add its labels to messages/*.json under PaymentMethods.

Offline (this fork)

  • Works in any browser tab that has opened the group online once; it is smoothest as an installed app (PWA).
  • Offline, Create expense still opens and Save queues the expense on the device (IndexedDB). Queued expenses show at the top of the list as Waiting to sync.
  • They are sent when the connection returns, when you come back to the tab, or when the app opens. The expense id is fixed on the device, so a retry never creates a duplicate.
  • PIN-protected groups keep queued expenses until you unlock them (Unlock to sync). Editing or deleting offline, and attaching photos offline, are not supported.

Test database

A Turso copy of live data for clicking through changes and running new migrations before they touch production.

npm run testdb -- create    # copy live into spli7-test, write .env.testdb.local
npm run testdb -- migrate   # apply migrations/ to the copy
npm run dev:testdb          # next dev against the copy
npm run testdb -- refresh   # fresh copy of live data
npm run testdb -- delete

Needs TURSO_PLATFORM_TOKEN (Turso dashboard → Settings → API tokens) and TURSO_ORG in .env.local. The copy holds real people's data: keep it private and delete it when done.

Extra UX (this fork)

Ideas below track community demand from Spliit Cloud’s roadmap, upstream Spliit issues/PRs, and hardening patterns from anon-spliit (reimplemented for this SQLite/Turso fork — not a code port of their E2EE/auth stack).

Feature Notes Prior art
Pay buttons SEPA EPC QR, MobilePay, Swish, Bizum, Venmo, PayPal.me, Revolut.me on suggested reimbursements; one file per method. This fork; written to be ported upstream
Receipt photos (private) Client-side resize, private Vercel Blob, served through a PIN-checked route; cleaned up with the expense or group. Upstream document uploads (S3), reimplemented without public URLs
Offline add IndexedDB queue + persisted group data; idempotent sync by client-minted expense id. Spliit Cloud roadmap (offline support)
Daily backups Gzipped full dump to private Blob, 30 daily + 12 monthly. This fork
Copy expense From the expense list or edit header icon (opens create prefilled). Upstream #527; shipped in Spliit Cloud
Amount math Expressions in the amount field (10+5.50, 5*8, …) on blur/save. Upstream #184; shipped in Spliit Cloud
Default split mode Stored on the group (device localStorage can still override). Upstream #366; shipped in Spliit Cloud
Even-split cents Integer remainder allocation so balances don’t drop a cent. Upstream #374 / #427; tracked by Spliit Cloud
Share QR QR in the share popover. Upstream #500; on Spliit Cloud roadmap
Optional group PIN 6–8 digits for new PINs; HTTP-only unlock cookie; PBKDF2 hash; rate limited. Upstream #373; on Spliit Cloud roadmap
Notes + history + document links in JSON Export/import round-trips expense notes, group information, activity history, and document URLs (exportVersion: 3). Follow-up to upstream #546; expense notes also in #165
Soft-delete + inactivity expiry Manual soft-delete with 30-day restore; auto soft-delete after 24 months without activity; cron hard-deletes after grace. Inspired by anon-spliit deletion/auto-delete work and upstream #420
Local-today expense date New/duplicate/reimburse defaults use the local calendar day at UTC midnight, so the date input is not tomorrow (west of UTC) or yesterday (east of UTC). Upstream #629
Field-array form errors FormMessage reads error.root.message so split-mode refinements (percent/amount sums) never render the string undefined. Upstream #608
Paste amount parsing Normalizes pasted US/EU currency amounts in number fields. Upstream #531
Selector keyboard nav Category/currency pickers use cmdk CommandList. Upstream #491
Mobile tab icons Icon-only tabs on small screens; labels from sm. Upstream #539
Monthly spending + balance timeline CSS stacked category charts, category breakdown, and balance timeline on Stats. Upstream #532 / #555
Stats cards + drill-downs Period selector, summary, spending over time / participant / category, recurring estimate, click-a-bar expense lists. Upstream #584 / #586
Global balance Net across visited groups on My groups, bucketed by currency. Upstream #583
Settle in another currency Reimbursements can show the transfer amount in a non-group currency; group amount stays authoritative. Upstream #588
Unified share math One apportionment for balances, stats, CSV, and the form (Hamilton remainder). Upstream #562
Locale week start Expense/activity “this week” follows the UI locale, not Sunday. Upstream #559
PWA service worker Offline shell + update Reload toast; never caches API or mutations. Home-screen name spli7. Upstream #587
Splitwise import CSV reconstruction (EN/DE headers) via the same Import control. Upstream #483
CSV saldo export Participant columns are per-expense saldo; reimbursements Cost=0. Upstream #473
Translated page titles generateMetadata + next-intl on group pages. Upstream #537
Calendar month grouping Optional group setting for roommate-style monthly lists. Upstream #530
Multiple payers Split who paid an expense across several participants; balances/export/import aware. Legacy paidById migrates on read. Upstream #396
Reorder participants Drag-and-drop + Sort A–Z; order persisted in SQLite. Upstream #416
Tricount import GDPR CSV export via the same Import control as Spliit JSON. Upstream #526
Keep by-amount shares on reopen Nested share inputs no longer register as their own fields, so reopening an uneven-by-amount expense does not even-split it. Upstream #638
Remainder + named split difference Emptying a by-amount share suggests the remainder as a placeholder; the error names the sum and how far off it is. Upstream #639
Group expenses by stored calendar day Expense list headers use the DATE column’s calendar day, so the 1st of a month is not filed under last month west of UTC. Upstream #635
Even-split preview matches save Create form mints the expense id, so the leftover cent shown before save is the one stored. A failed create mints a new id so retry does not upsert over the first row. Upstream #647
By-amount shares at the custom rate With "Use custom rate" on, each typed share converts at the form's rate (custom or fetched), the same one the total uses, so a correct split is not rejected. Upstream #696
Refused participant removal explained The server refuses removing a participant on any expense (CONFLICT). The settings page reloads the group and names who is still on an expense in a toast. Upstream #671 (UX part; spli7 has no cascade deletes)
Zod 4 + resolvers 5 zod 4.6.7+ (past GHSA-mrhx-c7xc-m3w5) and @hookform/resolvers 5; translated error keys kept; import caps paidBy at 100 and paidFor at 500 per expense. Upstream #589 (zod and resolver parts only)
Export / input hardening CSV formula escape, Zod max caps, expense date bounds, security headers, error boundaries. Patterns reviewed from anon-spliit (adapted for this fork)

Stats (this fork)

On each group’s Stats tab:

  • Period — all time, this month, last 30 days, this year, or a custom from/to range.
  • Summary / spending over time / by participant / by category / recurring — same cards as upstream #584; bars drill into the expenses behind them (#586).
  • Monthly spending — stacked category chart for calendar months, with a category breakdown and legend controls.
  • Balance timeline — cumulative balances over time for participants (engineering fixes on this fork for share math / timeline consistency).

Spending stats exclude reimbursements. Inspired by upstream #532 / #555 / #584; reimplemented against the group API.

Group import JSON / Tricount / Splitwise (this fork)

On the Groups page, use Import JSON to upload:

  1. A Spliit JSON export (this fork or upstream Spliit), or
  2. A Tricount personal-data / GDPR CSV export, or
  3. A Splitwise CSV export (English or German headers).

The format is detected automatically.

Shared behavior:

  • Always creates a new group (does not overwrite an existing one).
  • Regenerates group, participant, and expense IDs so imports never collide with live data.
  • Does not import a group PIN (PIN must be set again after import).

Spliit JSON

  • Restores participants, expenses (including multiple payers when present), split modes, amounts, dates, notes, group information, and activity history (when present in the file).
  • Categories: match by id when present; otherwise by name / grouping against the seeded list (many exports omit id).
  • Newer exports include exportVersion: 3, expense ids (needed to re-link history), and expense document links (url / dimensions — not file bytes).
  • Document URLs round-trip for migration between Spliit forks; binaries are not embedded, and links may 404 if the original storage expires. Recurring-expense links are still not restored.

Tricount CSV

  • Imports participants and expenses (amounts by share / impacted amounts).
  • Uses the CSV default currency (Frankfurter .dev for missing cross-rates).
  • Notes and activity history are Spliit-only; Tricount imports leave them empty.
  • Prior art: upstream #526.

Splitwise CSV

  • Reconstructs expenses from Splitwise’s balance-delta CSV so resulting balances match the export (original split mode may be approximated).
  • English and German headers/categories; other Splitwise UI languages: switch Splitwise to English before export.
  • Prior art: upstream #483.

Removed / disabled upstream features (S3 & OpenAI)

Upstream Spliit optional features that depended on AWS S3 and OpenAI are not available in this fork:

Feature Upstream dependency Status here
Expense document / image uploads S3 (or compatible object storage) Back as receipt photos on a private Vercel Blob store (see Features).
Create expense from receipt scan OpenAI + storage Disabled; no OpenAI client or API keys.
Category extract from text/image OpenAI Disabled; same as above.

What changed vs upstream:

  • Prisma and Postgres were replaced with Turso (same SQLite schema as the later D1 tables).
  • Balances come from a stored ledger, not a full scan. Upstream loads every expense of a group (and of every group in the cross-group balance) on each balances view and sums them in JavaScript, so the cost grows with group history. Here every expense write also rebuilds per-participant sums in SQL, so a balance read is one row per participant. Rounding is unchanged: the ledger stores the same largest-remainder split, and tests compare it against getBalances. Proposed upstream in spliit-app/spliit#686.
  • S3/OpenAI packages and env vars were dropped. Keep NEXT_PUBLIC_ENABLE_RECEIPT_EXTRACT and NEXT_PUBLIC_ENABLE_CATEGORY_EXTRACT unset or false (the app refuses to start otherwise).
  • Receipt photos need NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS=true and a connected private Vercel Blob store (e.g. npx vercel blob create-store spli7-private --access private). Connecting the store gives either BLOB_STORE_ID (the current default: the app then uses Vercel's short-lived OIDC token, nothing long-lived to leak) or an older BLOB_READ_WRITE_TOKEN; both work. Receipt/category AI would need an explicit product decision.

Run locally

  1. Clone the repository: git clone https://github.com/t0ma5/spli7.git
  2. Copy .env.example to .env.local and set TURSO_DATABASE_URL, TURSO_AUTH_TOKEN, plus PIN_SECRET / CRON_SECRET if you need PIN or cron locally
  3. Install and apply Turso migrations:
npm install
npm run db:migrate:local
  1. Set NEXT_PUBLIC_BASE_URL (production is https://spli7.vercel.app)
  2. Run npm run dev

Deploy to Vercel

GitHub and Vercel are not linked by default. Treat them as two separate actions:

  1. GitHub — git push updates the repo. CI (push) only runs types/lint/format/tests.
  2. Vercel — npx vercel --prod (or npm run deploy) updates project spli7.

Requires Node.js 22+.

npx turso db create spli7
npx turso db show spli7 --url
npx turso db tokens create spli7
npm run db:migrate:remote
npx vercel --prod --yes --name spli7

Set these on the Vercel project:

  • TURSO_DATABASE_URL / TURSO_AUTH_TOKEN (Preview should point at the test DB, not live)
  • PIN_SECRET / CRON_SECRET
  • NEXT_PUBLIC_BASE_URL=https://spli7.vercel.app
  • BLOB_STORE_ID (added when the Blob store is connected; an older BLOB_READ_WRITE_TOKEN also works) and NEXT_PUBLIC_ENABLE_EXPENSE_DOCUMENTS=true for receipt photos and daily backups. Locally, npx vercel env pull refreshes the OIDC token, which expires after about 12 hours

Turso migrations are not applied by vercel --prod — run npm run db:migrate:remote when migrations/ changes.

Ops notes

  • Pushing code to GitHub does not update the live site until you deploy to Vercel (or link Git).
  • Prefer git / GitHub CLI over the GitHub web “upload files” UI — uploads often drop directories.
  • Vercel Cron in vercel.json calls /api/cron/backup, /api/cron/recurring and /api/cron/cleanup-groups daily when CRON_SECRET is set.
  • New migrations: npm run testdb -- migrate first, then npm run db:migrate:remote before deploying code that writes new columns.

Health check

  • GET /api/health/readiness or GET /api/health — app ready, including a read-only Turso probe
  • GET /api/health/liveness — process alive only

Credits & provenance

  • Original Spliit — idea, UI, and core expense-splitting product by Sebastien Castiel and contributors: spliit-app/spliit · spliit.app.
  • Spliit Cloud (antonio-ivanovski/spliit-cloud) — community fork that continues Spliit with new features. Several UX improvements in this fork were prioritized from their roadmap and upstream issue links (reimplemented for SQLite, not a code port of their Postgres/API stack).
  • anon-spliit (sora-grayscale) — privacy-focused fork (E2EE, private instance, deletion/auto-delete). This fork adapted selected lifecycle and hardening ideas from that work; it does not port their end-to-end encryption or account/2FA stack.

License

MIT, see LICENSE. Same license family as upstream Spliit and Spliit Cloud; retain their copyright notices where applicable.

About

Spliit fork adapted to deploy on Vercel hobby account

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages