A deterministic inheritance reasoning engine based strictly on the jurisprudence of Daim al-Islam Bab al-Faraiz.
This application operates fundamentally differently from a standard inheritance calculator. It is a deterministic rule engine executing in layers:
- Layer 4 (Special Cases): Edge cases like Grandchildren substitution (
ولد الولد يقوم مقام الولد). - Layer 1 (Children): Direct descendant resolution.
- Layer 2 (Fixed Shares): Quranic allocations (1/2, 1/3, 1/4, 1/6, 1/8, 2/3).
- Layer 3 (Priority Engine): Kinship priority blocking (
الأقرب يمنع الأبعد) and remainder distribution (الرد بالرحم). - Layer 5 (Math Engine): Exact symbolic fractional unification and calculation.
faraiz-app/
├── backend/ # Python FastAPI + SQLAlchemy + Rule Engine
│ ├── app/
│ │ ├── api/ # REST API Routes
│ │ ├── core/ # Configuration & App Settings
│ │ ├── database/ # DB Connection & Schema
│ │ └── engine/ # The Jurisprudence Logic Core
│ └── tests/ # Verification & Validation Scripts
├── frontend/ # React + Vite + TypeScript
│ ├── src/
│ │ ├── api/ # Axios API Clients
│ │ ├── pages/ # Primary UI Views
│ │ ├── types/ # Shared Interfaces
│ │ └── styles/ # CSS Styling
└── docker-compose.yml # Orchestrates Postgres, Backend, and Frontend
Install all dependencies for both Frontend and Backend from the root:
npm run install:allRun both Frontend (Vite) and Backend (FastAPI) concurrently from the root:
npm run dev- Frontend: http://localhost:5173
- Backend: http://localhost:8000/api
- API Docs: http://localhost:8000/docs
Ensure Docker Desktop is running, then execute:
docker-compose up --buildThe engine logic has been heavily validated against core principles. To run the verification scripts:
npm run test # Runs backend/tests/comprehensive_test.py