equitableAmaranthGoat
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ all from the browser, and deployed in milliseconds.
index.ts
https://Bpexch--3778fa0239dc11f0b02b9e149126039e.web.val.run
A comprehensive betting platform with hierarchical user management system similar to bpexch.com.
Website URL: [Your Val Town URL]
Default Login Credentials:
- Username:
owner - Password:
owner123
-
๐ Owner (Top Level)
- Can create/manage Company accounts
- Full system access
- Revenue monitoring
- Access to all features
-
๐ข Company
- Can create/manage Super Admin accounts
- Company-level settings and limits
- Monitor company performance
-
โญ Super Admin
- Can create/manage Dealer accounts
- Monitor dealer performance
- Handle escalations
-
๐ฏ Dealer
- Can create/manage End Users
- Handle user betting activities
- Manage user balances
-
๐ค End Users
- Login with credentials provided by dealer
- Place bets and manage account
- View betting history
- โ Role-based authentication system
- โ No public signup - all accounts created by upper hierarchy
- โ Session-based login with secure cookies
- โ Hierarchical access control
- โ Create users based on role hierarchy
- โ Update user balances
- โ Monitor user activity
- โ Real-time user statistics
- โ Live sports matches (Cricket, Football, Tennis)
- โ Real-time odds display
- โ Bet placement with balance validation
- โ Betting history tracking
- โ Multiple bet types support
- โ Create and manage multiple companies
- โ Set company-specific limits and settings
- โ Monitor company performance
- โ Configure allowed sports
- โ Role-specific dashboards
- โ Real-time statistics
- โ User activity monitoring
- โ Revenue tracking
- Backend: Hono + SQLite + Val Town
- Frontend: React 18 + TailwindCSS
- Authentication: Session-based with cookies
- Database: SQLite with migrations
- Styling: TailwindCSS + Custom CSS
- Deployment: Val Town Platform
โโโ backend/
โ โโโ database/
โ โ โโโ migrations.ts # Database schema & default data
โ โ โโโ queries.ts # Database query functions
โ โโโ routes/ # API route modules
โ โโโ auth.ts # Authentication endpoints
โ โโโ users.ts # User management endpoints
โ โโโ betting.ts # Betting system endpoints
โ โโโ index.ts # Main HTTP entry point
โโโ frontend/
โ โโโ components/
โ โ โโโ UserManagement.js # User creation & management
โ โ โโโ BettingInterface.js # Betting interface for users
โ โ โโโ CompanyManagement.js # Company management (owner)
โ โโโ index.html # Main HTML with React app
โโโ shared/
โ โโโ types.ts # Shared TypeScript types
โโโ README.md
- Use default credentials:
owner/owner123 - Access all features including company creation
- Go to "Companies" tab
- Click "Create New Company"
- Enter company name and settings
- Go to "User Management" tab
- Click "Create New User"
- Select "Super Admin" role
- Set initial balance and limits
- Login as Super Admin
- Create dealer accounts
- Manage dealer limits and commissions
- Login as Dealer
- Create user accounts for betting
- Set user balances and limits
- Login as end user
- View available matches
- Place bets on teams/outcomes
- Monitor betting history
POST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Check auth status
GET /api/users- Get subordinate usersPOST /api/users- Create new userPATCH /api/users/:id/balance- Update user balanceGET /api/users/stats- Get dashboard statistics
GET /api/users/companies- Get companies (owner only)POST /api/users/companies- Create company (owner only)
GET /api/betting/matches- Get available matchesPOST /api/betting/bets- Place a betGET /api/betting/bets- Get user's betsGET /api/betting/balance- Get current balance
The system comes pre-loaded with:
- Default owner account
- Sample cricket and football matches
- Realistic odds and betting options
- Role-based Access Control: Each role can only access appropriate features
- Session Management: Secure session handling with expiration
- Input Validation: All inputs are validated on both client and server
- Balance Validation: Prevents betting more than available balance
- Hierarchical Permissions: Users can only manage their subordinates
This project is designed for Val Town platform:
- All code is ready to deploy
- Database migrations run automatically
- HTTP trigger is configured
- No additional setup required
The interface is fully responsive and works on:
- Desktop computers
- Tablets
- Mobile phones
- All modern browsers
- Modern Design: Glass morphism effects and gradients
- Intuitive Navigation: Role-based navigation menus
- Real-time Updates: Live balance and statistics updates
- Loading States: Smooth loading animations
- Error Handling: User-friendly error messages
- Responsive Layout: Works on all screen sizes
Potential features for future versions:
- Live match updates and scores
- Advanced betting types (over/under, handicap)
- Payment gateway integration
- Mobile app development
- Advanced analytics and reporting
- Multi-language support
- Push notifications
Note: This is a demo betting platform. For production use, ensure compliance with local gambling laws and regulations.