How kavya-hjb217/xpnsone works
Project Type and Purpose
• This is a full-stack web application built on Next.js 13+ (app router), leveraging Convex as a hosted backend (data store + serverless functions) and Inngest for background jobs/cron-style workflows. The UI is composed of React components (pages, nested layouts, shared UI library), and the business logic/data access lives in Convex functions and Inngest tasks.
File Structure
• app/
• Contains Next.js app router pages & layouts split into two route segments:
– (auth): sign-in & sign-up flows
– (main): protected routes (dashboard, contacts, expenses, groups, person, settlements)
• app/api/inngest/route.js: HTTP endpoint for Inngest webhooks
• app/globals.css, app/layout.js: global styles & root layout
• components/
• Reusable UI components (e.g., header, expense-list)
• components/ui: atomic primitives (buttons, dialogs, inputs)
• convex/
• Convex schema & server functions (users.js, expenses.js, groups.js, settlements.js, etc.)
• Convex client config & generated types
• lib/
• Inngest client setup & job definitions (payment-reminders, spending-insights)
• Utility modules
• hooks/
• Custom React hooks for accessing Convex data and user store
• next.config.mjs, middleware.js, postcss.config.mjs, tsconfig/jsconfig, ESLint configs, etc.
• public/: static assets (logos, testimonials)
Main Components & Relationships
a. Frontend (Browser → Next.js SSR/SSG/Client-side)
– Pages under app/(auth) & app/(main)
– React components & shared UI library
– Uses use-convex-query hook to fetch/update data
b. Backend API – Convex
– Convex serverless functions (CRUD on users, groups, expenses, contacts, settlements)
– Data stored in Convex’s managed database
– Accessed via convex-client-provider in React
c. Background Jobs & Workflows – Inngest
– Defined in lib/inngest/*.js
– Triggered via HTTP webhook at app/api/inngest/route.js or via Convex triggers
– Jobs: payment-reminders (emails), spending-insights reports
– External email service integration in convex/email.js or lib/inngest
d. External Services
– Email provider (SMTP or transactional API)
– (Optionally) analytics, logging, third-party auth if configured
Architectural Patterns and Design Principles
• Component-based UI (Next.js app router + nested layouts)
• Serverless backend (Convex functions) decoupled from UI
• Event-driven background processing (Inngest workflows)
• Separation of concerns: UI vs. business logic vs. data access vs. cron jobs
• Hooks for encapsulating data layer (React Query–style via Convex)
Elements
• Clear labels: Browser, Next.js Frontend (Routing & React Components), Convex Backend, Inngest Runner, External Email Service, Database
• Browser → Next.js (page requests, API calls)
• Next.js → Convex (RPC calls via convex-client)
• Inngest → Convex (job triggers)
• Convex → DB (read/write)
• Inngest/Convex → Email Service (send reminders)
• Orange for background workflows (Inngest jobs)
• Gray for external services