aman-ga

πŸš€ Aman ga? - Quick Start Guide

Prerequisites

1. Setup Supabase (5 minutes)

  1. Go to supabase.com and create a free project
  2. Once project is ready, go to Settings β†’ API
  3. Copy these two values:
    • Project URL (e.g., https://xxxxx.supabase.co)
    • anon/public key (e.g., eyJhbG...)
  4. Go to SQL Editor and run the contents of database/schema.sql
  5. (Optional) Run database/seed.sql for test data

2. Setup Backend

cd backend

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Create .env file
cp .env.example .env

# Edit .env with your Supabase credentials
nano .env  # or use your preferred editor

Edit .env:

SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key-here
SECRET_KEY=your-secret-key-for-jwt-change-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

Run Backend:

source venv/bin/activate
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Backend will run on: http://localhost:8000

API Docs: http://localhost:8000/docs

3. Setup Frontend

cd frontend

# Install dependencies
npm install

# Create .env.local (optional)
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local

# Run development server
npm run dev

Frontend will run on: http://localhost:3000

4. Test the Application

Demo Credentials:

Test Flow:

  1. Open http://localhost:3000
  2. Login as admin or register new user
  3. As User:
    • Purchase β€œCek Dasar” (Rp 1.000 - auto-approved)
    • Upload payment proof (screenshot any image)
    • See service credit activated instantly
    • Use the service from dashboard
  4. As Admin:
    • View pending payments
    • Approve/Reject payments
    • Flag fraud (auto-suspends user)

5. API Endpoints

Authentication

Payment

Admin (requires role)

Health Check

Troubleshooting

Backend won’t start:

# Check if Supabase credentials are correct
# Check if schema.sql was run in Supabase SQL Editor
# Check port 8000 is not in use
lsof -i :8000

Frontend won’t start:

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

Can’t login:

Project Structure

aman-ga-poc/
β”œβ”€β”€ backend/              # FastAPI backend
β”‚   β”œβ”€β”€ main.py          # API endpoints
β”‚   β”œβ”€β”€ auth.py          # JWT authentication
β”‚   β”œβ”€β”€ database.py      # Supabase client
β”‚   β”œβ”€β”€ models.py        # Pydantic schemas
β”‚   └── services/        # Business logic
β”‚       β”œβ”€β”€ payment.py   # Payment processing
β”‚       β”œβ”€β”€ fraud.py     # Fraud detection
β”‚       └── notification.py
β”œβ”€β”€ frontend/            # Next.js frontend
β”‚   β”œβ”€β”€ pages/          # React pages
β”‚   β”‚   β”œβ”€β”€ index.js    # Login/Register
β”‚   β”‚   β”œβ”€β”€ dashboard.js
β”‚   β”‚   β”œβ”€β”€ admin.js
β”‚   β”‚   └── payment.js
β”‚   └── components/     # Reusable components
└── database/           # SQL schemas
    β”œβ”€β”€ schema.sql
    └── seed.sql

Next Steps

  1. Add real payment gateway (Midtrans, Xendit)
  2. Add Supabase Storage for image uploads
  3. Add WhatsApp API for notifications
  4. Deploy to production (Vercel + Railway/Render)

Support

For issues or questions, create an issue on GitHub.