I have it running on my server at https://enumbers.jarvisdiscordbot.net/ and there is a basic api at https://enumbers.jarvisdiscordbot.net/api/enumbers (if you use it please don't spam it lol)
A modern web application for looking up E-number food additives with comprehensive data from Open Food Facts. Built with HTML, CSS, JavaScript, and a Python Flask API backend.
- Comprehensive E-Number Database: Complete list of food additives with detailed information
- Real-time Search: Instant filtering by E-number code or name
- Category Filtering: Browse additives by functional categories
- Data Visualization: Interactive charts showing category distributions
- Safety Indicators: Visual safety level indicators for each additive
- External Links: Direct links to Open Food Facts and scientific research
- Dark/Light Theme: Toggle between themes for comfortable viewing
- Export Functionality: Export filtered results to CSV
- Responsive Design: Works perfectly on desktop and mobile devices
- Accessibility: Screen reader friendly with keyboard navigation
- Auto-refresh Development: Hot module reloading for development
- Click the Run button in Replit to start the development server
- Start the Flask API using the "Flask API Server" workflow
- Access the Application: Use the provided Replit URL
-
Start the Flask API Server:
python start_server.py
This starts the API server on
http://0.0.0.0:5000 -
Start the Development Server:
npm run dev
This starts Vite development server with auto-refresh on
http://0.0.0.0:5173
For local installation outside Replit:
Windows:
install.batLinux/macOS:
chmod +x install-system.sh
sudo ./install-system.shβββ api.py # Flask API server with security features
βββ start_server.py # Simple server startup script
βββ index.html # Main application HTML with embedded CSS/JS
βββ enumbers.json # E-numbers database
βββ install.sh # Linux/macOS system installer
βββ install.bat # Windows installer
βββ package.json # Node.js dependencies for development
βββ pyproject.toml # Python dependencies
βββ vite.config.js # Vite development server configuration
The Flask API includes comprehensive security measures:
- Content Security Policy (CSP) - Prevents XSS attacks
- Input Sanitization - All user inputs are cleaned and validated
- CORS Protection - Configured for specific origins
- Security Headers - X-Frame-Options, X-Content-Type-Options, etc.
- Rate Limiting - Protection against DoS attacks
- URL Validation - Prevents malicious link injection
- HTML Escaping - Prevents script injection
GET /- Redirects to main application pageGET /enumbers.html- E-numbers lookup pageGET /api/enumbers- Get all E-numbersGET /api/enumbers?q=search&limit=500- Search E-numbers
POST /api/enumbers- Create new E-numberPUT /api/enumbers/<code>- Update E-numberDELETE /api/enumbers/<code>- Delete E-numberPOST /api/update_enumbers_from_off_additives- Update from Open Food Facts
# Search for E-numbers containing "acid"
curl "http://0.0.0.0:5000/api/enumbers?q=acid&limit=10"
# Get specific E-number information
curl "http://0.0.0.0:5000/api/enumbers?q=E300"The application automatically fetches the latest E-number data from Open Food Facts daily using a background scheduler.
To manually trigger a data update (requires editing mode):
python api.py --allow-editingThen make a POST request:
curl -X POST http://0.0.0.0:5000/api/update_enumbers_from_off_additives- Open Food Facts: Primary source for E-number information
- Scientific Research: Links to relevant studies and documentation
- Real-time Search: Type to filter by E-number or name
- Category Filter: Filter by functional categories (Colors, Preservatives, etc.)
- Sort Options: Sort by E-number or name
- Clear Functions: Easy reset of all filters
- Interactive Charts: Donut chart showing category distribution using Chart.js
- Safety Indicators: Color-coded safety levels (Safe, Caution, Warning, Unknown)
- Responsive Tables: Optimized for all screen sizes
- Keyboard Navigation: Full keyboard support including Ctrl+K for search
- Screen Reader Support: ARIA labels and semantic HTML
- Skip Links: Direct navigation to main content
- Reduced Motion: Respects user's motion preferences
- Run Button: Starts the Vite development server
- Flask API Server: Starts the Python Flask API
- Start Flask API: Alternative Flask startup command
npm run dev- Start Vite development servernpm run build- Build for productionnpm run preview- Preview production buildpython api.py- Start Flask API serverpython api.py --allow-editing- Start API with editing capabilities
Python Dependencies (pyproject.toml):
- Flask 3.1.0 - Web framework
- Flask-CORS 5.0.0 - Cross-origin resource sharing
- APScheduler 3.11.0 - Background job scheduling
- Requests 2.32.3 - HTTP client for Open Food Facts API
- Bleach 6.2.0 - HTML sanitization
- Werkzeug 3.1.3+ - WSGI utilities
Node.js Dependencies (package.json):
- Vite 5.4.8 - Development server and build tool
- Chart.js 4.5.0 - Data visualization
- Frontend: Modify
index.html(contains HTML, CSS, and JavaScript) - Backend: Extend
api.pyfor new endpoints - Data: Update
enumbers.jsonor sync from Open Food Facts
The application organizes E-numbers into these categories:
- π¨ Colors (E100-E199)
- π‘οΈ Preservatives (E200-E299)
- βοΈ Antioxidants & Acidity Regulators (E300-E399)
- π₯ Thickeners, Stabilizers & Emulsifiers (E400-E499)
- π§ͺ Acidity Regulators & Anti-caking Agents (E500-E599)
- π Flavor Enhancers (E600-E699)
- π Antibiotics (E700-E799)
- β¨ Glazing Agents, Sweeteners & Others (E900-E999)
- 𧬠Additional Chemicals (E1000-E1999)
The application provides safety indicators based on general recognition:
- π’ Safe: Generally recognized as safe
- π‘ Caution: Some concerns but generally acceptable
- π΄ Warning: Potential health concerns reported
- βͺ Unknown: Insufficient data available
Note: This is for informational purposes only. Consult healthcare professionals for specific dietary advice.
E-numbers are stored in JSON format:
{
"code": "E300",
"name": "Ascorbic acid",
"openfoodfacts_additive": {
"name": "E300 - Ascorbic acid",
"url": "https://world.openfoodfacts.org/facets/additives/e300-ascorbic-acid",
"sameAs": ["https://www.wikidata.org/wiki/Q193598"]
}
}This application is designed to run seamlessly on Replit:
- Fork this repository on Replit
- Click the Run button to start the development server
- Use the Flask API Server workflow to start the backend
- Your application will be available at the provided Replit URL
The application automatically handles port binding and CORS configuration for Replit's environment.
- Fork the repository on
- Make your changes
- Test thoroughly using both development and API workflows
- Submit your improvements
See LICENSE file for details.
- Open Food Facts: https://world.openfoodfacts.org/
- Chart.js Documentation: https://www.chartjs.org/
- Flask Documentation: https://flask.palletsprojects.com/
- Vite Documentation: https://vitejs.dev/
Built with β€οΈ for food safety awareness