Skip to main content

About the project

SafarSplit β€” Safar bhi, hisaab bhi πŸ§³πŸ’°

Open-source collaborative trip planner & expense splitter for Indian groups. Plan day-wise itineraries, vote on stops live, scan restaurant bills into diet-aware splits, and settle up with the fewest UPI payments. Includes a Hinglish multi-turn AI assistant running on open-weight models.

Built because trips get planned on WhatsApp, but the hisaab never does.


✨ Features

  • Collaborative itineraries β€” day-wise stops with maps, times, cost estimates, and live voting.
  • Expense splitting β€” equal, exact, percentage, or shares, with per-member exclusions. All amounts in integer paise (no float drift).
  • Scan bill β€” snap a restaurant bill; items get auto-classified as veg / egg / non-veg / Jain-friendly using an Indian-menu dictionary + LLM fallback.
  • Hinglish AI assistant β€” understands β€œRahul ne 1200 diye dinner ke liye, Amit ko chhod ke 4 mein split”. Fuzzy name matching, coreference (β€œuska bhi add kar do”), one-question clarifications with quick-reply chips.
  • Minimum settle-up β€” greedy + optimal bitmask-DP that cuts n people to ≀ nβˆ’1 payments, with an SVG debt graph and one-tap UPI deep links.
  • Next-payer suggestion β€” β€œwho should pay next?” with projected balances before/after.
  • Budget burn-rate alerts β€” real-time pacing, projected overspend, AI-suggested cheaper swaps.
  • Safar Wrapped β€” shareable recap per completed trip (awards + category pie), fully deterministic.
  • Community & forking β€” publish completed trips, browse by tags/budget, fork one with dates auto-shifted.
  • Packing list β€” communal, race-safe claims, AI suggestions by destination + season.
  • Offline sync β€” idempotent batch ops with last-write-wins conflict resolution.
  • Open-weight models only β€” Ollama locally or any OpenAI-compatible endpoint. No vendor lock-in.

πŸ›  Stack

Backend: Node.js Β· Express Β· PostgreSQL (raw pg) Β· Socket.io Β· JWT Β· Zod Β· Multer
AI: Ollama (Gemma / Qwen / DeepSeek / Llama) Β· OpenAI-compatible fallback Β· OSRM
Frontend: React 18 Β· Vite Β· Tailwind Β· Redux Toolkit Β· React Router Β· Axios Β· Leaflet Β· lucide-react
Deploy: DigitalOcean App Platform


πŸ› Architecture

  • Integer paise everywhere β€” BIGINT, no floats.
  • Row-locked transactions for wallet transfers, vote counts, packing claims.
  • Migrations on boot β€” schema.sql + migration_*.sql applied in order, tracked in schema_migrations. Seed only when SEED=true.
  • AI never authoritative β€” Zod-validated, one retry, logged to ai_requests. Model explains; code calculates.
  • Public views stay safe β€” community_trips exposes first names, destinations, tags, counts only.

πŸš€ Run locally

# Backend
cd backend && npm install && cp .env.example .env
createdb safarsplit && npm run migrate && npm run dev

# Frontend
cd frontend && npm install && cp .env.example .env && npm run dev

# AI (optional)
ollama pull gemma2:9b

Backend β†’ http://localhost:5000 Β· Frontend β†’ http://localhost:5173


πŸ§ͺ Tests

npm test                # all
npm run test:assign     # item assignment engine
npm run test:settlement # min-cash-flow + optimal
npm run eval:assistant  # NLU accuracy β†’ docs/eval.md

🌍 Deploy

DigitalOcean App Platform ready: TLS Postgres via PGSSL=true, migrations on npm start, binds 0.0.0.0:$PORT, /health returns 200 after SELECT 1, CORS from CORS_ORIGIN, frontend reads VITE_API_URL (full URL ending /api/v1) and derives the socket origin from it β€” no hardcoded hosts.


πŸ“œ License

Safar bhi, hisaab bhi. 🧑

Built with

javascriptcsshtmlreactnode.jsflasktailwindjsonvitepostgresqlreact.jsgithubvscodedeepseekollamaclaude

AI tools

Coded withClaude CodeClaude Sonnet 5.5Gemma 4 31BDeepSeek V3.2Qwen3.8 27B

Prize Categories Entered

  • DigitalOcean

    Best Open-Source AI Project

    Submitted