Skip to content

Pritam-25/spendix-ai

Repository files navigation

Spendix — AI-Powered Personal Finance Management platform

AI powered personal finance management platform to track accounts, income, and expenses in one place, with transaction management, automated recurring payments, monthly budgets, spending dashboards, and a personal AI assistant for personalized, real-time insights based on user financial data.

Tech Stack Used

Next.js TypeScript shadcn/ui Tailored CSS Zod Prisma Neon + pgvector LangChain LangGraph Vercel AI SDK Gemini Inngest Arcjet

Explore the Spendix dashboard layout at a glance.

Spendix dashboard view

Schema Overview

Spendix relational schema
Entity relationships powering accounts, budgets, AI memory, and plan entitlements.

Plan Comparison

Higher tiers inherit every capability from the preceding plans, with premium-only rows called out explicitly.

Feature Free Pro Premium
Income & expense tracking
Monthly budget setup
Search & filter transactions
AI receipt scan (3/month)
Multiple accounts
Unlimited AI receipt scans
Recurring transactions
Budget alert emails
AI spending insights
AI finance chatbot
AI bulk insert (statement or screenshot ingest)
CSV, Excel & PDF export

Product Pillars

  • Unified Ledger Control — Multi-account books, high-fidelity CRUD, and tight reconciliation keep every inflow/outflow auditable.
  • AI-Assisted Imports — Gemini-powered parsing plus human-in-the-loop review accelerate bulk bank statement ingestion.
  • Recurring Cashflow Engine — Deterministic schedulers project subscriptions, loans, and bills into actionable calendars.
  • Budget Intelligence — Envelope-style tracking, alert thresholds, and visualizations surface overspend before it escalates.
  • Finance Copilot — Conversational agents grounded in private vector memory translate intents into secure actions.
  • Governed Access — Plan-aware UX, entitlement gating, and webhook-synced billing data keep monetization trustworthy.

Feature Spotlight

Subscription Intelligence

Plan graphs, feature matrices, and plan-order logic ensure every surface knows what a member can access. Clerk webhooks synchronize lifecycle events, while experience toggles automatically hide, disable, or upsell premium affordances.

Recurring Transactions Engine

Recurrence schemas encode daily to custom cadences, while Inngest orchestrators expand those rules into dated invoices, autopay reminders, and monthly summaries. Optimistic UI states keep editing silky even before workers confirm the schedule.

AI Imports & Bulk Bank Statements

A dedicated AI imports workspace combines drag-and-drop uploads, Gemini extraction, and LangChain tooling to normalize CSV, XLS, or PDF statements. Duplicate guards and semantic similarity checks protect the ledger before final commit.

Duplicate Receipt Protection (Import job id)

Each receipt import also generates a deterministic hash scoped by user ID, so the same document can never be reprocessed. When a match is detected, the workflow blocks the upload with the precise error message “this receipt has been converted to a transaction already.”

Transactions Workspace

The core ledger canvas features rapid filters, inline edits, and a transaction drawer tuned for keyboard-first workflows. Zod-backed forms guarantee category, amount, and metadata integrity while delivering real-time totals and context chips.

AI Finance Copilot

Vercel AI Elements drive a conversational surface that blends short-term context with long-term embeddings. LangGraph routes between analysis, insight, and action nodes so Spendix can summarize budgets, draft next steps, or queue transactions just by chatting.

---
config:
  theme: neo-dark
---
flowchart TB
    A([⭘ Start]) --> B([💡 Agent Node])
    B --> C{❓ Type of Question?}
    C -->|Direct Question| E([🏁 End])
    C -->|Tool Needed| D([🛠 Tool Node])
    C -->|RAG / Memory Needed| M([📚 RAG Memory Node])
    D --> F{🔍 Tool Exists?}
    F -->|Yes| G([⚡ Run Tool & Return ToolMessage])
    F -->|No| H([❌ Return Error ToolMessage])
    G --> B
    H --> B
    M --> R{🔍 RAG Tool Exists?}
    R -->|Yes| S([📖 Fetch from Memory & Return Response])
    R -->|No| T([❌ Return Error Message])
    S --> B
    T --> B
    B --> E
    subgraph MemoryFlow["🧠 MemoryGraph"]
        I([⭘ Start]) --> J([📝 Summarize Node])
        J --> K([💾 Remember Node])
        K --> L([🏁 End])
    end
    classDef circle fill:#1f2937,stroke:#3b82f6,stroke-width:2px,color:#ffffff;
    classDef square fill:#111827,stroke:#10b981,stroke-width:2px,color:#ffffff;
    class A,E,I,L circle;
    class B,D,M,G,H,S,T,J,K square;
Loading

Workflow showing how LangGraph agents branch between reasoning, memory refresh, and ledger actions.

Safeguards & Notifications

Arcjet threat intelligence filters abusive clients before API or server actions execute, while Nodemailer alerts broadcast budget breaches or anomaly pings with branded templates. Every sensitive route stays wrapped in authenticated, rate-limited handlers.

System Architecture

---
config:
  theme: default
