Skip to content

ArDnath/cashlatics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cashlatics Logo

Cashlatics πŸ’°

A sophisticated financial analytics application for intelligent expense tracking, budgeting, and AI-powered financial insights.


πŸ“‹ Table of Contents


Overview

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.


✨ Features

  • πŸ“Š 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)

πŸ› οΈ Tech Stack

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
Email 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

πŸ“‚ Project Structure

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

πŸš€ Getting Started

Prerequisites

  • 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

Installation

  1. Clone the repository

    git clone https://github.com/ArDnath/cashlatics.git
    cd cashlatics
  2. Install dependencies

    npm install
    # or
    pnpm install
  3. Set up environment variables

    Copy the example env file and fill in your values:

    cp .env.example .env.local

    See Environment Variables for details.

  4. Run database migrations

    npm run db:generate
    npm run db:migrate
  5. (Optional) Seed the database

    npm run db:seed
  6. Start the development server

    npm run dev

    Open http://localhost:3000 in your browser.


πŸ”‘ Environment Variables

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.local file to version control.


πŸ—„οΈ Database Setup

Cashlatics uses Drizzle ORM with Neon Serverless PostgreSQL.

Schema Management

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:migrate

Seeding (Development)

Populate the database with sample financial data for local development:

npm run db:seed

The seed script is located at db/seed.ts and can be customized to fit your development needs.


πŸ“œ Available Scripts

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

πŸ›οΈ Architecture Decisions

CashlaticsArchi

πŸ›‘οΈ Security

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

🀝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a new feature branch: git checkout -b feat/your-feature-name
  3. Make your changes and commit: git commit -m "feat: add your feature"
  4. Push to your fork: git push origin feat/your-feature-name
  5. Open a Pull Request against main

Commit Convention

This project follows Conventional Commits:

feat: add new analytics chart
fix: resolve transaction date parsing bug
chore: update dependencies
docs: improve README setup section

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


About

Cashlatics is a modern financial analytics web application built with Next.js 16.2.4, featuring user authentication, OAuth integration, and a dashboard for financial tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages