MeepleStats is a self-hosted web application designed to track board game statistics for your group of friends! It allows users to log game sessions, analyze player performance, and manage a wishlist of games. The application is built with a Flask backend and a React frontend.
- โจ Features
- โ๏ธ Installation
- ๐ ๏ธ Usage
- ๐ Rulebook Chat (RAG System)
- ๐งฎ Score Sheet System
- ๐ API Endpoints
- ๐ Environment Variables
- ๐ค Contributing
- ๐ To-Do
- ๐ License
- User Authentication (Register, Login, Logout)
- Log Game Sessions with players, scores, and duration
- Track Player Statistics (total wins, win rate, longest win streak)
- Manage a Wishlist of board games
- Import Games from BoardGameGeek (BGG) API
- View Global & Player-Specific Statistics
- Local or Remote image storage
- Achievement system
- Explore match history
- Chat to ask questions about game rules
- Configurable score sheets
Ensure you have the following installed:
- Python 3.8+
- Node.js 14+
- MongoDB
-
Clone the repository:
git clone https://github.com/TommyTheHuman/MeepleStats.git cd MeepleStats/backend -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile in the root directory and configure it (see Environment Variables) -
Run the backend server:
python run.py
-
Navigate to the frontend directory:
cd ../frontend/meeplestats -
Install the required dependencies:
npm install
-
Create a
.envfile in the root directory and configure it (see Environment Variables) -
Start the frontend development server:
npm start
Just create two different projects in Vercel and do the correct environment variables setup, the .JSON config files for Vercel are provided
The project now includes a GitHub Actions workflow that builds and publishes Docker images for both the backend and frontend to GitHub Container Registry (GHCR). This allows you to deploy the application without building the images locally.
- Docker and Docker Compose must be installed on your deployment system.
- Ensure your
.envfile is configured properly and placed in the project root.
-
Clone the repository to your server (or pull the latest changes):
git clone https://github.com/TommyTheHuman/MeepleStats.git cd MeepleStats -
Configure environment variables:
- Create a
.envfile in the project root with all required settings (see Environment Variables below).
- Create a
-
Deploy using Docker Compose:
The provided
docker-compose.ymluses the pre-built images from GHCR.To deploy, simply run:
docker-compose up -d
-
Access the Application:
- The backend will be available on port 5000.
- The frontend will be accessible on port 5173.
Instructions for Dockge: In your stacks folder, pull repo from GitHub:
git clone https://github.com/TommyTheHuman/MeepleStats.gitThen rename the pulled folder:
mv MeepleStats meeplestatsThen in dockge, pull and update to pull the latest configurations and update. Missing this step could result in unexpected failures.
- If changes are made to the code, the GitHub workflow will automatically build and push updated images to GHCR upon merges or pushes to
main.
Open your browser and navigate to the provided URL to access the frontend.
Use the provided API endpoints to interact with the backend.
Decide where to store the JWT Token: you can use either cookies or your browser's local storage. Make sure to set up the Environment Variables correctly.
Additionally, you can choose where to store images from your game nights. You can either save them locally or use Amazon Simple Storage Service (S3). In either case, ensure that the relevant variables are configured correctly.
The Rulebook Chat feature lets you upload board game rulebooks as PDFs and then ask questions about game rules without manually searching through pages. Simply upload a rulebook for your game, then ask questions like "How do I set up the game?" or "What happens when two players tie?" The system will find the relevant sections in the rulebook and provide specific answers with page references, making it easy to resolve rule questions during gameplay.
The Score Sheet Creator helps you track complex game scoring without pen and paper. Create custom score sheets for games by defining scoring categories with different types (numbers or text) and rules. During gameplay, anyone can access the Score Sheet page, select a game, add players, and track scores in real-time. The system automatically calculates totals and displays scoring rules when needed. This feature is perfect for games with multiple scoring categories, helping you focus on the fun rather than the math.
If you want to contribute, you can submit with a PR new configs to create a score sheets database.
POST /register- Register a new userPOST /login- Login a userGET /check-auth- Check user authentication status
GET /games- Retrieve all gamesPOST /logmatch- Log a new game sessionGET /matchHistory- Retrieve match history
GET /wishlist- Get the wishlistPOST /addwishlist- Add a game to the wishlistDELETE /removewishlist- Remove a game from the wishlist
GET /totHours- Get total hours playedGET /totMatches- Get total matches playedGET /playerWins- Get total wins for a playerGET /playerWinRate- Get win rate for a playerGET /playerLongWinstreak- Get longest win streak for a playerGET /playerHighestWinRate- Get player with the highest win rateGET /playerGameWins- Get game with most and least wins for a playerGET /gameCoopWinRate- Get win rate for cooperative gamesGET /gameNumMatch- Get number of matches for a gameGET /gameAvgDuration- Get average duration for a gameGET /gameBestValue- Get games with the best price/playtime ratioGET /gameHighestScore- Get highest score for a gameGET /gameAvgScore- Get average score for a game
GET /importGames- Import games from BoardGameGeek (BGG) API
Create a .env file in the root directory of the project /meeplestats and define the following:
BGG_USERNAME=your_boardgamegeek_username
JWT_SECRET_KEY=your_secret_key
JWT_ACCESS_TOKEN_EXPIRES=your_expiration_time
JWT_TOKEN_LOCATION=your_token_location
JWT_COOKIE_SECURE=True/False
JWT_ACCESS_COOKIE_NAME=your_cookie_name
JWT_COOKIE_CSRF_PROTECT=True/False
JWT_STORAGE='localstorage' or 'cookie'
UPLOAD_FOLDER=your_upload_folder_path
CORS_ORIGIN=allowed_origins
MONGO_URI=your_mongo_connection_uri
DB_NAME=your_database_name
STORAGE_TYPE='s3' or 'local'
S3_ENDPOINT=your_s3_server_url
S3_ACCESS_KEY=your_s3_access_key
S3_SECRET_KEY=your_s3_secret_key
S3_BUCKET_NAME=your_s3_bucket_name
PINECONE_API_KEY=your_pinecone_key
PINECONE_INDEX_NAME=gamerulebooks
EMBEDDING_MODEL=embedding_model_name # for example: BAAI/bge-small-en-v1.5
PINECONE_DIMENSION=384
OPENROUTER_API_KEY=your_openrouter_key
LLM_MODEL=llm_model_name # for example: qwen/qwq-32b:free
EMBEDDING_TYPE='gemini' or 'local'
GEMINI_API_KEY=your_gemini_key
ENABLE_RAG=True/FalseCreate a .env file in the /frontend/meeplestats directory of the project and define the following:
VITE_API_URL=your_backend_url
VITE_JWT_STORAGE='localstorage' or 'cookie'
VITE_ENABLE_RAG=True/False
VITE_ALLOWED_HOSTS=allowed_hosts_coma_separatedWant to improve MeepleStats? Contributions are welcome! Feel free to open an issue or submit a pull request.
- Improve UI/UX
- Support to Dark Mode
- Show images for open matches
- Implement team-based game tracking
- Add achievements system
- Introduce multilingual support
- Create user profile page
- Develop a game collection page
- Add support to upload images on Google Drive
- Create a page to randomly select a game and a timer to track the play time
- Implement a RAG pipeline to retirve information about game rules
MeepleStats is released under the MIT License. See the LICENSE file for details.
Happy Gaming!