Disclosure: I work on Sportmicro. This article was drafted with AI assistance.

I started this project with a familiar problem: odds data is useful only when it can be compared quickly, and comparison gets messy as soon as you bring in multiple bookmakers, multiple markets, and more than one sport. A single sport can already produce enough variation in naming, pricing, and refresh behavior to make a naïve UI feel brittle. Once football, basketball, and tennis are all in the mix, the app needs a clearer structure than “fetch data and render a table.”

The goal of this repository is straightforward: build a multi-sport odds comparison interface that is practical for developers working on sportsbook, odds, or sports analytics products. I wanted a small but honest reference implementation, powered by Sportmicro, that shows the integration boundary without pretending live sports data is simple.

View the repository

What I built and why the shape matters

The app is a Next.js dashboard with React, TypeScript, and Tailwind CSS, but the interesting part is not the stack itself. It is how the code separates concerns around sport-aware data access and comparison logic.

In src/lib/sportmicro.ts, the project defines a small sport registry:

  • football
  • basketball
  • tennis

Each entry carries a label, a sport-specific base URL, and the odds endpoint path used by the client. That means the UI does not need to know how to build URLs for each sport. Instead, the app can ask for a sport-specific configuration and stay focused on presentation.

That matters because sports APIs often look similar on paper but differ in base URL, response shape, or update cadence. Centralizing those details makes the project easier to extend later without scattering sport rules through components.

The page itself reflects that separation. src/app/page.tsx renders a dashboard shell, a bookmaker comparison area, and a sidebar listing supported sports. The code also attempts to load football bookmakers from Sportmicro on the server side, then falls back to demo data when the live request is unavailable. That is a useful pattern for a reference app: it stays runnable even when the external source is unavailable.

The Sportmicro integration boundary

The Sportmicro layer in this repository is intentionally narrow, and I think that is the right call for a starter project.

The client module does three important things:

  1. It stores sport-specific base URLs in one place.
  2. It provides a typed fetchJson helper.
  3. It keeps SPORTMICRO_API_KEY server-side.

That last piece is especially important. The repository reads the API key from the environment and passes it in the Authorization header only when present. There is no client-side credential handling, which keeps the boundary clean and avoids hardcoding secrets into browser code.

The URL builder is equally deliberate. createSportUrl accepts a sport key, a path, and optional query parameters, then produces a fully qualified URL from the sport’s base URL. This is a small utility, but it reduces the chance of “stringly typed” URL construction leaking into the UI.

The fetch helper is also worth calling out because it makes the failure path explicit:

export async function fetchJson<T>(url: string, init?: RequestInit): Promise<T> { const response = await fetch(url, init); if (!response.ok) { throw new Error(`Sportmicro request failed with ${response.status} ${response.statusText}`); } return (await response.json()) as T; } 

I like this style because it keeps error handling reusable. Rather than burying response checks inside every feature, the project gives the API layer a single place to say, “If the request fails, fail clearly.”

How the odds comparison flow works

The comparison flow lives in src/lib/view-model.ts and src/components/odds-comparison-table.tsx.

The demo data is intentionally small: a few markets for a single match, with repeated bookmaker/market/selection combinations. That makes the data layer do some real work instead of just passing through raw values.

The interesting part is the combination of deduplication and sorting. The view model takes the raw markets, removes duplicates, and then sorts by price in ascending order. The comparison table receives the cleaned list and renders a stable row layout with bookmaker, market, selection, price, and event start time.

The deduplication key is a composite of:

  • bookmaker
  • market name
  • selection

That choice is pragmatic. If a provider re-emits the same logical selection during refreshes, the UI should not grow duplicate rows just because an internal provider identifier changed. The code is not trying to solve every possible live odds reconciliation problem. It is solving the practical first pass: show one row per logical odds selection.

The sort helper is equally grounded in UI behavior. It converts prices to numbers when possible and pushes malformed values to the end instead of crashing the view. That means the interface stays usable even if a bookmaker response is inconsistent.

In the component, empty state is handled explicitly:

  • when there are no markets, the table shows a dashed placeholder instead of a broken grid
  • when markets exist, they are rendered in a standard table with currency-like formatting and a fallback dash for missing prices

That distinction is important in sports apps. “No data” and “error” are different user states, and the UI should not confuse them.

Concise project tree

Here is the shape of the repository as it exists now:

src/ app/ layout.tsx page.tsx globals.css components/ odds-comparison-table.tsx lib/ sportmicro.ts view-model.ts tests/ sportmicro.test.ts 

The structure is compact on purpose. App router code lives in src/app, UI stays in src/components, and the data boundary plus comparison helpers live in src/lib. That separation makes the project easy to reason about, especially if you want to lift the odds comparison pattern into a larger product.

Local setup and what the repository supports

The repository documents a standard local workflow, and the package scripts confirm it.

To run the project locally, the evidence in the repo supports:

  • installing dependencies with npm install
  • creating a local environment file from .env.example
  • setting SPORTMICRO_API_KEY if you want live Sportmicro access
  • starting development with npm run dev
  • running tests with npm test
  • type-checking with npm run typecheck

The README also notes that the current app can still render a usable dashboard shell using local demo odds when live Sportmicro data is unavailable. That is a sensible default for development because it lets the UI remain visible without requiring a fully working external connection every time.

I also appreciate that the repository is explicit about scope. It does not claim to implement every Sportmicro endpoint, and it does not invent unsupported response fields. For a tutorial or starter project, that honesty is useful: it keeps you focused on the integration pattern rather than on completeness theater.

Challenges and trade-offs

This project does not document a dramatic incident or failure story, so I think the right way to frame this section is as design constraints that shaped the implementation.

The first constraint is multi-sport variability. Football, basketball, and tennis are not interchangeable models, so the app avoids pretending they are. Sport-specific base URLs and a centralized registry keep that variation contained.

The second constraint is live-data instability. Odds can refresh, bookmaker responses can vary, and the same selection can appear more than once. That is why the repository chooses a composite deduplication key and a defensive sort helper instead of trying to model the entire provider space upfront.

The third constraint is secure API access. The code keeps SPORTMICRO_API_KEY server-side only, which limits what the browser can do directly. That is a trade-off, but it is the correct one if you want to protect credentials and keep the client simple.

Finally, there is a product trade-off between realism and usability. The current app uses local demo data when live data is unavailable, which makes the project easier to explore while still showing the intended dashboard flow. That keeps the reference implementation useful even in a clean local environment.

Sensible next improvements

There are a few natural next steps I would consider if I were extending this project.

  • Add a real event-selection flow so users can switch between matches rather than looking at one demo comparison set.
  • Expand the market normalization layer if different bookmakers or sports return more varied naming conventions.
  • Wire the refresh button to actual data updates instead of leaving it as a visual affordance.
  • Broaden test coverage beyond the current data-layer focus, especially around formatting and fallback UI states.
  • Introduce richer state handling if more API outcomes need to be represented in the interface.

I would treat those as future improvements, not as missing pieces of the current implementation. The repository is intentionally scoped to show the architecture around a sports odds comparison workflow, not to become a full sportsbook frontend.

The takeaway

What I like most about this build is that it treats the data boundary as the core design problem. The UI is important, but the real work is deciding how to structure sport-aware URLs, how to compare odds safely, and how to keep the app understandable when the provider returns empty or imperfect data.

If you are building with a Sports Odds API, the lesson here is simple: normalize the integration first, then let the interface reflect the actual states your provider can return. That approach keeps the dashboard honest, easier to extend, and much less fragile when live data starts behaving like live data.