Betva is a betting picks web application built with FastAPI, PostgreSQL, and vanilla JavaScript. The application allows users to view daily matches, create accumulators (ACCAs), follow experts, and track their betting statistics.
- Daily match predictions with Over 1.5 goals filter
- Accumulator builder with 12-leg base extending to 20 legs
- Expert tracking and following system
- User authentication (register/login/forgot/password reset)
- Admin panel for match management and accumulator generation
- AI result settlement: Groq reads downloaded match pages (strict, never guesses)
- Visitor counter (counts all visits)
- Swahili UI text
- Backend: FastAPI, PostgreSQL, SQLAlchemy
- Frontend: Vanilla JavaScript, HTML5, CSS3
- Deployment: Uvicorn server on port 8000
- Install dependencies: pip install -r requirements.txt
- Start the server: uvicorn app.main:app --host 127.0.0.1 --port 8000
- Access the application at http://127.0.0.1:8000
The repository ships render.yaml (a Render Blueprint) that creates:
- a free Python web service (
betva) serving both the API and the frontend - a free Render Postgres database (
betva-db) wired toDATABASE_URL
Steps:
- Push this repository to GitHub.
- In the Render Dashboard choose New → Blueprint and connect the repo.
- Enter the secrets Render prompts for:
ADMIN_EMAIL,ADMIN_PASSWORD,FOOTBALL_API_KEY,GROQ_API_KEY. - Apply the Blueprint and wait for the first deploy; the health check is
/health. - Open
https://<service-name>.onrender.com.
Notes:
- Free web services spin down after 15 minutes without traffic and wake on the next request (~1 minute cold start).
- Free Postgres expires 30 days after creation (14-day grace, then deleted) and has 1 GB of storage with no backups. Upgrade the database before expiry to keep the data.
- Database URLs are normalized automatically (
postgres://→postgresql+psycopg2://) and external Render hosts getsslmode=require. - In-process schedulers (ingest every 6 h, settle every 30 min) run only while the service is awake.
- /api/auth/* - Authentication (register, login, forgot, reset)
- /api/picks/* - User picks and accumulators
- /api/experts/* - Expert tracking and following
- /api/visits* - Visitor statistics
- /api/adm/* - Admin-only accumulator engine
- /api/predictions/* - Prediction management
- Password validation (>72 bytes → 422 error)
- Case-insensitive email login/register
- Blank nickname rejection
- EAT timezone handling (UTC+3)
- Bulk settle validation
- Duplicate match ID rejection
- And more...