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 miliseconds.
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.