Skip to content

OSP123/KTScores

Repository files navigation

Kill Team Tracker

A web application to manage and track Kill Team leagues, pods, and match scores. It provides features for user registration, authentication, score submissions, leaderboards, and player statistics.

Features

  • User Management: Registration, login, profile management, admin approval.
  • Leagues: Create and manage multiple leagues, mark current active league.
  • Pods: Create, update, and delete pods (groups of players) tied to specific leagues, with expiration handling.
  • Score Submission: Submit match results with detailed operation stats and kill team choices.
  • Leaderboards: Dynamic league leaderboards ranking players by wins, total operations, and losses.
  • Pod Standings: View per-pod standings sorted by wins and total operations.
  • Player Profiles: View individual player stats, contact info, and preferred stores.
  • Admin UI: Access to create leagues/pods, update scores, and manage content.

Tech Stack

  • Backend: Node.js, Express, MongoDB, Mongoose, JWT for auth
  • Frontend: React, Tailwind CSS, Axios for API calls

Directory Structure

server/                  # Express API server
  └── models/            # Mongoose schemas (User, Score, Pod, League)
  └── routes/            # API routes (auth, scores, pods, leagues, etc.)
  └── middleware/        # Authentication middleware
  └── db/                # Database connection setup
  └── index.js           # Server bootstrap

client/                  # React front-end
  └── src/
      └── components/    # Shared UI components
      └── pages/         # Route components (PodsPage, LeaderboardPage, SubmitScorePage, ApplyPage, PlayerStatsPage)
      └── hooks/         # Custom React hooks (useLeaguePods)
      └── apiClient.js   # Axios instance configuration
      └── constants/     # App constants (killTeams, etc.)
      └── App.js         # React Router setup

README.md                # This file

Installation

Prerequisites

  • Node.js (v16+)
  • npm or Yarn
  • MongoDB instance (local or cloud)

Backend Setup

  1. Navigate to the server folder:

    cd server
  2. Install dependencies:

    npm install
  3. Create a .env.development (or .env.production) file with:

    MONGO_URI=<your_mongo_connection_string>
    JWT_SECRET=<your_jwt_secret>
    ALLOWED_ORIGINS=http://localhost:3000
  4. Start development server:

    npm run dev

Frontend Setup

  1. Navigate to the client folder:

    cd client
  2. Install dependencies:

    npm install
  3. Create a .env file with (optional for custom API URL):

    REACT_APP_API_URL=http://localhost:5000
  4. Start React development server:

    npm start

API Endpoints

Authentication

  • POST /api/auth/apply - Submit application (username, email, full name, password)
  • POST /api/auth/login - Login and receive JWT

Leagues

  • GET /api/leagues - List all leagues
  • GET /api/leagues/current - Get the active league
  • POST /api/leagues - Create or switch current league (admin)

Pods

  • GET /api/pods?league=<slug>&showExpired=true|false - List pods in league
  • POST /api/pods/create-pod - Create a pod (admin)
  • PUT /api/pods/admin/pod/:id - Update pod (admin)
  • DELETE /api/pods/admin/pod/:id?league=<slug> - Delete pod (admin)

Scores

  • POST /api/scores/submit-score - Submit a match score
  • GET /api/scores/leaderboard - Fetch league leaderboard
  • GET /api/scores/pod-player-stats - Fetch pod standings

Users

  • GET /api/user/:username - Fetch player profile and stats

Frontend Pages

  • ApplyPage: User application form with validation
  • SubmitScorePage: Submit match scores to a selected pod
  • PodsPage: Manage leagues and pods, view pod standings
  • LeaderboardPage: League leaderboard display
  • PlayerStatsPage: Individual player profile & stats

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/xyz)
  3. Commit your changes (git commit -m "Add feature xyz")
  4. Push to the branch (git push origin feature/xyz)
  5. Open a Pull Request

License

MIT License


Enjoy tracking your Kill Team leagues and may the best commander win!

About

An app to track KT scores

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors