8000 GitHub - JustRudolph/opgg · GitHub
[go: up one dir, main page]

Skip to content
JustRudolphPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

OP.GG Clone - League of Legends Edition

A full-stack web app that recreates OP.GG's summoner stats interface for League of Legends, powered by Riot's official APIs.

Features

  • Live Summoner Search: Find any player across all regions with real-time name and tag validation
  • Region Selection: Choose from 16 regions worldwide (NA, EUW, EUNE, Korea, Brazil, etc.)
  • Ranked Stats: View Solo Queue and Flex Rank with LP, win/loss records, and tier
  • Champion Mastery: Top 5 most-played champions with mastery level and progression
  • Match History: Last 10 matches with KDA, CS/min, kill participation, game duration
  • Responsive Design: Mobile-friendly layout with gradient atmosphere and modern UI

Setup

Prerequisites

Installation

  1. Clone/open this repository in VS Code

  2. Install dependencies:

    npm install
  3. Create a .env file in the root directory:

    RIOT_API_KEY=your_riot_api_key_here
    PORT=3001
    

    Replace your_riot_api_key_here with your actual Riot API key.

Running Locally

Start both the React frontend and Express backend together:

npm run dev

This runs:

The app will automatically proxy all API calls through the backend for security (your API key is never exposed to the browser).

Building for Production

npm run build

This generates optimized bundles in the dist/ folder.

How It Works

Architecture

┌─────────────────────────────────────────┐
│       Browser (React Frontend)          │
│  - Search form, summoner cards, UI      │
└──────────┬──────────────────────────────┘
           │ http://localhost:3001/api
           ▼
┌─────────────────────────────────────────┐
│    Express Backend (Riot Proxy)         │
│  - Validates requests                   │
│  - Manages API key securely             │
│  - Fetches data from Riot               │
└──────────┬──────────────────────────────┘
           │ https://api.riotgames.com
           ▼
┌─────────────────────────────────────────┐
│         Riot Official APIs              │
│  - Account v1, Summoner v4              │
│  - League v4 (ranked entries)           │
│  - Champion Mastery v4                  │
│  - Match v5 (last 10 games)             │
└─────────────────────────────────────────┘

API Endpoints

/api/regions

Returns a list of all supported regions:

[
  { "value": "na1", "label": "North America" },
  { "value": "euw1", "label": "EU West" },
  ...
]

/api/riot/summoner

Fetches complete summoner profile with ranked, mastery, and match data:

GET /api/riot/summoner?region=na1&gameName=Faker&tagLine=NAC

Returns profile object with ranked stats, champion mastery, and match history.

Tech Stack

  • Frontend: React 19 + TypeScript + Vite
  • Backend: Express.js + Node.js
  • Styling: Custom CSS with design system (gradients, animations)
  • API: Riot Games Official APIs (Account, Summoner, League, Champion Mastery, Match)

Project Structure

opggcopy/
├── src/
│   ├── App.tsx          # Main React component with search and UI
│   ├── index.css        # Custom design system and responsive styles
│   └── main.tsx         # React entry point
├── server/
│   └── index.js         # Express API proxy and Riot integration
├── package.json         # Dependencies and scripts
├── .env                 # Environment variables (add your API key here)
└── README.md            # This file

Getting Started

  1. Get your API key at https://developer.riotgames.com/
  2. Add it to .env as RIOT_API_KEY=your_key_here
  3. Run npm run dev
  4. Search for any summoner by name and tag across any region

Troubleshooting

"RIOT_API_KEY is missing": Ensure your .env file exists in the project root with your API key.

"Player not found": Verify the summoner name and tag are correct and the region is valid.

"Port 3001 already in use": Change the PORT in .env to another value (e.g., 3002).

For full Riot API documentation, visit Riot Developer Portal.

React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.

Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])

You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:

// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs['recommended-typescript'],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
])

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0