Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SpendScan 🧾

Smart Receipt Expense Tracker β€” A mobile app for recording expenses and income, scanning receipts with AI-powered OCR, and viewing financial reports.

Built with React Native (Expo SDK 54) + Node.js backend + Supabase database + Groq AI for receipt parsing.


✨ Features

  • πŸ’° Manual Tracking β€” Add expenses and income with categories
  • πŸ“· Receipt Scanning β€” Take a photo of your receipt, and AI extracts items automatically
  • 🧠 AI-Powered Parsing β€” Groq Vision (Llama 4 Scout 17B) intelligently identifies items, prices, and dates directly from receipt images
  • πŸ“‹ Item Review β€” Edit, delete, or add items before saving
  • πŸ“Š Dashboard β€” Monthly income/expense/balance cards with category breakdown
  • πŸ“ˆ Report Screen β€” Interactive line chart with daily trends and month picker
  • πŸ” Transaction History β€” Search, filter by category, filter by month
  • πŸ” Authentication β€” Register/login/logout with JWT token management
  • ☁️ Cloud Storage β€” Receipt images stored in Supabase Storage

πŸ›  Tech Stack

Mobile App

Library Purpose
React Native + Expo SDK 54 Cross-platform mobile framework
React Navigation Tab + Stack navigation
@expo/vector-icons Icon library
react-native-chart-kit Line charts for reports
expo-image-picker Camera & gallery access
expo-file-system File reading for OCR upload
expo-secure-store JWT token storage
date-fns Date formatting

Backend

Library Purpose
Node.js + Express (v5) API server
Supabase (PostgreSQL) Database
Supabase Storage Receipt image storage
Groq Vision (Llama 4 Scout 17B) Direct image-to-JSON receipt parsing
OpenAI SDK LLM API client (Groq-compatible)
jsonwebtoken JWT authentication
bcryptjs Password hashing

Deployment

Service Detail
Hosting Vercel (free Hobby plan)
Production URL https://backend-delta-sand-64.vercel.app
Deploy command vercel --cwd backend --prod --yes --force

πŸ“· Screenshots

Dashboard Scan Items Review
Dashboard Scan Receipt Item Review
Report History Login
Report Transaction History Login

Note: Add actual screenshots to docs/screenshots/ folder.


πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Expo Go app on your phone (Android/iOS) β€” for development
  • A Groq API key (console.groq.com) β€” for receipt scanning
  • A Supabase project (supabase.com) β€” for database & storage
  • Vercel CLI β€” for backend deployment (optional)

Quick Install (APK)

Download the latest APK directly on your Android phone:

⬇️ Download SpendScan APK

Or visit: https://expo.dev/accounts/naitkomahli/projects/SpendScan/builds

The APK connects to the production backend at https://backend-delta-sand-64.vercel.app. No setup required.

Run from Source (Development)

# Clone the repository
git clone https://github.com/Naitkomahli/SpendScan.git
cd SpendScan

# Install mobile dependencies
npm install

# Install backend dependencies
cd backend
npm install
cd ..

Backend Setup

Local Development

  1. Create a .env file in backend/:
PORT=3000

# Supabase
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# JWT
JWT_SECRET=your_jwt_secret
JWT_EXPIRES_IN=7d

# LLM (Groq β€” Vision for receipt scanning)
LLM_API_KEY=gsk_your_groq_api_key
LLM_BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=llama-3.3-70b-versatile
LLM_MODEL_VISION=meta-llama/llama-4-scout-17b-16e-instruct
  1. Run database migration in Supabase SQL Editor:
ALTER TABLE transactions ADD COLUMN type VARCHAR(10) NOT NULL DEFAULT 'expense'
CHECK (type IN ('income', 'expense'));
  1. Start the backend server:
cd backend
node src/server.js

Deploy to Vercel (Production)

# Install Vercel CLI
npm install -g vercel

# Set environment variables
echo "your_value" | vercel env add SUPABASE_URL production --yes
echo "your_value" | vercel env add SUPABASE_ANON_KEY production --yes
# ... repeat for all env vars (see table below)

# Deploy
vercel --cwd backend --prod --yes --force

Production URL: https://backend-delta-sand-64.vercel.app

Run Mobile App (Development)

# From project root
npx expo start

Scan the QR code with Expo Go on your phone. Make sure your phone and laptop are on the same WiFi network.

⚠️ Development: The app uses the production Vercel backend by default. If you run the backend locally, update BASE_URL in src/services/api.js to your laptop's IP (e.g., http://192.168.1.19:3000/api).

Build APK (Production)

To build your own APK with EAS Build:

# Install EAS CLI
npm install -g eas-cli

# Login to Expo
eas login

# Build APK
eas build --platform android --profile preview

πŸ“š More Info

For a detailed technical explanation (how each feature works, data flow, glossary), see:

➑️ docs/TECHNICAL.md


πŸ“ Project Structure

