مساحة عمل عربية مدعومة بالذكاء الاصطناعي لإدارة الفواتير والمصروفات والمخزون والرواتب.
Translation pending
BusinessTypeScript · CSSGitHub @lukezester-aiOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
Loading the full README. The saved excerpt is shown below.
Officia MENA is a modular, AI-powered Business Operating System and ERP platform specifically tailored for the MENA (Middle East and North Africa) region. It consolidates accounting, invoicing, inventory management, HR, subscriptions, banking operations, and AI-driven inbox management into a single, cohesive SaaS product.
Security & Readiness Disclaimer: This project is currently in the MVP/Architecture Hardening phase. It is not yet ready for production use with real financial data. Features like Tenant Isolation, RBAC, and ZATCA compliance are actively being audited and fortified.Read the full README ↗Officia MENA is a modular, AI-powered Business Operating System and ERP platform specifically tailored for the MENA (Middle East and North Africa) region. It consolidates accounting, invoicing, inventory management, HR, subscriptions, banking operations, and AI-driven inbox management into a single, cohesive SaaS product.
Security & Readiness Disclaimer: This project is currently in the MVP/Architecture Hardening phase. It is not yet ready for production use with real financial data. Features like Tenant Isolation, RBAC, and ZATCA compliance are actively being audited and fortified.
Officia MENA is built on a modern, robust web stack:
officia-mena/
├── src/
│ ├── app/ # Next.js App Router (Public pages, Auth, Dashboard, API)
│ ├── components/ # Reusable UI components
│ ├── lib/ # Core Business Logic & Infrastructure
│ │ ├── accounting/ # Ledger, postings, chart of accounts
│ │ ├── ai/ # AI tools, prompts, providers
│ │ ├── auth/ # NextAuth, tenant resolution and RBAC
│ │ ├── billing/ # Subscription management
│ │ ├── db/ # Drizzle config and schema definitions
│ │ │ └── schema/ # Domain-driven DB schemas (tenants, users, invoices, etc.)
│ │ ├── hr/ # HR management
│ │ ├── inventory/ # Inventory and stock control
│ │ └── stripe/ # Stripe API and webhooks
├── agrinexus-law/ # Git submodule (Legal logic/Contracts)
└── tests/ # Unit and integration tests
Create a .env.local file based on the required variables (check .env.vercel or .env.local.backup if available). At a minimum, you will need:
# Database
DATABASE_URL="postgres://user:password@localhost:5432/officia"
# Authentication
AUTH_SECRET="use-a-long-random-secret"
ENABLE_DEMO_LOGIN="false"
# Stripe
STRIPE_SECRET_KEY="..."
STRIPE_WEBHOOK_SECRET="..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="..."
# AI Providers
ANTHROPIC_API_KEY="..."
GOOGLE_GENERATIVE_AI_API_KEY="..."
AI_GATEWAY_API_KEY="..." # enables cross-provider fallback
AI_GATEWAY_PRIMARY_MODEL="anthropic/claude-sonnet-4.5"
AI_GATEWAY_FALLBACK_MODEL="google/gemini-2.5-flash"
# Protects scheduled Maestro and reporting endpoints
CRON_SECRET="use-a-long-random-secret"
# Production connectors
RESEND_API_KEY="..."
REPORT_FROM_EMAIL="Officia MENA <[email protected]>"
OPEN_BANKING_API_URL="https://your-certified-provider.example"
OPEN_BANKING_ACCESS_TOKEN="..."
OPEN_BANKING_TENANT_ID="tenant-uuid-owning-this-consent"
OPEN_BANKING_ENV="sandbox"
ZATCA_API_URL="https://gw-fatoora.zatca.gov.sa/e-invoicing/developer-portal"
ZATCA_CSID="..."
ZATCA_CSID_SECRET="..."
ZATCA_TENANT_ID="tenant-uuid-owning-this-csid"
ZATCA_ENV="sandbox"
Maestro's proactive monitor runs daily through /api/cron/maestro-monitor. It detects overdue receivables, delayed ZATCA reporting, expiring employee documents, low stock, and expiring inventory. The endpoint requires Authorization: Bearer $CRON_SECRET; authorized dashboard users can also trigger a scan from the Maestro inbox.
Maestro routes each request to a finance, tax/ZATCA, HR, inventory, collections, or executive specialist and exposes only that specialist's required tools. The AI Control Center shows run status, latency, token usage, and routing without storing raw chat content. Memory is opt-in: users must explicitly ask Maestro to remember something, while company-wide memory can be changed only by admins and managers. Financial writes continue to require the Phase 2 approval workflow.
Uploaded PDFs are registered by SHA-256 checksum, versioned by filename, split with overlap while preserving page citations, and embedded into pgvector. Retrieval combines vector similarity with PostgreSQL full-text search through Reciprocal Rank Fusion. Active/effective dates and role ACLs are enforced before results reach Maestro. Retrieval telemetry stores query hashes and citation metrics, never the raw question.
Ensure you have a PostgreSQL instance running.
# Install dependencies
npm install
# Generate Drizzle migrations
npm run db:generate
# Apply migrations to your local DB
npm run db:migrate
# (Optional) Open Drizzle Studio to inspect data
npm run db:studio
npm run dev
Open http://localhost:3000 with your browser to see the result.
Run the test suite using Vitest:
# Run unit tests
npm run test
# Run typechecking
npm run typecheck
# CI Check (Lint, Typecheck, Test, Build)
npm run ci
The platform utilizes a dual-provider AI setup (Anthropic and Google) via the Vercel AI SDK. This allows the system to intelligently switch models based on task complexity (e.g., OCR extraction vs. financial analysis) and handle API rate limits gracefully.
Maestro uses a human-in-the-loop governance layer. Financial drafts, external email, and ZATCA submissions are proposed first, approved by an authorized user, and executed by deterministic services with audit and idempotency controls. Maestro has no payment-initiation tool.
Stripe is used for tenant subscriptions. Webhooks must be configured in your Stripe Dashboard to point to /api/webhooks/stripe to ensure subscription statuses remain synchronized with the local database.
✅ Complete / Solid Foundation:
tenants, users, rbac).🧪 Experimental / Under Refactoring:
ledger.ts, postings.ts) are currently monolithic and are scheduled for decomposition.agrinexus-law). Integration boundaries are being redefined.