https://github.com/edwinhern/nfl-game-dashboard
https://github.com/edwinhern/nfl-game-dashboard
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/edwinhern/nfl-game-dashboard
- Owner: edwinhern
- Created: 2024-10-10T22:53:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-25T07:46:10.000Z (over 1 year ago)
- Last Synced: 2025-02-25T08:23:01.524Z (over 1 year ago)
- Language: TypeScript
- Size: 182 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ Parkhub NFL Game Dashboard - Coding Challenge
[](https://github.com/edwinhern/nfl-game-dashboard/actions/workflows/backend-ci.yml)[](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)