An open API service indexing awesome lists of open source software.

https://github.com/edwinhern/nfl-game-dashboard


https://github.com/edwinhern/nfl-game-dashboard

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# ๐Ÿˆ Parkhub NFL Game Dashboard - Coding Challenge

[![Build CI](https://github.com/edwinhern/nfl-game-dashboard/actions/workflows/backend-ci.yml/badge.svg?branch=main)](https://github.com/edwinhern/nfl-game-dashboard/actions/workflows/backend-ci.yml)[![Backend Code Quality](https://github.com/edwinhern/nfl-game-dashboard/actions/workflows/backend-code-quality.yml/badge.svg?branch=main)](https://github.com/edwinhern/nfl-game-dashboard/actions/workflows/backend-code-quality.yml)

A robust backend system providing NFL game information synchronized with Ticketmaster's Discovery API.

## ๐Ÿ“‹ Overview

The NFL Game Dashboard is a robust backend system that provides comprehensive game information synchronized with Ticketmaster's Discovery API. It offers a RESTful API for querying NFL game data and manages automated synchronization with external ticketing services.

## ๐ŸŽฅ Project Demo

To see an example of the project in action, you can view the demo video:
[View Project Demo](https://photos.onedrive.com/share/814EB5940A8CC8AF!149046?cid=814EB5940A8CC8AF&resId=814EB5940A8CC8AF!149046&authkey=!AGSJl13Mt-p0s1Q&ithint=video&e=9kS8H1)

## ๐ŸŒŸ Key Features

- ๐Ÿš€ RESTful API for efficient querying of NFL game data
- ๐Ÿ”„ Automated synchronization with Ticketmaster API (every 12 hours)
- ๐Ÿ” Flexible filtering options for game queries
- ๐Ÿ˜ Scalable database architecture using PostgreSQL and Kysely ORM
- โฐ Scheduled tasks for data updates using node-cron
- ๐Ÿšฆ Comprehensive error handling and logging
- ๐Ÿณ Dockerized development environment for consistent setup and testing

## ๐Ÿ› ๏ธ Technology Stack

- ๐ŸŸข **Node.js** (v22.9.0): JavaScript runtime
- ๐Ÿ”ท **TypeScript**: Typed superset of JavaScript
- ๐Ÿš‚ **Express**: Web application framework
- ๐Ÿ˜ **PostgreSQL**: Relational database
- ๐Ÿ”‘ **Kysely**: Type-safe SQL query builder
- ๐Ÿฆ‹ **Flyway**: Database migration tool
- โฒ๏ธ **node-cron**: Task scheduler for periodic data synchronization
- ๐Ÿ“ **Winston**: Logging library
- ๐Ÿงช **Vitest**: Testing framework
- ๐Ÿณ **Docker**: Containerization for consistent environments

## ๐Ÿš€ Getting Started

### Prerequisites

- ๐Ÿณ Docker and Docker Compose

## ๐Ÿ› ๏ธ Setup Instructions

1. ๐Ÿ“ฅ Clone the repository:

```
git clone https://github.com/edwinhern/nfl-game-dashboard.git
cd nfl-game-dashboard
```

2. ๐Ÿ”‘ Set up environment variables:

- Copy `.env.template` to `.env`
- Update `.env` with necessary values, including your Ticketmaster API key

3. ๐Ÿš€ Start the application using Docker Compose:

- This command initializes the PostgreSQL database, executes Flyway migrations, and launches the backend server.

```
docker-compose up --build
```

### ๐Ÿ–ฅ๏ธ Running Without Docker

If you prefer to run the project without Docker:

1. ๐Ÿ˜ Ensure you have a PostgreSQL instance running and accessible
2. ๐Ÿ”— Update the `DATABASE_URL` in `.env` to point to your PostgreSQL instance
3. ๐Ÿ“‚ Navigate to the backend directory: `cd backend`
4. ๐Ÿ“ฆ Install dependencies: `pnpm install`
5. ๐Ÿƒโ€โ™‚๏ธ Run the development server: `pnpm run dev`

## ๐ŸŽฎ API Usage

The system offers several endpoints for querying game data. Key examples include:

- ๐Ÿ‰ `GET /api/games`: Retrieve a list of games with optional filters
- ๐Ÿ‘ฅ `GET /api/games/teams`: Get all teams
- ๐ŸŸ๏ธ `GET /api/games/stadiums`: Get all stadiums
- ๐Ÿ”„ `GET /api/sync/testSync`: Manually trigger a sync with Ticketmaster API

For a comprehensive list of endpoints and their usage, please consult the [API documentation](docs/API.md).

## ๐Ÿ‘ฉโ€๐Ÿ’ป Development

For more information on the backend development, see the [Backend documentation](docs/BACKEND.md).

For more information on api endpoint response format, see the [API documentation](docs/API.md).

## ๐Ÿ—„๏ธ Database

The project uses PostgreSQL with Flyway for database migrations. Key details:

- ๐Ÿ“Š Database name: `nfldb`
- ๐Ÿ‘ค Default username: `postgres`
- ๐Ÿ”‘ Default password: `postgres`

For more information on the database schema and management, see the [Database documentation](docs/DATABASE.md).

## ๐Ÿ”„ Data Synchronization

The system automatically synchronizes with Ticketmaster every 12 hours. This process ensures that:

- ๐Ÿ†• New games are added to the database
- ๐Ÿ”„ Existing game information is updated
- ๐Ÿšฆ Game statuses are kept current

For manual synchronization, use the `/api/sync/testSync` endpoint.

## ๐Ÿš€ Potential Improvements

1. ๐Ÿš€ Implement caching for frequently accessed data
2. ๐Ÿ›‘ Add rate limiting to protect the API
3. ๐Ÿงช Expand test coverage for edge cases
4. ๐Ÿ” Implement auth permissions system
5. ๐Ÿ” Add parameter validation for `api/games/` requests
6. ๐Ÿ“„ Implement pagination for `api/games/` endpoint

## ๐Ÿ“š Additional Documentation

For more detailed information about the system components, please refer to:

- ๐Ÿ“˜ [API Documentation](docs/API.md)
- ๐Ÿ“˜ [API Curls Documentation](docs/API_CURLS.md)
- ๐Ÿ—„๏ธ [Database Schema](docs/DATABASE.md)
- ๐Ÿ—๏ธ [Backend Architecture](docs/BACKEND.md)