A free, open-source npm package and demo UI for checking the halal status of food ingredients. Powered by the HalalLens API — a database of 10,000+ ingredients analyzed by AI and verified by the community.
- Instant search — Type any ingredient name or E-number
- Halal status — HALAL, HARAM, MUSHBOOH, or UNKNOWN with confidence scores
- AI explanations — Understand why an ingredient has its status
- TypeScript support — Full type definitions included
- Zero dependencies — Uses native
fetch, works in Node.js 18+ and all modern browsers - Free forever — No API key required
npm install @halallens/halal-scannerimport { HalalScanner } from '@halallens/halal-scanner';
const scanner = new HalalScanner();
// Search for ingredients
const results = await scanner.search('gelatin');
console.log(results.items[0].halal_status); // "HARAM"
console.log(results.items[0].display_status); // "Verified HARAM"
// Get detailed ingredient info
const detail = await scanner.check('en', 'gelatin');
console.log(detail.explanation);
console.log(detail.food_source); // "Animal"
// Batch analyze multiple ingredients
const analysis = await scanner.analyze(['gelatin', 'sugar', 'E471']);
console.log(`${analysis.halal_count} halal, ${analysis.haram_count} haram`);| Option | Type | Default | Description |
|---|---|---|---|
baseUrl |
string |
https://halallens.no/api |
API base URL |
deviceId |
string |
Auto-generated | Device ID for usage tracking |
timeout |
number |
10000 |
Request timeout in ms |
Search for ingredients by name or E-number.
const results = await scanner.search('E471', { perPage: 5 });Get detailed info about a specific ingredient.
const info = await scanner.check('en', 'sugar');Analyze multiple ingredients at once.
const result = await scanner.analyze(['sugar', 'gelatin', 'citric acid']);| Status | Meaning |
|---|---|
HALAL |
Permissible to consume |
HARAM |
Not permissible to consume |
MUSHBOOH |
Doubtful — depends on source or processing |
UNKNOWN |
Not yet analyzed |
This package provides ingredient lookup. For the full experience:
- Scan product labels with your camera (OCR-powered)
- AI-powered analysis of entire ingredient lists
- Multi-language support in 14+ languages
- Mobile apps for Android and iOS
Contributions welcome! Please read CONTRIBUTING.md before submitting a PR.
MIT — Free to use with attribution to HalalLens.

