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
Authentication & Security
- ā
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
Company Management (Owner Only)
- ā
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
2. Create Company (Owner Only)
- Go to "Companies" tab
- Click "Create New Company"
- Enter company name and settings
3. Create Super Admin (Owner/Company)
- Go to "User Management" tab
- Click "Create New User"
- Select "Super Admin" role
- Set initial balance and limits
4. Create Dealers (Super Admin)
- Login as Super Admin
- Create dealer accounts
- Manage dealer limits and commissions
5. Create End Users (Dealer)
- 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 login
POST /api/auth/logout - User logout
GET /api/auth/me - Check auth status
GET /api/users - Get subordinate users
POST /api/users - Create new user
PATCH /api/users/:id/balance - Update user balance
GET /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 matches
POST /api/betting/bets - Place a bet
GET /api/betting/bets - Get user's bets
GET /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.