---
flowchart LR
 subgraph Client["Client"]
        UI(["Next.js + shadcn/ui"])
        AIAgent["Vercel AI Elements"]
  end
 subgraph Edge["Edge"]
        Clerk[("Clerk Auth & Billing")]
        Arcjet["Arcjet Shield"]
  end
 subgraph App["App"]
        Actions["Server Actions"]
        API["Route Handlers"]
        LangGraph["LangGraph Orchestrator"]
  end
 subgraph Data["Data"]
        Prisma[("Prisma ORM")]
        Neon[("Neon PostgreSQL + pgvector")]
  end
 subgraph Workers["Workers"]
        Inngest[("Inngest Cron & Events")]
        Nodemailer>"Email Alerts"]
  end
    UI --> Clerk
    Clerk --> Actions
    AIAgent --> LangGraph
    LangGraph --> Prisma & Inngest
    Actions --> Prisma
    Prisma --> Neon
    API --> Arcjet
    Arcjet --> Actions
    Inngest --> Prisma & Nodemailer

    AIAgent@{ shape: hex}
    Arcjet@{ shape: h-cyl}
    Actions@{ shape: tag-doc}
    style UI stroke:#2962FF,fill:#BBDEFB
    style AIAgent fill:#FFCDD2,stroke:#D50000
    style Clerk fill:#FFE0B2,stroke:#FF6D00
    style Arcjet fill:#E1BEE7,stroke:#AA00FF
    style LangGraph fill:#C8E6C9,stroke:#00C853
    style Prisma fill:#BBDEFB,stroke:#2962FF
    style Neon fill:#C8E6C9,stroke:#00C853
    style Inngest fill:#FFCDD2,stroke:#D50000
    style Nodemailer fill:#FFD600
    style App fill:transparent
    style Workers fill:transparent
    style Data fill:transparent
    style Edge fill:transparent
    style Client fill:transparent
Loading

Small overview of System Architecture how data is flowing

  • Type Safety Everywhere — Shared schemas span forms, server actions, and persistence layers.
  • Vector Intelligence — pgvector-backed memory ensures AI answers are grounded in first-party data.
  • Event Sourcing — Inngest flows provide durable retries and idempotent ledger mutations.
  • Edge Hardening — Clerk verifies identity, Arcjet throttles anomalies, and secret rotation keeps ingress secure.

Getting Started

Prerequisites

  • Node.js 20+, pnpm 9+.
  • Neon PostgreSQL database with the pgvector extension enabled.
  • Clerk application (publishable + secret keys, billing & webhook URLs).
  • Gemini + Google API keys, Arcjet key, Inngest event + signing keys.
  • SMTP credentials for Nodemailer (SES, Resend, custom SMTP, etc.).

Installation

  1. pnpm install
  2. pnpm prisma generate
  3. pnpm exec prisma migrate deploy
  4. (Optional) pnpm seed
  5. pnpm dev

Example .env

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxx
CLERK_SECRET_KEY=sk_test_xxxxx
CLERK_WEBHOOK_SIGNING_SECRET=whsec_xxxxx
CLERK_BILLING_WEBHOOK_SIGNING_SECRET=whsec_xxxxx

NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/
NEXT_PUBLIC_APP_URL=http://localhost:3000

DATABASE_URL=postgresql://USER:PASSWORD@neon-host/db?sslmode=require
DIRECT_URL=postgresql://USER:PASSWORD@neon-host/db?sslmode=require

PGVECTOR_EXTENSION=pgvector
ARCJET_KEY=ajkey_xxxxx
INNGEST_EVENT_KEY=inngest_event_xxxxx
INNGEST_SIGNING_KEY=inngest_sign_xxxxx

GEMINI_API_KEY=AIzaSy...xxxx
GOOGLE_API_KEY=AIzaSy...xxxx

NODEMAILER_SMTP_HOST=smtp.gmail.com
NODEMAILER_SMTP_PORT=465
NODEMAILER_USER=alerts@spendix.app
NODEMAILER_PASS=app-specific-password
EMAIL_ALERT_FROM="Spendix Alerts <alerts@spendix.app>"

Useful Scripts

  • pnpm dev — Next.js dev server with hot reload.
  • pnpm lint — ESLint across the monorepo.
  • pnpm build — Production bundle with type checks.
  • pnpm inggest — Launch inggest dev server.
  • pnpm webhook — Expose localhost via ngrok for Clerk webhooks.
  • pnpm start — Launch compiled output.
  • pnpm format / pnpm format:check — Prettier helpers.

Operational Notes

  • Bank Statement Imports deduplicate by account, institution, amount, and timestamp windows before persisting.
  • Budget Alerts evaluate soft (75%) and hard (100%+) thresholds with context-specific advice in every email.
  • AI Memory batches LangGraph recaps so embeddings stay fresh and storage lean.
  • Bot Defense leans on Arcjet fingerprints, rate ceilings, and challenge flows to protect APIs and server actions.

Roadmap

  • Predictive cashflow forecasting and anomaly detection.
  • Direct bank connections (Plaid, Teller, Belvo) feeding AI imports.
  • Shared workspaces (family / teams) with scoped permissions.
  • Tax-ready exports and advanced reporting packages.

Author

Pritam Maity — Full-Stack & AI Engineer
🔗 https://spedix.app

Always open to collaboration, code reviews, or deep dives into Spendix’s architecture—reach out!

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

No contributors

Languages