Code Monkey home page Code Monkey logo

kickbase-insights's Introduction

Logo

Kickbase Insights

This project is a used to gather data from Kickbase API endpoint and visualize it in a web interface, acting as alternative for the pro/member membership.

GitHub License GitHub release (with filter)

Note: This is a hobby project to test stuff with JSON and the cores of Python. Feel free to create issues and contribute.

Table of Contents

Screenshots

You can find some screenshots of the frontend below, not all features are shown.

ℹ️ As of v1.4.0

Transfers
MarketValue
Revenue
LivePoints

Docker

If you want to run this in a Docker container, you'll first need to set some mandatory environment variables:

Variable Required Description
KB_MAIL Yes Your Kickbase E-Mail.
KB_PASSWORD Yes Your Kickbase password.
DISCORD_WEBHOOK Yes The Discord webhook URL to send notifications to.
RUN_SCHEDULE No The cron expression when the script should fetch new information from the API. If not set, defaults to 10 2,6,10,14,18,22 * * *.
WATCHPACK_POLLING Yes Used to apply new changes in the filesystem on runtime. If not set, defaults to true.

docker run

docker run -d \
    --name=kickbase_insights \
    --restart=unless-stopped \
    -p <frontend_port>:3000 -p <backend_port>:5000 \
    -e KB_MAIL=<kickbase_email> \
    -e KB_PASSWORD=<kickbase_password> \
    -e DISCORD_WEBHOOK=<discord_webhook> \
    -e WATCHPACK_POLLING=true \
    ghcr.io/casudo/kickbase-insights:<tag>

Docker Compose

version: "3.8"

services:
  kickbase-insights:
    image: ghcr.io/casudo/kickbase-insights:<tag>
    container_name: kickbase_insights
    restart: unless-stopped
    ports:
      - <frontend_port>:3000 # Web GUI
      - <backend_port>:5000 # Backend API (../api/livepoints)  
    environment:
        - KB_MAIL=<kickbase_email>
        - KB_PASSWORD=<kickbase_password>
        - DISCORD_WEBHOOK=<discord_webhook>
        - WATCHPACK_POLLING=true

If you run this container in your LAN (via IP), you'll need to change the following line in the App.js file in the frontend/src folder to this (obv. change <backend_port>):

const response = await fetch('http://localhost:<backend_port>/api/livepoints')

If you make this container publically available via a domain, you'll need to create/update the following entry in your reverse proxy:
your.domain.com -> <container_ip_or_hostname>:3000
your.domain.com/api/livepoints -> <container_ip_or_hostname>:5000

Note: In order to this to work, both your reverse proxy and the container need to be in the same network.

Additional note: It may take some time to first run the container, so check the logs!


Development

If you want to contribute to this project, you can follow the steps below to start the development environment.

docker run -dit --name=Kickbase -p <frontend_port>:3000 -p <backend_port>:5000 -e KB_MAIL=<kickbase_mail> -e KB_PASSWORD=<kickbase_password> -e DISCORD_WEBHOOK=<discord_webhook> -e WATCHPACK_POLLING=true ubuntu

Run this long command to setup the container:

mkdir /code && cd /code && apt update && apt upgrade -y && apt install tree nano python3 pip nodejs npm git -y && git clone https://github.com/casudo/Kickbase-Insights.git . && pip install -r requirements.txt && mkdir -p frontend/src/data/timestamps && mkdir logs && cd frontend && npm install

Now you're ready to go. Keep in mind that you'll first need to run main.py to get the required data for the frontend.

You'll also need to manually run npm start in the frontend folder as well as python3 -u -m flask run --host=0.0.0.0 --port=5000 in the /code folder.


Planned for the future

Frontend:

  • Market table: Maybe add ligainsider rating?
  • Add base features
    • Feed
    • Lineup
    • Next matches
    • League table
    • Top players
  • Transfererlöse: Hold player for X days
  • Sum. Transfererlöse: Add custom scale for chart
  • Dev: Execution time
  • Misc: Unsold starter players
  • Fix TZ on frontend (market table)
  • Reformat changelog
  • Other menu layout (+ mobile responsive)
  • Back to top button
  • ToC on pages with lot of content
  • Market value graph for players

Backend:

  • Fix all TODOs
  • Measure time of API calls and display them under Misc?
  • Add best practice to seperate duplicate variables names from modules (e.g. user and user. Which one is the module and which one is the variable?)
  • Fix TZ in Ubuntu image (Stackoverflow)
  • Discord notifications
  • Logging module for entrypoint.py and app.py
  • Add linter/formatter
  • Categorize components to frontend menu
  • Better performance for some API calls (e.g. taken/free players)
  • Battles: Spieltagsdominator: Fix placements being wrong for people with the same amount of mdWins

Misc:

  • Add Postman workspace
  • Add Workflow chart
  • Add ./data, ./data/timestamp and logs/ folders to git
  • Automatically disable caching

Thanks to


License

This project is licensed under the MIT License - see the LICENSE file for details

kickbase-insights's People

Contributors

casudo avatar

Watchers

 avatar

kickbase-insights's Issues

Add battles

Add the overview for the battles and maybe add some own ones

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.