A web-based chess application with bot opponent, built using Flask and Python.
This project offers a complete web application where a user can log in/register, play a game of chess against a bot, and view the board and moves in real time.
The backend is written in Python using the Flask micro-framework. The chess logic (move validation, bot behaviour, game state) is handled in Python modules such as chess_logic.py, analysis.py, ai.py.
The front-end uses HTML, CSS, JavaScript (in the templates and static folders) to provide the game interface. User authentication, database models (via models.py), and migrations are included.
Below are some visual snapshots of the application:

- User authentication (login/register)
- Chess board UI in browser, move input & display of game state
- Bot opponent with logic defined in
ai.py - Move analysis and game-state logic in
chess_logic.py - Persistent game states (via database models in
models.py) - Use of migrations (folder
migrations) to handle database schema - Modular structure: e.g.,
analysis.pyhandles game-analysis routines
- Flask – lightweight web-framework for Python. ([flask.palletsprojects.com][1])
- Python – core logic language
- SQLite / SQLAlchemy – for persistence (via
models.py) - HTML / CSS / JS – front-end UI
- Migrations (Flask-Migrate or Alembic implied)
- Possibly front-end board library (if used) – e.g.,
chessboard.js,chess.js(check repo code) - Modular Python design: separate modules for logic, AI, models, etc
- Version control: Git (via this GitHub repo)
/__pycache__/
/instance/
/migrations/
/static/
/templates/
ai.py
analysis.py
app.py
chess_logic.py
models.py
requirements.txt
.gitignore
Snaps/
app.py: Main Flask application entrypointchess_logic.py: Game rules, state updates, move validationai.py: Bot logic / strategyanalysis.py: Possibly contains analysis routines or helper functionsmodels.py: Database models (e.g., Users, Games, Moves)requirements.txt: Python dependenciesSnaps/: Folder containing screenshotsstatic/andtemplates/: Front-end assets (CSS, JS, HTML)migrations/: Database migration filesinstance/: Private instance configuration (possibly for Flask)
-
Clone the repository
git clone https://github.com/Raimal-Raja/End-to-End-Chess-bot-FlaskApp.git cd End-to-End-Chess-bot-FlaskApp -
Set up a Python virtual environment
python3 -m venv venv source venv/bin/activate # or venv\Scripts\activate on Windows
-
Install dependencies
pip install -r requirements.txt
-
Configure the database (check
instance/for config) -
Apply database migrations
flask db upgrade
-
Run the application
flask run
-
Open your browser at
http://localhost:5000(or configured address) and register/login to start a game.
- FIDE (International Chess Federation) – official chess competitions and ratings
- Chess.com Tournaments – online tournaments and community
- Lichess Events – free and open-source chess platform
- python-chess library documentation – Useful for board representation, move generation
- Flask Official Documentation – for building web apps in Python. ([flask.palletsprojects.com][1])
- SQLAlchemy ORM – for database modelling
- chessboard.js & chess.js – JavaScript libraries for chess UI and logic
Specify the license under which this project is released (e.g., MIT License). If none is present, consider adding one. Example:
MIT License
© 2025 Raimal Raja
Contributions, issues and feature requests are welcome! Feel free to fork the repo and submit pull requests. Please ensure your code adheres to the project style and includes appropriate tests / documentation.
- Add multiple difficulty levels for the bot
- Enable online multiplayer mode (user vs user)
- Improve UI/UX board animations
- Add move-history display and analysis for finished games
- Deploy the app to a cloud service (Heroku, AWS, etc)