ezzdin-atef / chat-easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chat Easy

It's an experimental chat application api using ruby on rails. Used many other tools and technologies to make it more efficient and easy to use like: redis, sidekiq, docker, docker-compose, elasticsearch, etc.

Features

  • Users can create new application (new client account)
  • User can update application client name
  • User can list all applications
  • Users can create new chat room
  • Users can send messages to chat room
  • Users can see messages in chat room
  • Users can search messages in chat room

Installation

Prerequisites

  • Ruby 3.3.0
  • Rails 7.0.0
  • Redis
  • Sidekiq
  • MySQL
  • Docker
  • Docker Compose

Setup

  1. Clone the repository
git clone REPO_URL
  1. Install dependencies
bundle install
  1. Create database

Note: Make sure you have MySQL installed and running on your machine. and update the database.yml file with your database credentials.

rails db:create
rails db:migrate
  1. Start the server

Note: Make sure you have elasticsearch installed and running on your machine so that you can search messages.

rails s
  1. Start sidekiq

Note: Make sure you have Redis installed and running on your machine.

bundle exec sidekiq

Docker

You can also run the application using docker and docker-compose.

docker compose up --build

API Documentation

Create Application

[POST] /applications

{
  "name": "Application Name"
}

Update Application

[PUT] /applications/:token

{
  "name": "Application Name"
}

List Applications

[GET] /applications

Create Chat Room

[POST] /chats

{
  "token": "bdce0a6ebd1506248f77d77aa20c4581"
}

List Chat Rooms

[GET] /chats

Send Message

[POST] /chats/:chat_id/messages

{
  "token": "bdce0a6ebd1506248f77d77aa20c4581",
  "message": "Hello World",
  "chat_number": 1
}

List Messages

[GET] /applications/:token/:chat_number/messages

Search Messages

[GET] /applications/:token/:chat_number/messages/search?q=:query

License

This project is open-sourced software licensed under the MIT license.

About


Languages

Language:Ruby 96.5%Language:Dockerfile 1.7%Language:Shell 1.0%Language:HTML 0.8%