A sophisticated financial analytics application for intelligent expense tracking, budgeting, and AI-powered financial insights.
- Overview
- Features
- Tech Stack
- Project Structure
- Getting Started
- Environment Variables
- Database Setup
- Available Scripts
- Architecture Decisions
- Security
- Contributing
- License
Cashlatics is a full-stack financial analytics platform designed to give users deep visibility into their personal or business finances. Built on the latest Next.js App Router with server-first architecture, it combines real-time budgeting, transaction tracking, and AI-generated insights β all wrapped in a secure, performant, and type-safe codebase.
Whether you're managing monthly budgets, analyzing spending trends, or generating financial reports, Cashlatics provides the tools to make informed financial decisions faster.
- π Financial Dashboard β Interactive overview of your income, expenses, and net balance at a glance
- πΈ Transaction Management β Add, edit, categorize, and filter transactions with full CRUD support
- π Analytics & Insights β Visual charts powered by Recharts for spending trends and category breakdowns
- π€ AI-Powered Analysis β Integrated Google Gemini AI for generating natural-language financial insights and recommendations
- π Secure Authentication β Multi-provider auth (credentials + Google OAuth) via Better Auth with cross-tab session sync
- π‘οΈ Bot Protection & Rate Limiting β Arcjet integration safeguards all API routes from abuse
- π§ Email Notifications β Transactional emails via Resend for alerts, confirmations, and reports
- π Date-Range Filtering β Flexible date picker (react-day-picker) for custom reporting periods
- π± Responsive Design β Mobile-first UI built with Tailwind CSS v4 and Radix UI primitives
- π Animations β Smooth micro-interactions via Motion (Framer Motion)
| Category | Technology | Version |
|---|---|---|
| Framework | Next.js (App Router) | 16.2.4 |
| Runtime | React | 19.2.4 |
| Language | TypeScript | ^5 |
| Database | PostgreSQL (Neon Serverless) | β |
| ORM | Drizzle ORM | ^0.45.2 |
| Authentication | Better Auth | ^1.6.9 |
| Security | Arcjet | ^1.4.0 |
| AI | Google Generative AI (Gemini) | ^0.24.1 |
| Resend | ^6.12.3 | |
| UI Components | Radix UI + Shadcn/UI | β |
| Styling | Tailwind CSS | ^4 |
| Animations | Motion | ^12.38.0 |
| Charts | Recharts | ^3.8.1 |
| Forms | React Hook Form + Zod | β |
| Icons | Phosphor Icons + Lucide React | β |
| Migrations | Drizzle Kit | ^0.31.10 |
cashlatics/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication Routes
β β βββ login/ # Login page
β β βββ signup/ # Registration page
β βββ (landing)/ # Public Marketing Pages
β β βββ page.tsx # Landing/Home page
β βββ (main)/ # Legacy/Shared Server Actions
β βββ (web)/ # Core Protected Application
β β βββ dashboard/ # Main dashboard & financial views
β β βββ _actions/ # Feature-scoped Server Actions
β β βββ _components/ # Feature-scoped Client Components
β βββ api/ # API Route Handlers
β β βββ auth/ # Better Auth API endpoints
β β βββ [...]/ # Webhook & misc endpoints
β βββ layout.tsx # Root Layout (Providers, Fonts)
β βββ globals.css # Global Styles & Tailwind Config
β
βββ components/ # Shared Reusable Components
β βββ form/ # Form input components
β βββ landing/ # Landing page section components
β βββ layout/ # Structural layout components
β βββ ui/ # Shadcn/UI component library
β βββ navbar.tsx # Global navigation bar
β βββ logout.tsx # Logout action component
β
βββ lib/ # Core Logic & Utilities
β βββ arcjet.ts # Arcjet security configuration
β βββ auth.ts # Better Auth server setup
β βββ auth-client.ts # Better Auth client helpers
β βββ utils.ts # Tailwind merge & general utilities
β
βββ db/ # Database Layer
β βββ schema/ # Drizzle schema definitions
β βββ index.ts # Neon DB client initialization
β βββ seed.ts # Development data seeding script
β
βββ actions/ # Global Server Actions
βββ hooks/ # Custom React Hooks
βββ types/ # Global TypeScript type definitions
βββ drizzle/ # Auto-generated SQL migrations
βββ public/ # Static assets (images, icons, fonts)
β
βββ next.config.ts # Next.js configuration
βββ drizzle.config.ts # Drizzle ORM + migration config
βββ tailwind.config.ts # Tailwind CSS configuration
βββ package.json # Dependencies & scripts
- Node.js v20 or higher
- pnpm / npm / yarn
- A PostgreSQL database (recommended: Neon β free serverless Postgres)
- Arcjet account for security keys
- Better Auth setup
- Google AI Studio API key (Gemini)
- Resend API key for email
-
Clone the repository
git clone https://github.com/ArDnath/cashlatics.git cd cashlatics -
Install dependencies
npm install # or pnpm install -
Set up environment variables
Copy the example env file and fill in your values:
cp .env.example .env.local
See Environment Variables for details.
-
Run database migrations
npm run db:generate npm run db:migrate
-
(Optional) Seed the database
npm run db:seed
-
Start the development server
npm run dev
Open http://localhost:3000 in your browser.
Create a .env.local file in the root directory with the following variables:
# ββ Database βββββββββββββββββββββββββββββββββββββββββ
DATABASE_URL=postgresql://<user>:<password>@<host>/<dbname>?sslmode=require
# ββ Better Auth ββββββββββββββββββββββββββββββββββββββ
BETTER_AUTH_SECRET=your_secret_key_here
BETTER_AUTH_URL=http://localhost:3000
# ββ Google OAuth (Optional) ββββββββββββββββββββββββββ
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# ββ Arcjet Security βββββββββββββββββββββββββββββββββββ
ARCJET_KEY=your_arcjet_key_here
# ββ Google Gemini AI ββββββββββββββββββββββββββββββββββ
GOOGLE_GENERATIVE_AI_API_KEY=your_gemini_api_key
# ββ Resend Email ββββββββββββββββββββββββββββββββββββββ
RESEND_API_KEY=your_resend_api_key
RESEND_FROM_EMAIL=noreply@yourdomain.com
# ββ App βββββββββββββββββββββββββββββββββββββββββββββββ
NEXT_PUBLIC_APP_URL=http://localhost:3000
β οΈ Never commit your.env.localfile to version control.
Cashlatics uses Drizzle ORM with Neon Serverless PostgreSQL.
Schema definitions live in db/schema/. After modifying any schema file, regenerate and apply migrations:
# Generate migration SQL files
npm run db:generate
# Apply migrations to the database
npm run db:migratePopulate the database with sample financial data for local development:
npm run db:seedThe seed script is located at db/seed.ts and can be customized to fit your development needs.
| Script | Command | Description |
|---|---|---|
dev |
next dev |
Start development server with hot reload |
build |
next build |
Build optimized production bundle |
start |
next start |
Start production server |
lint |
eslint |
Run ESLint checks |
db:generate |
drizzle-kit generate |
Generate SQL migration files from schema |
db:migrate |
drizzle-kit migrate |
Apply pending migrations to database |
db:seed |
tsx db/seed.ts |
Seed database with development data |
Cashlatics is built with security as a first-class concern:
- Arcjet β Bot protection, rate limiting, and shield rules applied at the edge before requests hit application logic
- Better Auth β Industry-standard session management with CSRF protection, secure cookies, and cross-tab session sync
- Environment Isolation β All secrets are server-side only; no sensitive values are exposed to the client bundle
- Zod Validation β All user inputs are validated server-side before any database operation
- SQL Injection Prevention β Drizzle ORM uses parameterized queries by default; no raw SQL interpolation
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a new feature branch:
git checkout -b feat/your-feature-name - Make your changes and commit:
git commit -m "feat: add your feature" - Push to your fork:
git push origin feat/your-feature-name - Open a Pull Request against
main
This project follows Conventional Commits:
feat: add new analytics chart
fix: resolve transaction date parsing bug
chore: update dependencies
docs: improve README setup section
This project is licensed under the MIT License. See the LICENSE file for details.