How benoror/taxi-driver works
Main Components Identification
a) API Layer
• Three main endpoints (/countries, /rules, /taxes)
• POST /taxes as the primary calculation endpoint
b) Core Processing Engine
• Tax Rule Matcher
• Formula Evaluator
• Calculator Module
c) Data Store
• LowDB Database
• Tax Rules Repository
Component Relationships
• External clients → API Layer
• API Layer → Core Processing Engine
• Core Processing Engine ↔ Data Store
Specific Implementation Details
Technical elements:
• Micro framework (Zeit/Micro) as the API server
• LowDB as the database
• Formula Parser for tax calculations
• Currency.js for precise monetary calculations
[Client Layer]
• ↓
[API Layer (Micro)]
• GET /countries
• GET /rules
• POST /taxes
• ↓
[Processing Layer]
• Rule Matcher (lib/match.js)
• Formula Evaluator (lib/eval.js)
• Calculator (lib/calc.js)
• ↓
[Data Layer]
• LowDB
• Tax Rules
• Country Configurations
Important Elements to Highlight
a) Input Processing:
• How queries are processed with required fields (country, taxes)
• Optional match parameters (region, bpType, txType, etc.)
b) Rule Matching Flow:
• Demonstrate how rules are matched based on query parameters
• Formula evaluation process
c) Calculation Pipeline:
• How tax calculations are performed
• Dependency handling between taxes