How anasse84/fisca works
Fisca is a Moroccan e-invoicing and accounting SaaS. Its principal product workflow is invoice handling through the API, with tenant-scoped access and accounting support; the repository also includes a POS client, SaaS interface, fiscal-rule engine, and public marketing site. The graph includes major subsystems visible in the tree and required core modules. Evidence is limited to the README, source index, and excerpts provided; dashed edges mark unverified product connections.
Main entry points: index.ts HTTP API · invoices-routes.ts Invoice routes · sync-engine.ts Offline sync · tenant-router.ts Tenant routing
Components 24
API and accounting
- HTTP API
apps/api-hono/src/index.ts - Tenant routing
apps/api-hono/src/core/tenant-router.ts - Request pipeline
apps/api-hono/src/core/pipeline-composition.ts - CGNC ledger
apps/api-hono/src/core/immutable-cgnc-ledger-engine.ts - Ledger errors
apps/api-hono/src/core/ledger-errors.ts - API schemas
apps/api-hono/src/core/api-v1-schemas.ts - Durable SQL
apps/api-hono/src/core/durable-object-sql.ts - Idempotency store
apps/api-hono/src/core/sql-idempotency-store.ts
Invoice compliance
- Invoice routes
apps/api-hono/src/routes/invoices/invoices-routes.ts - Invoice sequencing
apps/api-hono/src/core/invoice-sequencer-do.ts - DGI clearance
packages/ubl-xades/src/clearance/engine.ts - UBL signing
packages/ubl-xades/src/signature/xades.ts - POS API
apps/api-hono/src/routes/pos/pos-routes.ts
Product clients
- POS client
apps/pos-pwa/src/index.ts - Offline sync
apps/pos-pwa/src/sync/sync-engine.ts - POS storage
apps/pos-pwa/src/storage/ports.ts - SaaS interface
apps/web-saas/src/index.ts - Authentication
packages/auth-rbac/src/auth-2fa.ts
Fiscal services
- Fiscal rule engine
packages/fiscal-ast/src/dynamic-fiscal-ast-engine.ts - Data encryption
packages/crypto-e2ee/src/e2ee-engine.ts
Public site
- Marketing site
apps/marketing-astro/src/index.ts - Editorial content
apps/marketing-astro/src/content/pages.ts - SEO handlers
apps/marketing-astro/src/seo/handlers.ts
Other components
- Business user
Connections 21
- Business user → HTTP API: submits invoices
- HTTP API → Tenant routing: routes requests
- HTTP API → Invoice routes: dispatches invoice routes
- Tenant routing → Request pipeline: selects tenant context
- Invoice routes → Invoice sequencing: allocates numbers
- Invoice routes → DGI clearance: requests clearance
- DGI clearance → UBL signing: processes signed invoices
- HTTP API → CGNC ledger: serves ledger operations
- CGNC ledger → Ledger errors: raises typed errors
apps/api-hono/src/core/immutable-cgnc-ledger-engine.ts - HTTP API → API schemas: validates API data
- Invoice routes → Idempotency store: deduplicates requests
- POS client → POS storage: stores local data
- Offline sync → POS storage: loads and updates
apps/pos-pwa/src/sync/sync-engine.ts - Offline sync → POS API: sends batches
- SaaS interface → HTTP API: calls API
- Request pipeline → Authentication: applies access controls
- Marketing site → SEO handlers: serves SEO responses
- SEO handlers → Editorial content: reads editorial pages
apps/marketing-astro/src/seo/handlers.ts - Business user → Marketing site: visits site
- HTTP API → Fiscal rule engine: uses fiscal calculations
- HTTP API → Data encryption: protects tenant data