This is a simple chat application built with Ruby on Rails, using Redis for real-time messaging with ActionCable. It supports one-on-one and group chats with user authentication handled by Devise.
- User authentication with Devise
- Real-time messaging using ActionCable and Redis
- One-on-one and group chats
- Stimulus for front-end interactivity
These instructions will help you set up and run the project on your local machine for development and testing purposes.
- Ruby 3.2.0
- Rails 7.0.4.2
- PostgreSQL
- Redis
- Node.js and Yarn
- Clone the repository:
git clone git@github.com:Jay991/ruby_chat_app.git
cd ruby_chat_app- Install the required gems:
bundle install- Install JavaScript dependencies:
yarn install- Set up the database:
rails db:create
rails db:migrate
rails db:seed- Start the Redis server:
redis-serverEnsure you have a .env file set up with necessary environment variables:
touch .envAdd the following lines to the .env file:
DATABASE_PASSWORD=your_database_password
REDIS_URL=redis://localhost:6379/1
- Start the Rails server:
rails server- Visit
http://localhost:3000in your browser.
- Sign up for a new account or log in with an existing account.
- Create a new chat or join an existing one.
- Start sending messages in real-time.
app/models: Contains the application's models.app/controllers: Contains the application's controllers.app/views: Contains the application's views.app/javascript: Contains the front-end JavaScript code.config: Contains the configuration files for the application.
app/channels/messages_channel.rb: Handles real-time messaging.app/controllers/messages_controller.rb: Manages message creation.app/models/message.rb: Represents a chat message.app/javascript/channels/messages_channel.js: JavaScript client for ActionCable.
To deploy this application to a production environment, follow these steps:
- Precompile the assets:
rails assets:precompile- Run the database migrations:
rails db:migrate RAILS_ENV=production- Start the Rails server:
rails server -e production