A robust Rails API for a real-time chat application with Elasticsearch integration for message search functionality. This application supports multiple chat applications, each with their own chats and messages.
- RESTful API design for managing chat applications, chats, and messages
- Real-time messaging capabilities with ActionCable
- Full-text search for messages using Elasticsearch
- Background job processing with Sidekiq and Redis
- MySQL database for persistent storage
- Containerized with Docker and Docker Compose for easy deployment
- Automated testing with RSpec and FactoryBot
- Ruby 3.x
- Rails 8.0.2
- MySQL 8.x
- Redis
- Elasticsearch 7.x
- Docker and Docker Compose (for containerized setup)
-
Clone the repository:
git clone https://github.com/AmrRiyad/chat-app.git cd chat-app -
Create and configure your
.envfile (use the provided.env.exampleas a template) -
Install dependencies:
bundle install -
Build and start the Docker containers:
docker compose up --build
GET /applications- List all applicationsPOST /applications- Create a new applicationGET /applications/:token- Show an applicationPUT /applications/:token- Update an applicationDELETE /applications/:token- Delete an application
GET /applications/:token/chats- List all chats for an applicationPOST /applications/:token/chats- Create a new chatGET /applications/:token/chats/:number- Show a chatPUT /applications/:token/chats/:number- Update a chatDELETE /applications/:token/chats/:number- Delete a chat
GET /applications/:token/chats/:chat_number/messages- List all messages in a chatPOST /applications/:token/chats/:chat_number/messages- Create a new messageGET /applications/:token/chats/:chat_number/messages/:number- Show a messageGET /applications/:token/chats/:chat_number/messages/search- Search messages in a chat
Run the test suite with:
docker compose exec rails bundle exec rspec spec
This application uses Sidekiq for background job processing. Jobs include:
- Indexing messages in Elasticsearch
- Processing message deliveries