Kreeda is a digital scorekeeping and sports platform
π Kreeda
A social platform for street sports β where every gully match gets a digital scoreboard.
Kreeda lets players create teams, schedule matches, track live scores ball-by-ball, run tournaments, and build their sports profiles. Starting with cricket and football, itβs built for the way real people actually play β on streets, in parks, anywhere.
π― The Problem
Millions of casual and street-level sports enthusiasts play matches every day with no way to:
- Track scores in real time with proper scorecards
- Build a sports profile that showcases their playing history
- Organize teams with member management, invitations, and roles
- Resolve scoring disputes when two scorers disagree on what just happened
- Share live matches so friends and family can follow along remotely
Kreeda solves all of this with a purpose-built platform spanning web, Android, and iOS.
ποΈ Architecture Overview
Kreeda is a full-stack, multi-platform system with four independently developed codebases that work together:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENTS β
β β
β ββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββ β
β β kreeda-web β β Android App β β iOS App β β
β β (Next.js) β β β β β β
β β β β Kreeda Multiplatform (KMP) β β
β β React 19 β β Jetpack Compose + SwiftUI β β
β β TypeScript β β Kotlin + Ktor + Koin β β
β βββββββββ¬βββββββββ ββββββββββ¬ββββββββ ββββββββ¬ββββββββ β
βββββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββ
β REST / WebSocketβ β
βββββββββββββΌβββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββ
β BACKEND (FastAPI) β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β API Routers β Services β Sport Engines β Models β β
β ββββββββββββββ¬βββββββββββββββββββββββ¬ββββββββββββββββββ β
β β β β
β ββββββββββββββΌβββββββββ ββββββββββββΌβββββββββββ β
β β PostgreSQL 15 β β Redis 7 β β
β β (Primary DB) β β (Pub/Sub + β β
β β β β Caching) β β
β βββββββββββββββββββββββ βββββββββββββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββ β
β β Supabase (Auth + File Storage) β β
β ββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βοΈ Tech Stack
Backend β Kreeda-Backend
| Layer | Technology |
|---|---|
| Framework | FastAPI (async Python) |
| ORM | SQLAlchemy 2.0 + asyncpg |
| Database | PostgreSQL 15 |
| Cache & Pub/Sub | Redis 7 |
| Auth | Supabase (wrapped in swappable abstraction) |
| Migrations | Alembic |
| Real-time | WebSocket + Redis pub/sub |
| Testing | pytest + httpx + websockets (81 integration tests) |
| Infrastructure | Docker Compose |
Web Frontend β kreeda-web
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| UI | React 19 + TypeScript 5 |
| Styling | Tailwind CSS 4 + Material Design 3 tokens |
| Auth | JWT (access + refresh) + Google OAuth 2.0 (PKCE) |
| Data Fetching | Generic apiClient<T>() with auto token refresh |
| Rendering | ISR for live matches (30s revalidation) |
Mobile β Kreeda_Multiplatform
| Layer | Technology |
|---|---|
| Framework | Kotlin Multiplatform (KMP) |
| UI | Jetpack Compose (shared) + SwiftUI (iOS entry) |
| Architecture | Clean Architecture + MVVM |
| Networking | Ktor (multiplatform HTTP client) |
| DI | Koin (feature-module pattern) |
| Storage | Room (local DB) + DataStore (preferences) |
| Security | EncryptedSharedPreferences (Android) / Keychain (iOS) |
| Navigation | Compose Navigation with type-safe routes |
Companion App β Vyayam
| Layer | Technology |
|---|---|
| Framework | Jetpack Compose |
| Architecture | Clean Architecture + MVVM |
| DI | Dagger Hilt |
| Storage | Room + Firebase Firestore |
| Health | Health Connect SDK (bidirectional read + write) |
| Testing | JUnit + Mockk + Turbine |
π₯ Core Features
1. Dual-Scorer System with Conflict Resolution
The centerpiece of Kreedaβs scoring engine. Each match has two independent scorers. When both submit the same event, itβs auto-confirmed. When they disagree, a conflict is raised with a timed dispute window and community voting.
Scorer A submits "4 runs" βββ
βββ Match? β
β Auto-confirmed
Scorer B submits "4 runs" βββ
Scorer A submits "4 runs" βββ
βββ Mismatch? β οΈ β Conflict raised
Scorer B submits "wide" βββ β Players vote
β Resolved by majority
2. Real-Time Live Scoring
- WebSocket connections via Redis pub/sub for instant score updates
- Spectators see ball-by-ball updates in real time
- ISR-powered public live match pages on the web (30-second refresh)
- Full match state tracking: runs, wickets, extras, overs, strike rotation
3. Team Management
- Create teams with sport type, logo, and auto-generated join codes
- Role-based membership: Owner, Admin, Captain, Player
- Invitation system: invite by username or share a join code
- Multi-team support β players can belong to multiple teams
4. Complete Match Lifecycle
Created β Toss Recorded β Playing XI Set β Started β In Progress β Completed
β Paused β
β Abandoned
- Cricket: overs format, toss, batting/bowling order, extras, wicket types
- Football: goals, assists, cards, half-time management
5. Social & Profiles
- Player profiles with sport-specific stats (batting avg, bowling economy, goals scored)
- Follow/unfollow system with follower/following counts
- User search and public profile pages
- Block/unblock functionality
6. Tournaments (planned)
- Tournament creation with registration
- Points table generation
- Bracket/league format support
π§© Backend Deep Dive
API Surface β 60+ Validated Endpoints
| Module | Prefix | Endpoints |
|---|---|---|
| Auth | /api/v1/auth/* | 11 β signup, signin (password/OTP/OAuth), token management, password reset |
| Users | /api/v1/users/* | 14 β onboarding, profiles, follows, search, sport profiles, blocking |
| Teams | /api/v1/teams/* | 13 β CRUD, members, invitations, join-by-code |
| Matches | /api/v1/matches/* | 14 β lifecycle, toss, participants, settings, live listing |
| Scoring | /api/v1/scoring/* | 9 β events, confirm/dispute, conflicts, voting, match state |
| Live | WS /ws/live/{id} | 1 β real-time WebSocket stream |
Sport Engine Pattern
The backend uses a registry-based sport engine pattern that makes adding new sports straightforward:
app/sports/
βββ base.py # Abstract sport engine interface
βββ registry.py # Sport engine registry
βββ cricket/ # Cricket-specific rules, validation, state
βββ football/ # Football-specific rules, validation, state
Each sport engine handles:
- Event validation (is this a legal delivery? valid goal?)
- State computation (current score, overs, innings)
- Match completion detection
Data Model β 16 SQLAlchemy Models
User Β· Team Β· TeamMember Β· Match Β· MatchParticipant Β· MatchSettings Β· ScoringEvent Β· ScoreConflict Β· CricketMatchState Β· CricketBallEvent Β· FootballMatchState Β· FootballEvent Β· Tournament Β· Venue Β· Notification Β· SportProfile
π Web Frontend Deep Dive
102 API Client Functions
Every backend endpoint has a typed TypeScript wrapper in lib/api/, powered by a single generic fetch client:
// One function handles all API calls with automatic JWT refresh
async function apiClient<T>(endpoint, options): Promise<T>
// On 401 β refresh token β retry original request β seamless UX
App Router Architecture
src/app/
βββ (app)/ β Authenticated routes (shared sidebar)
β βββ dashboard/
β βββ teams/
β βββ matches/
β βββ tournaments/
β βββ profile/
β βββ search/
β βββ notifications/
βββ auth/ β Login, signup, OAuth, OTP, onboarding
βββ matches/live/ β Public ISR page (no auth required)
Key decisions:
- Route groups
(app)/β shared layout without affecting URLs - Edge middleware β checks auth cookies before page loads (no flash of protected content)
- React Context β
AuthProvidershares user state without prop drilling - Cookie-based sessions β works with Edge middleware, unlike localStorage
π± Mobile Deep Dive
Clean Architecture Layers
βββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION (Compose) β
β Screens β ViewModels β UiState β
βββββββββββββββββββββββββββββββββββββββββββ€
β DOMAIN (Pure Kotlin) β
β UseCases β Repository Interfaces β
β Models (no framework dependencies) β
βββββββββββββββββββββββββββββββββββββββββββ€
β DATA (Ktor, Room) β
β API Services β DTOs β Mappers β
β Repository Implementations β
βββββββββββββββββββββββββββββββββββββββββββ€
β CORE (Shared Infrastructure) β
β Session Β· Network Β· Storage Β· DI β
β Error Handling Β· Logging Β· Config β
βββββββββββββββββββββββββββββββββββββββββββ
Feature-Module Architecture
Each feature (auth, team, match, scoring) is a self-contained module with its own:
data/β DTOs, API service, mapper, repository impldomain/β models, repository interface, use casespresentation/β screens, viewmodel, UI statedi/β Koin module
Implemented Features (Mobile)
| Feature | Status | Details |
|---|---|---|
| Auth | Complete | Sign-in, sign-up, Google OAuth, OTP, onboarding |
| Home | Complete | Dashboard with stats, quick actions, recent matches |
| Profile | Complete | View/edit profile, sport profiles, follow system |
| Teams | Complete | CRUD, join by code, invitations, role management |
| Match | In Progress | Lobby, toss, playing XI |
| Scoring | Planned | Dual-scorer, WebSocket, conflict resolution |
Platform-Specific Implementations (expect / actual)
| Component | Android | iOS |
|---|---|---|
| Secure Storage | EncryptedSharedPreferences | Keychain |
| Logger | Android Logcat | OSLog |
| Network Monitor | ConnectivityManager | NWPathMonitor |
| App Config | BuildConfig | Bundle |
ποΈ Vyayam β Workout Tracking Companion
Vyayam is a companion app within the Kreeda ecosystem focused on fitness tracking with a unique differentiator: bidirectional Health Connect integration.
- READ heart rate, SpO2, steps from Health Connect
- WRITE workouts back β so they appear in Google Fit, Samsung Health, and every connected app
- 200+ exercise library with set/rep tracking
- Advanced analytics with progress visualizations
- Local-first with Firebase cloud sync
π§ͺ Testing & Quality
Backend
- 81 integration tests across 10 test files
- 13 smoke test operations (85% pass rate)
- 60+ API endpoints validated
- End-to-end workflows: complete cricket match with dual-scorer, team invitation flows
Web
- TypeScript strict mode β full type-checking on build
- ESLint with Next.js recommended config
Mobile
BaseViewModelwithlaunchSafeβ all coroutine errors are caught and typedResult<T>wrapper β no raw exceptions leak to the UIDispatcherProviderβ all coroutines testable withTestDispatcher
π Security
| Aspect | Implementation |
|---|---|
| Authentication | Supabase Auth with JWT (access + refresh tokens) |
| Token Storage | Encrypted platform keystores (Keychain / EncryptedSharedPreferences / HTTP-only cookies) |
| API Security | Bearer token auth, automatic 401 β refresh β retry |
| Network | HTTPS only, certificate pinning in production |
| Session | Edge middleware route protection (web), SessionManager (mobile) |
| Data | Sensitive data never logged; Room encryption for local storage |
π How It All Works Together
- A player signs up via the mobile app or web β Supabase handles auth, the backend creates their profile
- They create a team β auto-generated join code, invite friends by username or share the code
- A match is scheduled β pick sport, format (e.g., 10-over cricket), invite an opposing team
- Toss is recorded β winner decides to bat or bowl
- Two scorers are assigned β both independently submit ball-by-ball events
- Events are validated β the sport engine checks legality, the dual-scorer system checks agreement
- Live updates stream β WebSocket pushes every confirmed event to all connected spectators
- Conflicts are resolved β disagreements trigger a vote among players
- Match completes β full scorecard generated, player stats updated, profiles enriched
- The cycle repeats β teams play more matches, build history, climb leaderboards
π Project Stats
| Metric | Value |
|---|---|
| Backend API Endpoints | 60+ |
| Web Frontend Routes | 15+ |
| Mobile Screens Built | 12+ |
| SQLAlchemy Models | 16 |
| TypeScript API Functions | 102 |
| Integration Tests | 81 |
| Mobile Use Cases | 30+ |
| Supported Sports | Cricket, Football |
| Platforms | Web, Android, iOS |
π οΈ Development Setup
Backend
cp .env.example .env # Add Supabase credentials
docker compose up --build # PostgreSQL + Redis + FastAPI
docker compose run --rm web alembic upgrade head # Apply migrations
Web
cd kreeda-web
npm install
npm run dev # http://localhost:3000
Mobile
cd Kreeda_Multiplatform
./gradlew :composeApp:assembleDebug # Android
# Open iosApp/ in Xcode for iOS
π¬ Links
| Resource | URL |
|---|---|
| Backend Repo | github.com/AdarshKumarDalai/kreeda-backend |
| Web App Repo | github.com/AdarshKumarDalai/kreeda-web |
| Mobile App Repo | github.com/AdarshKumarDalai/Kreeda_Multiplatform |
Built by Adarsh Kumar Dalai β because every gully match deserves a proper scorecard. πβ½