A Base MiniApp for AI promo and cashback platform with ROZO token rewards system
The Rozo Rewards MiniApp is a comprehensive AI promo and cashback platform that allows users to:
- Earn ROZO tokens from purchases at AI services and merchants
- Use ROZO tokens to reduce payment amounts (1 ROZO = $0.01 USD)
- Shop with savings through a complete order management system
- Enjoy tier-based benefits with increasing cashback multipliers
| Discovery | Lifestyle | Profile |
|---|---|---|
![]() |
![]() |
![]() |
- 100:1 Conversion: 1 ROZO = $0.01 USD
- Payment Offset: Use ROZO to reduce actual payment amounts
- Tier Multipliers: Bronze (1x) β Silver (1.2x) β Gold (1.5x) β Platinum (2x)
- Shopping Cart: Add multiple products with individual cashback rates
- Order Management: Full lifecycle from cart to completion
- ROZO Integration: Apply tokens during checkout for instant savings
- AI Services: OpenRouter, Civitai, Venice AI, and more
- Product SKUs: Individual cashback rates per product
- Dynamic Rates: Product-specific rates override merchant defaults
- Crypto Payments: Via RozoPayButton integration
- Multi-Chain Support: Ethereum, Base, Polygon, Optimism, Arbitrum
- Automatic Cashback: Earn ROZO tokens on every confirmed purchase
Scenario: User buys $50 worth of AI services
- Products: 2 items with different cashback rates (5% and 8%)
- ROZO Offset: Use 2000 ROZO ($20) to reduce payment
- Final Payment: Pay only $30 instead of $50
- Cashback Earned: 340 ROZO ($3.40) from the purchase
- Net Result: Saved $16.60 (33.2% effective discount!)
- Coinbase OnchainKit: Wallet integration
- TailwindCSS: Modern UI styling
- TypeScript: Type-safe development
- React Query: State management and caching
- PostgreSQL: Robust database with ACID compliance
- Edge Functions: Serverless API endpoints (Deno runtime)
- Row Level Security: Data protection and access control
- Real-time: Live updates for transactions and balances
- Multi-chain Support: 5+ supported networks
- Transaction Verification: On-chain verification for security
- Gas Optimization: Efficient transaction processing
rozo-rewards-miniapp/
βββ src/
β βββ app/ # Next.js app directory
β β βββ ai-services/ # AI services catalog page
β β βββ restaurant/ # Restaurant/merchant pages
β β βββ profile/ # User profile management
β βββ components/ # React components
β β βββ ui/ # Reusable UI components
β β βββ *-list-view.tsx # Feature-specific components
β βββ providers/ # Context providers
βββ supabase/
β βββ migrations/ # Database schema migrations
β βββ functions/ # Edge functions (API)
β βββ auth/ # Authentication endpoints
β βββ cashback/ # ROZO cashback system
β βββ orders/ # Order management
β βββ products/ # Product catalog
β βββ merchants/ # Merchant management
β βββ _shared/ # Shared utilities and types
βββ docs/ # Comprehensive API documentation
β βββ API.md # Main API documentation
β βββ ROZO_CASHBACK_API.md
β βββ ORDER_MANAGEMENT_API.md
β βββ TECHNICAL_SPEC.md
β βββ openapi.yaml # OpenAPI specification
βββ public/ # Static assets
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe development
- Supabase - Backend-as-a-Service with PostgreSQL
- TailwindCSS - Utility-first CSS framework
- Viem/Wagmi - Ethereum development framework
- Coinbase OnchainKit - Wallet integration
- RozoPayButton - Custom payment component
- Multi-chain Support - Ethereum, Base, Polygon, Optimism, Arbitrum
- ESLint - Code linting
- Lefthook - Git hooks for quality checks
- pnpm - Fast package manager
- Node.js 18+
- pnpm (recommended)
- Docker (for local Supabase)
-
Clone the repository
git clone https://github.com/your-org/rozo-rewards-miniapp.git cd rozo-rewards-miniapp -
Install dependencies
pnpm install
-
Set up environment variables
cp example.env .env.local # Edit .env.local with your configuration -
Start local Supabase (optional)
supabase start
-
Run database migrations
supabase db reset
-
Start the development server
pnpm dev
-
Open your browser Navigate to http://localhost:3000
- Complete API Lifecycle Guide - Step-by-step tutorial with curl examples
- Quick Reference - Essential commands and patterns (TL;DR version)
- API.md - Complete API reference (all 18 endpoints)
- ROZO_CASHBACK_API.md - ROZO token system details
- ORDER_MANAGEMENT_API.md - Shopping cart and orders
- TECHNICAL_SPEC.md - Technical implementation details
- openapi.yaml - OpenAPI 3.0 specification
- Live API Tests - Comprehensive test suite for production APIs
GET /cashback/balance- Get ROZO balancePOST /cashback/apply-offset- Calculate payment offsetPOST /cashback/claim- Claim cashback from purchases
GET /orders/cart- Get shopping cartPOST /orders/cart- Add items to cartPOST /orders/checkout- Proceed to checkoutGET /orders- List user orders
GET /products- List products with cashback ratesGET /products/{id}- Get product detailsGET /merchants- List merchants and services
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
# Optional: Intercom Integration
INTERCOM_APP_ID=your-intercom-app-id- Create a new Supabase project
- Run the provided migrations
- Configure authentication providers
- Deploy edge functions
# Unit tests
pnpm test
# E2E tests
pnpm test:e2e
# Lint code
pnpm lint- Add products to cart
- Apply ROZO offset during checkout
- Complete payment with crypto
- Verify cashback earning
The application uses a comprehensive PostgreSQL schema with:
- Users & Profiles - User management with ROZO balances
- Merchants & Products - Catalog with individual cashback rates
- Orders & Order Items - Complete shopping cart system
- Cashback Records - ROZO token transactions
- Transactions - Blockchain payment records
Key tables:
profiles- User profiles with ROZO balancesmerchants- AI services and merchant catalogproducts- SKUs with individual cashback ratesorders- Shopping cart and order managementorder_items- Individual products in orderscashback- ROZO token earning and usage recordstransactions- Blockchain payment confirmations
Cart β Pending β Paid β Completed
β β β β
Abandoned Cancelled Refunded Cashback Available
| Tier | Requirement | Multiplier | Example Benefit |
|---|---|---|---|
| Bronze | $0+ earned | 1.0x | 5% β 5% cashback |
| Silver | $500+ earned | 1.2x | 5% β 6% cashback |
| Gold | $2,500+ earned | 1.5x | 5% β 7.5% cashback |
| Platinum | $10,000+ earned | 2.0x | 5% β 10% cashback |
- Connect your GitHub repository to Vercel
- Configure environment variables
- Deploy automatically on push
# Build the application
pnpm build
# Start production server
pnpm start# Deploy all functions
supabase functions deploy
# Deploy specific function
supabase functions deploy cashback-balance- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Live Demo: [Coming Soon]
- API Documentation: ./docs/API.md
- Supabase Dashboard: [Your Supabase Project]
- Coinbase OnchainKit: https://onchainkit.xyz
For support and questions:
- Create an issue in this repository
- Join our Discord community
- Email: [email protected]
Built with β€οΈ by the Rozo AI Team


