Skip to content

Admin Guide

Quick reference for managing users, credits, and packages.

Accessing Admin Console

  1. Navigate to /admin
  2. Must have role = 'admin' in your profile

To make yourself an admin (run in Supabase SQL editor):

UPDATE profiles SET role = 'admin' WHERE email = 'your@email.com';

Dashboard Overview

The Overview tab shows:

  • Total Users: All registered accounts
  • Credits in Circulation: Sum of all user balances
  • Purchased Today: Credits bought via Stripe today
  • Used Today: Credits consumed by conversions today

Managing Users

Finding Users

  • Use the search box to find by email or name
  • Results paginated at 20 per page

Changing Roles

  • Click the role dropdown next to any user
  • Select “user” or “admin”
  • Cannot demote yourself

Credit Operations

Click + Credits to grant free credits:

  • Enter amount and optional reason
  • Good for: trials, promotions, compensation

Click Adjust for corrections:

  • Requires a reason
  • Can be positive or negative
  • Good for: billing corrections, manual fixes

Managing Packages

The Packages tab shows all credit bundles:

  • Active: Toggle to enable/disable for purchase
  • Featured: Gets “Most Popular” badge
  • Pricing shows per-package and per-credit cost

Default packages:

NameCreditsPricePer Credit
Starter50$9.99$0.20
Standard200$29.99$0.15
Professional500$59.99$0.12
Enterprise2000$199.99$0.10

Custom Pricing

To give a user special pricing:

Terminal window
# Via API
curl -X PUT /api/admin/users/{userId}/pricing \
-H "Authorization: Bearer $TOKEN" \
-d '{"discountPercent": 25}'

Or use the database directly:

INSERT INTO customer_pricing (user_id, discount_percent, notes)
VALUES ('user-uuid', 25, 'Enterprise contract');

Options:

  • discount_percent: % off all packages (e.g., 25 = 25% off)
  • price_per_credit_cents: Fixed per-credit price

Common Tasks

Refund a User

  1. Go to Users → Find user
  2. Click Adjust
  3. Enter positive amount (e.g., 10 to add 10 credits back)
  4. Reason: “Refund for [issue]“

Disable a Package

  1. Go to Packages
  2. Click the “Active” button to toggle off
  3. Package won’t appear in purchase options

Check User History

  1. Go to Users → Click user row
  2. View full transaction history
  3. See custom pricing if set

Handle Payment Disputes

  1. Check Stripe Dashboard for dispute details
  2. If legitimate:
    • Find user in admin
    • Use Adjust to deduct disputed credits
    • Reason: “Stripe dispute [ID]“

Monitoring

Low Balance Alerts

Currently manual. Check:

  • Conversion failures with “INSUFFICIENT_CREDITS”
  • Users with balance = 0 who recently used credits

Revenue Tracking

Use Stripe Dashboard for:

  • Daily/weekly/monthly revenue
  • Refunds and disputes
  • Customer lifetime value

Security Notes

  • Admin routes require valid JWT + admin role
  • All credit operations are logged with created_by
  • Cannot delete transaction history (audit trail)
  • Stripe webhook verifies signature

Troubleshooting

”User not found”

  • UUID format issue or user deleted
  • Check profiles table directly

Credits not added after purchase

  • Check Stripe webhook logs
  • Verify STRIPE_WEBHOOK_SECRET is correct
  • Look for errors in worker logs

User can’t purchase

  • Check if packages are active
  • Verify Stripe keys are configured
  • Test in Stripe test mode first