WorthIt adalah aplikasi mobile yang membantu konsumen memvalidasi keputusan belanja secara real-time di dalam toko. Pengguna dapat memindai struk atau label harga, lalu sistem akan menganalisis apakah harga tersebut Worth It (wajar), Waspada (sedikit mahal), atau Mahal β berdasarkan data historis harga dari Alfagift menggunakan algoritma Weighted Moving Average (WMA) dan Support/Resistance.
| Fitur | Deskripsi |
|---|---|
| πΈ OCR Scan | Scan struk/label harga via Gemini Vision AI |
| π Price Analysis | Keputusan BUY / SUBSTITUTE / DONT_BUY berbasis WMA |
| ποΈ Shopping List | Daftar belanja bulanan dengan estimasi budget |
| π Expense Tracker | Riwayat pengeluaran per kategori |
| β Favorites | Simpan produk favorit untuk pantau harga |
| π Notifications | Alert harga produk dalam pantauan |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FRONTEND (Mobile) β
β Flutter 3.x Β· Riverpod Β· Dio Β· Supabase SDK β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β BACKEND (Python) β
β FastAPI Β· Uvicorn Β· PyJWT Β· Supabase Python β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β C-ENGINE β
β worthit_engine.c Β· ctypes bridge (c_bridge.py) β
β WMA Β· Support Β· Resistance Β· SR Position β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β INFRASTRUCTURE β
β Supabase (Auth + PostgreSQL + Storage) β
β WSL2 (Ubuntu) Β· Microsoft Dev Tunnels β
β Gemini 2.5 Flash (OCR/Vision) β
β Playwright + APScheduler (Alfagift Scraper) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Komponen | Versi Minimum | Catatan |
|---|---|---|
| Flutter SDK | 3.11.5+ | Install via flutter.dev |
| Dart SDK | 3.11.5+ | Sudah bundled dengan Flutter |
| Android SDK | API 21+ | via Android Studio |
| Git | Terbaru |
| Komponen | Versi Minimum | Catatan |
|---|---|---|
| WSL2 (Ubuntu 22.04+) | - | Wajib untuk menjalankan backend |
| Python | 3.11+ | Di dalam WSL |
| pip / venv | Terbaru | |
| Microsoft Dev Tunnels CLI | Terbaru | Install dev tunnels |
| GCC (build tools) | - | Untuk compile C-Engine: sudo apt install build-essential |
1. Clone repository
git clone https://github.com/<your-org>/worthit.git
cd worthit/frontend2. Buat file konfigurasi lokal
File local_config.dart tidak ada di Git (sengaja dihapus demi keamanan). Buat manual dari template:
cp lib/config/local_config.example.dart lib/config/local_config.dartLalu isi dengan kredensial yang diperoleh dari lead developer:
// lib/config/local_config.dart
class LocalConfig {
static const supabaseUrl = 'https://YOUR_PROJECT.supabase.co';
static const supabaseAnonKey = 'sb_publishable_XXXX...';
static const supabaseAuthRedirectUrl = 'com.example.worthit_app://login-callback';
// URL dari Dev Tunnel yang aktif (tanya ke developer yang menjalankan backend)
static const apiBaseUrl = 'https://XXXX-XXXX.devtunnels.ms';
}3. Install dependencies dan jalankan
flutter pub get
flutter runImportant
Seluruh langkah ini dijalankan di dalam terminal WSL2, bukan PowerShell Windows.
1. Masuk ke WSL dan navigasi ke folder backend
# Di PowerShell Windows:
wsl
# Kemudian di WSL:
cd "/mnt/d/Fallah's File/Code/Personal Project/WorthIt/backend"2. Buat virtual environment dan install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt3. Buat file .env
Minta file .env dari lead developer. JANGAN commit file ini ke Git.
# Isi file backend/.env:
SUPABASE_URL=https://YOUR_PROJECT.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJhbG...
SUPABASE_JWT_SECRET=YOUR_JWT_SECRET
GEMINI_API_KEY=AIza...4. Build C-Engine (jika belum ada worthit_engine.so)
cd engine
gcc -shared -fPIC -o worthit_engine.so worthit_engine.c -lm
cd ..5. Jalankan Backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000Backend akan berjalan di http://localhost:8000. Swagger UI tersedia di http://localhost:8000/docs.
Dev Tunnels diperlukan agar perangkat Android fisik bisa mengakses backend yang berjalan di WSL.
1. Login ke Dev Tunnels (sekali saja)
devtunnel user login2. Buat dan aktifkan tunnel (jalankan di terminal WSL terpisah)
devtunnel host -p 8000 --allow-anonymousSalin URL yang diberikan (format: https://XXXX-8000.devtunnels.ms) dan masukkan sebagai apiBaseUrl di local_config.dart frontend.
WorthIt/
βββ frontend/ # Flutter App
β βββ lib/
β βββ config/ # Konfigurasi (Supabase URL, API URL)
β βββ controllers/ # Riverpod Notifiers
β βββ models/ # Data models (API response)
β βββ repositories/ # Data access layer
β βββ screens/ # Halaman-halaman UI
β βββ services/ # Auth, Notification, Privacy
β βββ utils/ # PDF, Snackbar, Image helpers
β βββ widgets/ # Reusable UI components
β
βββ backend/ # Python FastAPI Backend
β βββ core/ # Security (JWT), Categories
β βββ engine/ # C-Engine bridge, WMA scoring
β βββ models/ # Pydantic request/response models
β βββ routers/ # API endpoints (analyze, scan, shopping, dll.)
β βββ scripts/ # Alfagift scraper & data import tools
β βββ utils/ # Supabase client singleton
β βββ main.py # FastAPI app entrypoint
β βββ requirements.txt
β
βββ supabase_*.sql # Schema & migration SQL files
Proyek menggunakan Supabase (PostgreSQL). Tabel utama:
| Tabel | Deskripsi |
|---|---|
users |
Profil user + subscription tier + monthly budget |
products |
Katalog produk |
price_history |
Riwayat harga per produk per bulan |
scan_history |
Log setiap scan yang dilakukan user |
purchase_history |
Barang yang benar-benar dibeli |
monthly_shopping_lists |
Daftar belanja bulanan |
shopping_list_items |
Item dalam daftar belanja |
favorite_products |
Produk favorit user |
notifications |
Notifikasi in-app |
Untuk setup database baru, jalankan file SQL migrasi di folder root secara berurutan di Supabase SQL Editor.
- Fork & Clone repository ini
- Minta akses dari lead developer ke:
- Supabase project (untuk mendapatkan Anon Key & URL)
- File
backend/.env(berisi service role key & secret)
- Setup frontend ikuti Langkah A di atas
- Untuk development yang memerlukan backend lokal, ikuti Langkah B & C
- Jika hanya perlu akses frontend, cukup gunakan URL Dev Tunnel yang sudah aktif dari developer lain
Tip
Tidak perlu menjalankan backend sendiri untuk sekadar mengembangkan UI. Koordinasi dengan developer backend untuk mendapatkan URL Dev Tunnel yang sedang aktif, lalu masukkan ke local_config.dart.
| Komponen | Status |
|---|---|
| Flutter Frontend | π‘ In Development |
| FastAPI Backend | π‘ In Development |
| C-Engine (Scoring) | β Selesai |
| Alfagift Scraper | π‘ In Development |
| OCR (Gemini Vision) | β Selesai |
| Supabase Auth (Google Sign-In) | β Selesai |
| Shopping List | β Selesai |
| Expense Tracker | β Selesai |
| Push Notifications | π΄ Belum |
| Production Deployment | π΄ Belum |
- JANGAN commit
backend/.envataulocal_config.dartke Git - JANGAN share URL Dev Tunnel secara publik β tunnel tidak terproteksi password di mode development
- JWT verification saat ini dalam mode development β wajib diaktifkan sebelum deployment production
| Role | Nama |
|---|---|
| Fullstack Lead | Fallah |
| Backend / Engine | Tim Backend |
| Frontend / UI | Tim Frontend |