Skip to content

96tm/simple-messenger

Repository files navigation

License Python Flask Postgres Docker

Simple Messenger

A client-server messenger built with Flask.
It uses WebSocket API
(flask-socketio for the server, socket.io for the client, gevent as a transport)
and features a tiny REST API.
PostgreSQL is the default RDBMS.
Email sending is implemented using Celery with Redis as a message broker.
The web interface looks okay in Firefox 78.0.2, not so much in Chromium 84.0.4147.89.
Other browsers have not been tested.

Database schema

Database schema Made using pgmodeler

Screenshots

Registration page Registration page


After registration After registration, the user is automatically logged in but stays unconfirmed - they have to check the inbox and follow the provided link


Confirmation is completed Confirmation is completed


Logged out Logged out


Wrong user data Wrong user data


Main page Main page


Main page, several users selected Main page, several users selected


Main page, 3 unread messages Main page, 3 unread messages


Main page, chat selected Main page, chat selected


Main page, users and chats are filtered Main page, users and chats are filtered


Main page, users and chats filtered, no chats found Main page, users and chats filtered, no chats found


Generic error page Generic error page

Installation

The easiest way to run the app is to create a Docker image and then run it in a container.
If you have a Debian based system (Ubuntu, Mint...), the following steps should work
(tested on Ubuntu 20.04 LTS with docker.io 19.03.8 installed):

  • clone the repository, navigate to the project directory and make install.sh executable
$ git clone https://github.com/96tm/simple-messenger.git; cd simple-messenger; chmod +x install.sh
  • run the installation script
    (replace MAIL_SERVER with an email server of your choice,
    EMAIL_ADDRESS with an account address on that server,
    EMAIL_PASSWORD with the account's password;
    MAIL_PORT is optional and equals 587 by default):
$ sudo ./install.sh "MAIL_SERVER" "EMAIL_ADDRESS" "EMAIL_PASSWORD" "MAIL_PORT"

Now you can open the app at localhost:8888/auth/signup and register.
Or you can log in right away with one of the test email/password pairs:

To uninstall the application, run the following:

$ chmod +x uninstall.sh; sudo ./uninstall.sh

To remove the images:

$ sudo docker image rm python:3.7-alpine
$ sudo docker image rm redis
$ sudo docker image rm postgres
REST API

The following actions are available:

  • get a list of the authenticated user's chats /api/v1.0/chats;
  • get a chat by id /api/v1.0/chats/1;
  • get a list of messages in the chat /api/v1.0/chats/1/messages;
  • get a message by the id from the chat /api/v1.0/chats/1/messages/1;
  • send a message /api/v1.0/chats/1/messages/.

Sending a message requires a JSON object in the form {"text" :"your_message_text"} in the request.

About

A messenger built with Flask

Resources

License

Stars

Watchers

Forks

Packages

No packages published