SpendScan/
β”œβ”€β”€ App.js                      # Entry point with ErrorBoundary + AuthProvider
β”œβ”€β”€ app.json                    # Expo config
β”œβ”€β”€ eas.json                    # EAS Build profiles
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ TransactionCard.jsx
β”‚   β”‚   β”œβ”€β”€ CategoryBadge.jsx
β”‚   β”‚   β”œβ”€β”€ EmptyState.jsx
β”‚   β”‚   └── Skeleton.jsx        # Shimmer loading placeholders
β”‚   β”œβ”€β”€ constants/              # App constants
β”‚   β”‚   β”œβ”€β”€ colors.js
β”‚   β”‚   └── categories.js
β”‚   β”œβ”€β”€ contexts/
β”‚   β”‚   └── AuthContext.js      # Auth state + SecureStore
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── mockTransactions.js
β”‚   β”œβ”€β”€ navigation/
β”‚   β”‚   └── AppNavigator.jsx    # Tab + Stack navigation
β”‚   β”œβ”€β”€ screens/
β”‚   β”‚   β”œβ”€β”€ HomeScreen.jsx      # Dashboard with income/expense/balance
β”‚   β”‚   β”œβ”€β”€ AddTransactionScreen.jsx
β”‚   β”‚   β”œβ”€β”€ EditTransactionScreen.jsx
β”‚   β”‚   β”œβ”€β”€ TransactionListScreen.jsx
β”‚   β”‚   β”œβ”€β”€ TransactionDetailScreen.jsx
β”‚   β”‚   β”œβ”€β”€ LoginScreen.jsx
β”‚   β”‚   β”œβ”€β”€ ProfileScreen.jsx
β”‚   β”‚   β”œβ”€β”€ ReportScreen.jsx    # Line chart report
β”‚   β”‚   └── ScanScreen.jsx      # Camera/gallery + AI scan + item review
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ api.js              # Fetch wrapper (auto-attaches JWT)
β”‚   β”‚   β”œβ”€β”€ authService.js
β”‚   β”‚   └── transactionService.js
β”‚   └── utils/
β”‚       └── formatCurrency.js
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ .env
β”‚   β”œβ”€β”€ vercel.json             # Vercel routing config
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ server.js           # Express listen (local dev)
β”‚   β”‚   β”œβ”€β”€ app.js              # Express app (Vercel entry via Express preset)
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   └── supabase.js
β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”‚   β”œβ”€β”€ transactionController.js
β”‚   β”‚   β”‚   └── receiptController.js
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── llmParser.js    # Groq Vision receipt parsing
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   β”‚   └── errorHandler.js
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   β”‚   β”œβ”€β”€ transactions.js
β”‚   β”‚   β”‚   └── receipts.js
β”‚   β”‚   └── db/
β”‚   β”‚       └── schema.sql
β”‚   └── package.json
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ PRD.md
β”‚   β”œβ”€β”€ TECHNICAL.md            # Full technical overview
β”‚   β”œβ”€β”€ AGENTS.md               # AI assistant context
β”‚   └── screenshots/
└── README.md

πŸ“‘ API Endpoints

Method Endpoint Description Auth Required
POST /api/auth/register Register new user ❌
POST /api/auth/login Login user ❌
GET /api/transactions Get all transactions βœ…
GET /api/transactions/:id Get transaction by ID βœ…
POST /api/transactions Create transaction βœ…
PUT /api/transactions/:id Update transaction βœ…
DELETE /api/transactions/:id Delete transaction βœ…
POST /api/receipts/scan Upload & scan receipt βœ…

All responses follow { success: boolean, message: string, data: any } format.


πŸ” Environment Variables

Backend (backend/.env)

Variable Required Description
PORT ❌ Server port (default: 3000)
SUPABASE_URL βœ… Supabase project URL
SUPABASE_ANON_KEY βœ… Supabase anonymous key
SUPABASE_SERVICE_ROLE_KEY βœ… Supabase service role key
JWT_SECRET βœ… Secret for signing JWT tokens
JWT_EXPIRES_IN ❌ Token expiry (default: 7d)
LLM_API_KEY βœ… Groq API key
LLM_BASE_URL ❌ Groq API base URL (default: https://api.groq.com/openai/v1)
LLM_MODEL ❌ Text model for general LLM tasks (default: llama-3.3-70b-versatile)
LLM_MODEL_VISION ❌ Vision model for receipt scanning (default: meta-llama/llama-4-scout-17b-16e-instruct)

πŸ§ͺ Testing Checklist

  • Register, login, logout
  • Token persists across app restarts
  • Add income & expense transactions
  • Dashboard shows income/expense/balance
  • Category breakdown with progress bars
  • Transaction list with month filter
  • Search & category filter
  • Edit & delete transactions
  • Report screen with line chart
  • Scan receipt β†’ AI Vision β†’ item review
  • Edit/delete/add items in review screen
  • Batch save multiple transactions from one receipt
  • Profile screen with user info & logout

⬇️ Download APK

Download the latest APK directly on your Android phone:

https://expo.dev/artifacts/eas/EkRE1PMFEeh3E-dSDh5_yK1FJvxegw9H2b4OnVOIEpI.apk

Or visit: Expo Builds Dashboard


πŸ“„ License

This project is for educational and portfolio purposes.


πŸ‘€ Author

Ilham Oktian Ramadhan β€” Mobile App Developer & Project Owner


πŸ™ Acknowledgments

  • React Native & Expo teams
  • Supabase for backend infrastructure
  • Groq (Llama 4 Scout) for free vision AI API
  • Vercel for free hosting

About

An AI-powered personal finance tracker built with React Native, Expo, Node.js, Express, Supabase, and Groq Vision to record transactions and scan receipts automatically.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages