Backend API untuk aplikasi split bill yang memungkinkan pengguna mengunggah struk belanja, melakukan OCR, dan membagi tagihan dengan AI.
- π Authentication & Authorization - JWT-based auth dengan user management
- πΈ Image Upload - Upload gambar struk ke Supabase Storage
- π OCR Processing - Ekstraksi teks dari gambar menggunakan Tesseract.js
- π€ AI Data Extraction - Parsing data struk menggunakan Google Gemini AI
- π° Bill Management - CRUD operations untuk tagihan
- π₯ Split Bill - Fitur untuk membagi tagihan antar pengguna
- ποΈ Database - PostgreSQL dengan TypeORM
- Framework: NestJS
- Database: PostgreSQL
- ORM: TypeORM
- Storage: Supabase Storage
- OCR: Tesseract.js
- AI: Google Gemini API
- Authentication: JWT
- Deployment: Vercel
- Node.js 18+
- PostgreSQL database
- Supabase account
- Google Gemini API key
Buat file .env di root directory dengan konfigurasi berikut:
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/split_bill_db
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here
JWT_EXPIRES_IN=7d
# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-anon-key
# Gemini AI Configuration
GEMINI_API_KEY=your-gemini-api-key-here
# Application Configuration
PORT=3000
NODE_ENV=developmentnpm installPastikan PostgreSQL database sudah berjalan dan buat database baru:
CREATE DATABASE split_bill_db;- Buat project baru di Supabase
- Buat bucket storage dengan nama
receipt-images - Set bucket policy untuk public access
- Copy URL dan anon key ke file
.env
- Dapatkan API key dari Google AI Studio
- Copy API key ke file
.env
npm run start:devnpm run build
npm run start:prodPOST /auth/register- Register user baruPOST /auth/login- Login userGET /auth/profile- Get user profile
POST /ocr/upload- Upload dan proses strukGET /ocr/bills- Get semua tagihan userGET /ocr/bills/:id- Get detail tagihanPUT /ocr/bills/:id/split- Update split detailsDELETE /ocr/bills/:id- Hapus tagihan
src/
βββ auth/ # Authentication module
β βββ dto/ # Data transfer objects
β βββ entities/ # User entity
β βββ auth.controller.ts
β βββ auth.service.ts
β βββ auth.module.ts
βββ ocr/ # OCR & Bill management module
β βββ entities/ # Bill entity
β βββ ocr.controller.ts
β βββ ocr.service.ts
β βββ ocr.module.ts
β βββ tesseract-fix.ts # Tesseract wrapper
βββ app.controller.ts # Main app controller
βββ app.service.ts # Main app service
βββ app.module.ts # Root module
βββ main.ts # Application entry point
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covProject ini sudah dikonfigurasi untuk deployment di Vercel dengan file vercel.json.
Pastikan semua environment variables sudah diset di dashboard Vercel:
DATABASE_URLJWT_SECRETSUPABASE_URLSUPABASE_KEYGEMINI_API_KEY
- Pastikan Tesseract worker sudah ter-load dengan benar
- Check log untuk error messages
- Pastikan gambar yang diupload valid dan readable
- Verify bucket
receipt-imagessudah dibuat - Check bucket policies untuk public access
- Verify API keys sudah benar
- Check API key validity
- Verify quota dan rate limits
- Check network connectivity
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License.