Skip to content

Repository files navigation

KiraFaraid — Kalkulator Faraid & Pembantu Pusaka Malaysia

Kira pembahagian pusaka dengan jelas, fahami sebabnya, dan tahu langkah seterusnya.

A free, bilingual (Bahasa Melayu / English) Islamic inheritance calculator and estate-planning assistant for Malaysia. Enter the heirs and the estate value; KiraFaraid shows who inherits, how much, and — unlike a plain calculator — why, plus what to do after the calculation.

🌐 Live: faraid.megu.my

Homepage

Why this exists

Faraid (فرائض) — the Islamic law of inheritance — is precise but hard for non-experts. Malaysian families facing a death must navigate fixed Quranic shares, residuary rules, blocking (hijab), and edge cases like ʿawl, radd, and Umariyyatayn, then deal with real institutions (Mahkamah Syariah, Amanah Raya, Baitulmal). Existing tools either just print fractions or sit behind paid services. KiraFaraid makes the calculation instant and free, explains every ringgit in plain Bahasa Melayu, and turns the result into an action plan.

Penafian: KiraFaraid ialah alat panduan awal, bukan nasihat undang-undang atau fatwa. Untuk pembahagian rasmi, sila sahkan dengan pihak berautoriti atau profesional.

Features

The calculator

  • Effortless wizard — mobile-first, shows only the fields that can affect the result (conditional visibility mirrors the engine's hijab rules), plain-BM help on every term, and a Semakan Waris review before calculating
  • One-tap scenarios — six common cases (suami meninggal, tiada anak, hanya anak perempuan, kemungkinan Baitulmal…) prefill the wizard
  • Mod Malaysia — full estate pre-steps in the Malaysian order: funeral costs → debts → harta sepencarian → wasiat (auto-capped at ⅓) → faraid

The explanation layer (the part a plain calculator doesn't have)

  • 🌳 Peta Waris — the result as a tiered family map around Si Mati, grouped nodes ("Anak lelaki ×2"), tap any heir to jump to their explanation
  • Penjelasan setiap waris — fraction, percentage, RM, and a plain-BM reason per heir
  • Waris Yang Terhalang — entered heirs who receive nothing, and why (only deterministically-certain hijab cases; the tool never guesses)
  • Bagaimana kiraan ini dibuat — a step-by-step reasoning trace of the engine's output
  • Perkara Yang Perlu Disemak — red flags (wasiat melebihi ⅓, Baitulmal, harta sepencarian, hutang tinggi…) with severity and suggested next steps
  • Apa Perlu Dibuat Selepas Ini? — an action checklist adapted to the case

Beyond the calculation

  • Dokumen — optional account with an encrypted estate profile, asset inventory, named heirs, and a printable Ringkasan Pembahagian Faraid
  • Belajar — glossary and guided learning for faraid terms
  • Sedekah — voluntary sadaqah calculator spun off from your share
  • Privacy-first — the anonymous calculator runs entirely in the browser; account data is encrypted at rest (AES-256-GCM), IC numbers never appear in URLs, and full PDPA-style data export and account deletion are built in

Results — Peta Waris

The engine

src/lib/faraid/engine.ts is a pure, deterministic TypeScript implementation of Shafi'i faraid as practised in Malaysia (aligned with JAKIM's e-Faraid):

  • Fixed shares (fardh), residue (asabah), and their interactions
  • ʿAwl (proportional reduction) and radd (surplus return)
  • Hijab (blocking) including grandfather–sibling muqasamah and the Akdariyya case
  • Umariyyatayn (spouse + both parents), Baitulmal fallback
  • Exact fractions end-to-end — no floating-point share math

Verification: 151 unit tests including classical edge cases, a fuzz-invariance suite for the wizard's conditional visibility (hidden fields can never change a result), and a 48-case validation script cross-checked against JAKIM e-Faraid examples (npm run validate).

The explanation layer (reasoningTrace, blockedHeirs, redFlags, actionPlan) is built around the engine and never recalculates — the engine is the single source of truth.

Stack

Next.js 16 (App Router) · React 19 · TypeScript · Tailwind CSS 4 · PostgreSQL · Auth.js v5 · Vitest · Playwright — no chart library; the Peta Waris and the "Modern Amanah" design system (ivory/emerald/gold tokens, geometric pattern, motion with prefers-reduced-motion fallbacks) are hand-built CSS.

Getting started

git clone https://github.com/ahmadafif5321/kirafaraid.git
cd kirafaraid && npm install

docker compose up -d        # local Postgres (dev: database only)
cp .env.example .env.local  # fill in the values (see below)

npm run dev                 # http://localhost:3939
Variable Purpose
DATABASE_URL Postgres connection string
ENCRYPTION_KEY 32-byte base64 key for at-rest encryption (node -e "console.log(require('crypto').randomBytes(32).toString('base64'))")
AUTH_SECRET Auth.js session secret (npx auth secret)
ADMIN_KEY Access token for /admin
AUTH_GOOGLE_ID / AUTH_GOOGLE_SECRET Optional Google sign-in

The anonymous calculator works with no database and no env vars — accounts and documents are the only features that need Postgres.

npm test            # 151 unit tests
npm run validate    # 48 cases vs JAKIM e-Faraid
npm run build       # production build

Deployment notes (Docker, reverse proxy): see DEPLOY.md.

Project structure

src/lib/faraid/       engine, visibility (hijab-mirrored), scenarios,
                      reasoningTrace, blockedHeirs, redFlags, petaWaris
src/lib/pusaka/       action plan
src/lib/account/      estate profile, encrypted fields, PDPA export/delete
src/lib/documents/    document view-models, Hijri date
src/components/       Wizard, Results, PetaWaris, results/* panels, ui/* primitives
src/app/              routes: kira, belajar, sadaqah, statistik, dokumen,
                      metodologi, penafian, privasi, akaun, admin
docs/superpowers/     design specs and implementation plans (the process, documented)

Methodology & trust

How the calculation works, its assumptions, and its limits are documented in the app itself at /metodologi, with the disclaimer at /penafian and privacy details at /privasi. The tool deliberately makes no claims of official certification and points users to the relevant authorities for real cases.

License

AGPL-3.0. The code is open for learning and self-hosting; if you run a modified version as a service, you must share your changes. For a commercial license, get in touch.

About

Kalkulator faraid & pembantu pusaka Malaysia — free bilingual Islamic inheritance calculator with Peta Waris, plain-BM explanations, and next-step guidance. Live at faraid.megu.my

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages