A full-stack multi-tenant financial platform with conversational AI, built with Laravel 11 and React
Emwrap is a collaborative expense management platform that goes beyond mere transaction logging. Teams operate within isolated workspaces, enforce category-level budgets, and — crucially — converse directly with an AI assistant that understands their financial data in real time.
The application treats artificial intelligence not as a superficial embellishment, but as a first-class architectural concern: GPT-4o-mini is woven into four distinct workflows, each designed to surface insight that would otherwise require manual interpretation. The result is a platform that doesn't just record where money went — it helps teams understand why, and what to do about it.
Emwrap's intelligence layer is powered by the OpenAI API and manifests across four purposefully distinct surfaces:
The centrepiece of the AI integration. A dedicated chat interface allows users to hold a natural, multi-turn conversation with an assistant that is contextually aware of the workspace's current expenses, active budget allocations, and spending patterns. Questions as specific as "Which category is closest to its budget ceiling this month?" and as broad as "How should I think about building an emergency fund?" receive coherent, data-informed responses. Conversation history is maintained within the session, enabling the assistant to reason across multiple exchanges rather than treating each message in isolation.
When logging a new expense, users may invoke the AI categorisation prompt with a single click. The expense title is dispatched to GPT-4o-mini alongside the workspace's defined categories, and the model returns a semantically matched suggestion — distinguishing, for instance, between "AWS invoice" and "team lunch" without explicit user intervention. The suggestion is applied to the category selector in real time, materially reducing the friction of data entry.
The dashboard surfaces a curated set of natural-language observations derived from two months of aggregated workspace data. Rather than presenting raw figures, the model identifies behavioural patterns — anomalous category spikes, favourable month-over-month trends, budget proximity warnings — and communicates them in plain prose. Insights refresh on demand via a dedicated control, ensuring the analysis remains current as new transactions are logged.
On the Reports page, users may commission a concise professional summary of any selected month's expenditure. The model synthesises total spend, transaction volume, and category distribution into a three-sentence executive narrative — suitable for distribution to stakeholders who require context without granular detail. This summary may optionally be embedded as a prefixed annotation within the CSV export, producing a self-contained document that narrates its own data.
All AI features degrade gracefully in the absence of an API key or in the event of upstream unavailability. The platform remains fully operational without AI; the intelligence layer exists to augment the experience, not to underpin it.
- Multi-workspace architecture — users may belong to multiple isolated workspaces simultaneously, with all data strictly scoped per workspace and zero cross-tenant leakage
- Role-based access control — Owners hold exclusive authority over membership management, workspace configuration, and invitation issuance; Members retain full expense and budget access
- Tokenised invitations — time-limited, single-use invite links enable frictionless onboarding of collaborators without manual admin intervention
- Budget progress tracking — per-category monthly limits render animated progress indicators that transition from emerald to red upon breaching the 80% utilisation threshold
- Streaming CSV export — reports are streamed server-side via PHP's native
fputcsvwith no third-party dependency, scaling to arbitrarily large datasets without memory overhead - Dark / light mode — system-wide theme toggle with persistent preference
| Layer | Technology |
|---|---|
| Backend framework | Laravel 11 |
| Authentication | Laravel Sanctum — stateless token-based |
| Database | MySQL |
| AI model | OpenAI GPT-4o-mini |
| Frontend framework | React 18 + Vite |
| Language | TypeScript |
| Animations | Framer Motion |
| Charts | Recharts |
| Styling | Tailwind CSS |
| Notifications | Sonner |
| HTTP client | Axios |
Multi-tenancy via workspace scoping
Rather than separate databases per tenant, all entities carry a workspace_id foreign key. Every query is explicitly scoped to the authenticated user's workspace, ensuring complete isolation without infrastructure complexity.
Stateless token authentication
Sanctum issues opaque personal access tokens rather than session cookies. The frontend persists the token in localStorage and attaches it to every outbound request via an Axios interceptor — an approach that is trivially extensible to future mobile or third-party clients.
Conversational AI with stateful context The chat endpoint reconstructs the full conversation history on every request, passing it as a structured message array to the OpenAI completions API. The workspace's current financial snapshot is injected into the system prompt at call time, ensuring the model's responses are grounded in live data rather than approximations.
Native CSV streaming The export endpoint writes directly to PHP's output buffer via a stream response, bypassing the memory overhead of constructing the full dataset in memory — a pattern that scales to arbitrarily large workspaces without modification.
emwrap/
├── backend/ Laravel 11 REST API
│ ├── app/
│ │ ├── Http/Controllers/ AuthController, WorkspaceController,
│ │ │ ExpenseController, CategoryController,
│ │ │ BudgetController, MemberController,
│ │ │ InvitationController, ReportController,
│ │ │ AiController
│ │ ├── Models/ User, Workspace, Expense,
│ │ │ Category, Budget, Invitation
│ │ └── Services/ OpenAiService
│ └── routes/api.php
│
└── frontend/ React + Vite SPA
└── src/
├── pages/ Dashboard, Expenses, BudgetPage,
│ Reports, Chat, SettingsPage,
│ Login, Register
├── contexts/ AuthContext, WorkspaceContext
└── lib/ api.ts — Axios instance + interceptor
backend engineered with Laravel 11, frontend crafted with React and Vite_