A way to pull and visualize analytics for Brawl Stars
- Node.js and npm installed
- PostgreSQL installed and running
- Brawl Stars API token (obtain from Brawl Stars Developer Portal)
To start, clone the repository
git clone https://github.com/gusev03/brawlpick.git
The data collection folder includes scripts for retrieving data from the Brawl Stars API and interacting with a PostgreSQL database for reading and writing.
-
Create a PostgreSQL database and record the username, password, and database name
-
Make a .env file with environment variables:
# Database Configuration
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_DB=your_database
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
# Brawl Stars API
BRAWL_STARS_TOKEN=your_token
# Data Filters
MINIMUM_TROPHIES=700 # Optional: Trophy threshold for battles
MINIMUM_POWER_LEAGUE_RANK=10 # Optional: Power League rank (e.g. 10 = Diamond 1)
CUTOFF_DATE=2025-01-16 # Date format: YYYY-MM-DD
- To set up the environment with all the packages and export the environment variables, run the following commands:
cd data-collection
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
export $(cat .env | xargs)
- To run data collection:
python3 main.py
- To pull analytics from the database, run the following command:
python3 -m scripts.pull_analytics
- Return back to the root directory
cd ..
- After running the the data collection script, move the
data-collection/data/folder tofrontend/public
mv data-collection/data/ frontend/public
- Install the required packages:
cd frontend
npm install
- Start the development server:
npm run dev
Go to http://localhost:3000 to view the analytics