๐ฐ Expense Tracker
March 14, 2026 ยท View on GitHub
A modern, full-stack expense tracking application built with Next.js 15, tRPC, and PostgreSQL. Track your expenses, manage shared costs with friends, and gain insights into your spending patterns with beautiful analytics.
โจ Features
- ๐ณ Multi-Account Management - Track expenses across multiple bank accounts
- ๐ฅ Shared Expenses - Split costs with friends and track who owes what
- ๐ Analytics Dashboard - Visualize spending patterns with interactive charts
- ๐ Self Transfers - Record transfers between your own accounts
- ๐ Transaction Sessions - Organize expenses into sessions for better tracking
- ๐จ Modern UI - Beautiful, responsive interface with dark/light theme support
- ๐ Secure Authentication - Email/password authentication with session management
- โก Real-time Updates - Optimistic updates with TanStack Query
- ๐ฑ Mobile Responsive - Works seamlessly on desktop, tablet, and mobile devices
- ๐ Advanced Filtering - Filter and search transactions with URL-persisted state
๐ Tech Stack
Frontend
- Next.js 15 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- TailwindCSS - Utility-first styling
- shadcn/ui - Re-usable component library
- Radix UI - Accessible UI primitives
- Lucide Icons - Beautiful icon set
- Recharts - Charts and data visualization
Backend
- tRPC - End-to-end typesafe APIs
- Drizzle ORM - TypeScript ORM
- PostgreSQL - Relational database
- better-auth - Authentication solution
State Management & Forms
- TanStack Query - Server state management
- React Hook Form - Form handling
- Zod - Schema validation
- nuqs - URL state management
Developer Experience
- ESLint - Code linting with security plugins
- Prettier - Code formatting
- TypeScript - Static type checking
- Docker - Containerization
๐ Prerequisites
Before you begin, ensure you have the following installed:
- Node.js 20.x or higher
- pnpm 8.x or higher (recommended) or npm/yarn
- PostgreSQL 14.x or higher
- Git
๐ ๏ธ Installation
1. Clone the repository
git clone https://github.com/jainhardik120/expense-tracker.git
cd expense-tracker
2. Install dependencies
pnpm install
# or
npm install
# or
yarn install
3. Set up environment variables
Create a .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/expense_tracker"
# App URL (optional)
NEXT_PUBLIC_BASE_URL="http://localhost:3000"
# Skip environment validation during build (optional)
SKIP_ENV_VALIDATION=false
4. Set up the database
Generate and run database migrations:
# Generate migration files
pnpm db:generate
# Apply migrations to database
pnpm db:migrate
5. Start the development server
pnpm dev
Open http://localhost:3000 in your browser to see the application.
๐๏ธ Database Schema
The application uses a multi-tenant architecture where all data is scoped by userId. Key entities include:
- users - User accounts and profiles
- sessions - Authentication sessions
- bankAccount - User's financial accounts
- statements - All transactions (expenses, transfers, etc.)
- friendsProfiles - People involved in shared expenses
- splits - How expenses are divided among friends
- selfTransferStatements - Transfers between user's own accounts
๐ Project Structure
src/
โโโ app/ # Next.js App Router
โ โโโ (auth)/ # Authentication routes (login/register)
โ โโโ (main)/ # Protected app routes
โ โ โโโ sessions/ # Expense tracking sessions
โ โ โโโ statements/ # Transaction management
โ โ โโโ aggregated/ # Analytics and summaries
โ โโโ api/ # API routes
โโโ components/ # Reusable React components
โ โโโ ui/ # shadcn/ui components
โ โโโ data-table/ # Table components with filtering
โโโ server/ # Backend logic
โ โโโ routers/ # tRPC routers
โ โโโ helpers/ # Helper functions
โโโ db/ # Database configuration
โ โโโ schema.ts # Drizzle schema definitions
โโโ lib/ # Utility functions and configurations
โโโ hooks/ # Custom React hooks
๐ฏ Available Scripts
# Development
pnpm dev # Start development server with Turbopack
pnpm build # Build for production
pnpm start # Start production server
# Database
pnpm db:generate # Generate migration files
pnpm db:migrate # Run database migrations
# Code Quality
pnpm lint # Run ESLint
pnpm lint:fix # Fix ESLint errors
pnpm typecheck # Run TypeScript type checking
pnpm format # Format code with Prettier
# Analysis
pnpm duplicate:check # Check for code duplication
pnpm update:check # Check for dependency updates
๐ณ Docker Deployment
Build and run with Docker:
# Build the Docker image
docker build -t expense-tracker .
# Run the container
docker run -p 3000:3000 \
-e DATABASE_URL="your_database_url" \
expense-tracker
๐ Deployment
Vercel (Recommended)
- Push your code to GitHub
- Import your repository to Vercel
- Add environment variables
- Deploy!
Other Platforms
The application can be deployed to any platform that supports Node.js and Docker:
- Railway
- Render
- Fly.io
- AWS/GCP/Azure
Ensure you:
- Set up a PostgreSQL database
- Configure environment variables
- Run database migrations
- Deploy the application
๐ค Android Release Automation
The Android GitHub Actions workflow at .github/workflows/main.yml now publishes the release .aab to the Google Play internal track as part of the master release pipeline. A separate release trigger remains as a fallback for manually published GitHub releases.
Before that release job can succeed:
- Enable the Google Play Android Developer API for the Google Cloud project tied to your Play Console account.
- Create a service account key in JSON format.
- Add that service account under Google Play Console
Users and permissionsand grant it access tocom.jainhardik120.expensetracker. - Add the JSON file contents to the repository GitHub secret
PLAYSTORE_SERVICE_ACCOUNT_JSON. - Make sure the app already exists in Play Console and has had its first upload created manually.
๐ค Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Follow the existing code style
- Run
pnpm lintandpnpm typecheckbefore committing - Write meaningful commit messages
- Update documentation as needed
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Next.js - The React Framework
- shadcn/ui - Beautiful UI components
- tRPC - End-to-end typesafe APIs
- Drizzle ORM - TypeScript ORM
๐ง Contact
For questions or feedback, please open an issue on GitHub.
Built with โค๏ธ using Next.js 15