Dev By Don
Sniffing out the best solutions

Case Study: Score Space

A Journey into Football Analytics and Web Development

Score Space Logo
Visit Score Space

In the ever-evolving world of football analytics, I noticed a gap—a lack of advanced statistics platforms tailored specifically for bettors. As a football enthusiast and software developer, this gap presented both a challenge and an opportunity. I envisioned a platform that not only provided comprehensive football data but also fostered a community where users could share predictions and insights. This vision led to the creation of Score Space, a football analytics platform designed to help enthusiasts and analysts make data-driven predictions.

The Genesis of Score Space

The idea for Score Space emerged from a combination of personal interests and professional aspirations. At my workplace, I felt my professional growth was stagnating. I wasn’t being challenged, and with limited seniority at the company, opportunities to tackle more complex projects were scarce. I was searching for a project that would push me out of my comfort zone and confront me with new lessons and skills to learn.

Simultaneously, I wanted to delve deeper into web development by learning Django, a popular Python web framework I hadn’t explored yet. I aimed to create something meaningful—a platform that could serve a real need in the football betting community.

Embarking on this project allowed me to:

  • Challenge myself professionally: Overcame stagnation by taking on a complex, independent project that pushed my boundaries.
  • Learn and apply Django: Expanded my technical repertoire by mastering Django, complementing my existing experience with Python and web development.
  • Build an end-to-end application: Unlike my professional work focused on internal business tools, I wanted to create a user-facing application involving data engineering, web development, and architectural design.
  • Implement best practices: Applied methodologies like Test-Driven Development (TDD), Continuous Integration/Continuous Deployment (CI/CD), and maintained high code quality from the outset.

Choosing the Right Tools for the Journey

Starting with Django seemed like the natural choice due to its “batteries-included” approach, offering built-in features that accelerate development. However, I was more comfortable with a three-tier architecture—separating the frontend, backend, and database layers—which aligned with my experience from previous projects.

I chose Svelte/SvelteKit for the frontend because I believed it would provide a more modern and dynamic user experience compared to using Django’s built-in templating system. I thought that Django might not offer the level of frontend interactivity and responsiveness that a dedicated JavaScript framework could provide. In hindsight, this perception may have been mistaken due to my lack of experience with Django’s full capabilities.

Pairing Svelte/SvelteKit with the Django Rest Framework (DRF) for the backend allowed me to create a robust API while leveraging my familiarity with three-tier architectures. This setup also positioned the platform for potential future expansion into mobile applications, where a well-defined API would be essential. While this decision added complexity, it enabled me to work more efficiently by building on my strengths and delivering a modern user interface.

The tech stack for Score Space included:

  • Backend: Python, Django, Django Rest Framework
  • Frontend: Svelte, SvelteKit
  • Database: PostgreSQL
  • Task Queue and Scheduling: Celery, Celery Beat
  • Authentication: DRF SimpleJWT, Secure Cookies
  • Payments: Stripe Integration
  • Monitoring and Analytics: Sentry, PostHog
  • Code Quality: SonarQube, Ruff, Bandit
  • Deployment: AWS Lightsail (Backend), Cloudflare (Frontend)

Building the Platform

With the tech stack in place, I began architecting the platform. I implemented a three-tier architecture, separating the presentation layer, application logic, and data storage. This structure enhanced scalability and maintainability, crucial for a platform expected to handle extensive data and user interactions.

Data Pipelines and Analytics

One of the core features of Score Space is its ability to provide live and historical football data. To achieve this, I built data pipelines using Celery and Celery Beat. These tools allowed me to handle background tasks for data fetching, transformation, and loading without blocking the main application. The platform fetches data from external football APIs, processes it, and stores it in a PostgreSQL database.

I leveraged Django Filters to enable users to generate customized analytics. For instance, a user could find the average number of goals for AC Milan when playing at home and winning or drawing. This level of detail caters specifically to bettors looking for nuanced statistics to inform their predictions.

Community and Engagement Features

Understanding that betting and sports analytics are social activities, I integrated community features into Score Space. I developed a social platform reminiscent of Twitter, where users can post updates tagged with specific teams or matches. These posts appear on relevant match pages, fostering discussions and allowing users to gauge community sentiment about upcoming games. This experience deepened my understanding of tree structures in relational databases. To implement a comment section inspired by Reddit’s system, I chose a Materialized Paths tree structure, offering a good balance between read and write operations compared to Adjacency List or Nested Set models.

Moreover, users can create and share their own predictions. The system validates these predictions, building a historical record that users can analyze to understand their betting patterns better. This feature adds a layer of personalization and self-improvement to the platform.

Authentication and Payments

Security and monetization were essential considerations. I implemented authentication using DRF SimpleJWT as secure cookies, ensuring that user data and interactions remained protected. For the payments and subscription model, I integrated Stripe. This choice provided a seamless and secure way for users to subscribe to premium features, while Stripe’s robust documentation and support streamlined the integration process.

Frontend Development and UI/UX Considerations

Working on Score Space opened my eyes to the frontend side of development. I learned a great deal about:

  • Security in frontend-backend communication: Gained a deeper understanding of security threats like SQL injection, CSRF, and XSS attacks. Implemented measures like proper input validation, CSRF tokens, and CORS policies to secure data exchange.
  • UI/UX design principles: Studied design systems, the “three-click rule,” and other UI/UX best practices to create an intuitive and user-friendly interface.
  • Holistic software development: This project helped me become a more complete engineer, considering the entire software stack rather than focusing solely on the backend.

Embracing Test-Driven Development and Continuous Integration

Learning from past experiences where insufficient testing led to maintenance challenges, I made Test-Driven Development (TDD) a cornerstone of this project. Writing tests before the actual code ensured that each component met its requirements and functioned reliably. This approach facilitated confident refactoring and encouraged cleaner, more modular code.

To support this, I established a robust Continuous Integration (CI) pipeline. Automated tests ran with every commit, and tools like Ruff enforced coding standards through linting and formatting checks. I integrated Bandit for security analysis, identifying potential vulnerabilities early in the development process. Additionally, SonarQube provided insights into code quality, highlighting areas for improvement.

This CI setup ensured that only code passing all tests and checks would be merged, maintaining the integrity of the main branch. It enabled a rapid feedback loop, allowing for quick detection and resolution of issues, and supported a trunk-based development workflow where changes could be integrated continuously and efficiently.

By investing in TDD and CI/CD practices, I significantly enhanced the reliability and maintainability of the platform, ultimately delivering a higher-quality product to users.

Conclusion

Developing Score Space was an invaluable experience that reinvigorated my passion for software development and challenged me to grow as an engineer. The project allowed me to:

  • Challenge myself professionally: Overcame stagnation by taking on a complex, independent project that pushed my boundaries.
  • Expand my technical skills: Gained proficiency in Django, Svelte, and various tools like Celery and Stripe.
  • Apply best practices: Implemented TDD, CI/CD pipelines, and maintained high code quality throughout the project.
  • Understand architectural design: Built a scalable and maintainable platform using a three-tier architecture.
  • Enhance security awareness: Learned about security threats and implemented measures to protect the application and its users.
  • Improve UI/UX design skills: Created a user-friendly interface by applying design principles and best practices.
  • Create value for users: Developed a platform that fills a gap in the market, providing advanced analytics and a community space for football bettors.

This project not only fulfilled my initial objectives but also provided insights that are directly transferable to professional environments. It reinforced the importance of seeking challenges, thoughtful planning, adaptability, and continuous learning in software development, ultimately helping me become a more complete engineer who thinks about the entire software stack.

Back to Projects