A full-stack web application that gamifies the bar crawl experience by turning it into an interactive team-based trivia game. Players can purchase bar crawls for different locations, form teams, and compete by answering location-specific questions while tracking their progress and drink choices.
 
Designed to be low cost and scalable

Features

Location-Based Bar Crawls:
– Guided tour of popular bars available across popular destinations 
– Trivia curated to the bar and travel destination
 
Interactive Team Play:
– Create and manage bar crawl groups
– Invite team members via email or link with secure JWT-encoded links
– Real-time game state updates
– Collaborative question answering
– Drink tracking by category (beer, seltzer, wine, mixed drinks, shots)
 
Secure Purchase Flow:
– Stripe integration for payments
– Automated order processing via webhooks
– Secure group claiming system
– JWT-based authentication

Technical Architecture

Frontend
– React-based single-page application
– TypeScript for type safety
– Static file distribution via CDN
– Real-time game state polling
– Responsive design for mobile and desktop
Backend
– Django REST API
– Asynchronous order processing service (RQ)
– JWT authentication
– PostgreSQL database for persistent storage
– Redis caching for game state optimization
– S3 storage for game configurations and assets
Infrastructure
– Distributed architecture with separate API and admin instances
– CDN-backed static file serving of S3 objects
– Automated deployments via GitHub integration
– Scalable cloud infrastructure

System Design

Game State Management
– Real-time synchronization using 5-second polling
– Redis caching for optimized read operations
– Atomic updates for question answers
– Drink tracking per step
 
Comprehensive game state includes:
– Current step
– Answered questions for current step
– Group members
– Drink totals
 
Data Flow
1. Game configurations stored as JSON in S3 and game entry is added to the games table via the admin endpoint
2. A new Group containing a game id, a user, and a number of invites 
3. User requests Group data including S3 URL (presigned for authorized access) and a Join Code
4. Group state is cached in Redis 
5. User invites members, adding users to the group
5. Each member polls the Group state every 5 seconds, which is retrieved from cache
5. Game state updated by users starting the game, answering questions, and starting a new step
4. Final step concludes and Results are generated 
4.5 Clients poll every 5 seconds until results are generated, then all polling stops

CI/CD

Backend Repository Structure
“`
main

└─ release/api → App Platform deployment

└─ release/admin → Admin server deployment
“`
 
API Updates
1. Create branch from main
2. Implement changes
3. Merge to main
4. Create PR to merge main into release/api
5. Automatic deployment via Digital Ocean App Platform
 
Admin Updates
1. Merge main into release/admin
2. SSH into admin host
3. Update at /opt/barcrawl/backend
4. Update environment configurations
5. Restart services

 

Frontend Repository Structure
“`
main

└─ release/web-app
“`
Frontend Updates
1. Checkout new dev/<feature> branch
2. Implement changes
3. Build and test
4. Create PR to merge dev into main then main into release/web-app

Monthly Operational Costs

Infrastructure

SQL Database....................$15

Redis Database..................$15

API App.........................$12

Web App..........................$0

S3...............................$5

Admin Server....................$24

Domain Name......................$3 (tri-annually)

Services
Outlook Email....................$6   

Hubspot.........................$15 (annually)

MailerSend.......................$0


Total............................$89 /month

Leave a Reply

Your email address will not be published. Required fields are marked *