Skip to content

Third-Party Code Documentation

Documentation of external services, frameworks, and libraries integrated into the Sports Live Tracker project


We use Clerk for authentication and user management. Clerk provides secure, ready-made solutions for signup, login, session handling, and identity management.

Benefits:

  • Seamless integration with frontend React components.
  • Multi-factor authentication and social login support.
  • Saves development time by outsourcing auth complexity. .
Terminal window
npm install @clerk/clerk-sdk-node @clerk/nextjs
Terminal window
import { getAuth } from "@clerk/nextjs/server";
export default function handler(req, res) {
const { userId } = getAuth(req);
if (!userId) {
return res.status(401).json({ error: "Unauthorized" });
}
res.json({ message: `Hello user ${userId}` });
}

We use MongoDB a cloud-hosted NoSQL database, to store match, event, and user data.

Benefits:

  • JSON-like structure aligns with our data model.
  • Automatic scaling for live feeds.
  • Strong support for Node.js drivers.
Terminal window
npm install mongodb
Terminal window
import { MongoClient } from "mongodb";
const client = new MongoClient(process.env.MONGO_URI);
async function connectDB() {
await client.connect();
return client.db("sport-live-feeds");
};

We use Node.js with Express for the backend server. Express provides a lightweight framework to handle RESTful APIs and middleware.

Benefits:

  • Middleware for authentication, logging, and validation.
  • Easy integration with MongoDB for match and event data..
  • Non-blocking I/O for real-time data.
Terminal window
npm install express
Terminal window
import express from "express";
const app = express();
app.get("/api/matches", (req, res) => {
res.json({ message: "List of matches" });
});
app.listen(5000, () => console.log("Server running on port 5000"));

We use Render to host our Node.js backend services. Render provides simple continuous deployment and scaling, ideal for production-ready applications.

Benefits:

  • GitHub integration for auto-deployment.
  • Free tier for testing, scalable for production.
  • Built-in SSL and custom domains.
  • Connect GitHub repository to Render.

  • Configure environment variables (e.g., MONGO_URI, CLERK_API_KEY).

  • Render builds and deploys automatically on git push.

Terminal window
services:
- type: web
name: sports-live-backend
env: node
plan: free
buildCommand: "npm install && npm run build"
startCommand: "npm start"
envVars:
- key: MONGO_URI
sync: false
- key: CLERK_API_KEY
sync: false

We use React for building the frontend user interface. It provides a component-based architecture, fast rendering with a virtual DOM, and strong community support.

Benefits:

  • Reusable UI components.
  • Rich ecosystem with hooks, context, and state management.
  • Easy integration with Clerk authentication components.
Terminal window
npm create-react-app sports-live-frontend
Terminal window
import React from "react";
function MatchCard({ teamA, teamB, score }) {
return (
<div>
<h3>{teamA} vs {teamB}</h3>
<p>Score: {score}</p>
</div>
);
}
export default MatchCard;

8. Testing – Jest & React Testing Library

Section titled “8. Testing – Jest & React Testing Library”

We use Jest and React Testing Library for testing frontend and backend logic.

Benefits

  • Unit + integration tests.
  • Encourages testing user behavior (not implementation).
  • CI/CD friendly.
Terminal window
npm install --save-dev jest @testing-library/react
Terminal window
import { render, screen } from "@testing-library/react";
import MatchCard from "./MatchCard";
test("renders match info", () => {
render(<MatchCard teamA="Team A" teamB="Team B" score="2-1" />);
expect(screen.getByText(/Team A vs Team B/i)).toBeInTheDocument();
});