A Flask + Socket.IO real-time group chat server with registration, login and an admin page, backed by PostgreSQL.
Previous README was inaccurate. It described React, Node.js, Express, MongoDB, private and group chats, message history and online-status indicators. None of that exists in this repository. What follows is what the code actually contains.
This is one of three near-identical copies of the same project on this account, alongside
chatbot (the minimal version) and
chatbotapp.github.io (adds Alembic
migrations). app.py here is byte-identical to chatbotapp.github.io's and differs from chatbot's
only in binding to 0.0.0.0. Consider keeping one and archiving the others.
There is also no bot: despite the UI title "Chatbot", every message is simply broadcast to all connected clients. No NLP, no AI, no automated replies.
app.py (~145 lines) is the whole application:
/— landing page/register— create an account; bcrypt password hashing; all new users get the roleUser/login,/logout— Flask-Login sessions/chat— the chat room (login required)/admin— all users and all chat history, gated by arole_required('Admin')decorator
Socket.IO: the browser emits send_message, the server writes it to the chathistory table and
re-emits receive_message to every connected client. One global room, no private messaging, no
history replay on load.
Python 3, Flask, Flask-SocketIO, Flask-SQLAlchemy, Flask-Login, Flask-Bcrypt, Flask-Migrate,
psycopg2 (PostgreSQL), Bootstrap 5 and the Socket.IO 4.0 client from a CDN.
git clone https://github.com/Haroldke13/chatapp.git
cd chatapp
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txtrequirements.txt is unpinned and does not list eventlet or gevent, which Flask-SocketIO
generally needs; you may have to pip install eventlet too.
app.py hardcodes:
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:password@localhost/chatbot_db'Create a chatbot_db database and either match those credentials or edit the line. Tables are
created at startup by db.create_all().
python app.py # socketio.run(app, host='0.0.0.0', debug=True) → http://127.0.0.1:5000The Procfile (web: python app.py) targets a PaaS such as Heroku or Render.
venv/is committed — 2,605 tracked files and ~54 MB of installed site-packages. This should be removed from the repo and added to a.gitignore, which does not currently exist.build/holds six HTML files that look like an attempt to publish the app as a static site. They are not usable:build/index.htmlstill contains unrendered Jinja ({{ url_for('home') }}), and a Socket.IO chat server cannot run on static hosting anyway.base.htmlandindex.htmlat the repository root are stray duplicates of the files intemplates/.- As in the sibling repos,
app.pyredefinesUserandChatHistorylocally after importing them fromuser.pyanddb.py, making those two modules dead code.
Working prototype. Last commit January 2025. The chat, auth and admin flows work against a local
PostgreSQL instance. No tests. The repository needs a .gitignore and the committed venv/ removed.
Proprietary software — all rights reserved. Copyright © 2026 Joel Harold Onyango.
This repository is not open source. The full terms are in LICENSE; in summary, you may not copy, redistribute, modify, sublicense, publish, re-host or commercially exploit this software, in whole or in part, without the prior written permission of the copyright holder. Access to this repository does not grant any licence beyond reading it.