Skip to content

nirlevi/app-demo

Repository files navigation

VoipAppz Dashboard - Ruby on Rails Monolith

A modern VoIP call center dashboard application built as a Rails monolith with server-rendered views, real-time WebSocket connections, and responsive design. Features live agent monitoring, call analytics, and comprehensive reporting.

⚑ Quick Start Summary

Prerequisites: Ruby 3.3.0+, Git
Setup Time: ~5 minutes

# 1. Clone and setup
git clone <this-repo> && cd shopify-app-template-ruby/web
bundle install

# 2. Create database with demo data  
bin/rails db:create db:migrate db:seed

# 3. Start server
bundle exec rails server

# 4. Login at http://localhost:3000
# Admin: [email protected] / password123
# Agent: [email protected] / password123

What You Get: βœ… Complete VoIP dashboard with real-time updates
βœ… User authentication (Devise + JWT)
βœ… Sample data (50+ call records)
βœ… Responsive design with modern CSS
βœ… Comprehensive test suite
βœ… Production-ready Rails 7 app

πŸš€ Quick Start From Scratch

Prerequisites

# Required software
- Ruby 3.3.0+ (with bundler)
- Git
- Redis server (optional, for ActionCable in production)

Step 1: Clone Repository

git clone <this-repo>
cd shopify-app-template-ruby/web

Step 2: Install Dependencies

# Install Ruby gems
bundle install

# If bundler is not installed
gem install bundler
bundle install

Step 3: Setup Database from Scratch

# Create database, run migrations, and seed with sample data
bin/rails db:create db:migrate db:seed

# Or run individually:
# bin/rails db:create    # Create the database
# bin/rails db:migrate   # Run all migrations
# bin/rails db:seed      # Seed with sample data

Step 4: Verify Demo Users (Already Created by Seeds!)

The bin/rails db:seed command automatically creates demo users. You should see output like:

🌱 Seeding database...
βœ… Created organization: Demo Company
βœ… Created admin user: [email protected]
βœ… Created agent user: [email protected]
πŸ“ž Creating sample call data...
βœ… Created 50 sample call records
πŸŽ‰ Seeding completed!

πŸ”‘ Demo Login Credentials:
  Admin: [email protected] / password123
  Agent: [email protected] / password123

Manual Creation (if needed):

# Only if seeds didn't work, create manually via Rails console
bin/rails console

# Create demo users manually (see seeds.rb for exact code)
# Then exit

Step 5: Start Development Server

# Start Rails server
bundle exec rails server

# Server will be available at:
# http://localhost:3000

Step 6: Login to Application

πŸ§ͺ Test User Credentials

For testing purposes, use these test user accounts:

Production/Demo Users (created by db:seed):

Test Users (available in test fixtures for integration tests):

Note: Test fixture users are only available during test runs. Use the demo users ([email protected], [email protected]) for manual testing and development.

Demo Data Available

After seeding, you'll have:

  • 2 demo users (admin and agent)
  • Sample organization
  • 50+ demo call records
  • Live dashboard with real-time features

Alternative: Automatic Demo User Setup

If you want demo users created automatically during db:seed, check the seed file:

# View current seed configuration
cat db/seeds.rb

# Seeds will automatically create:
# - Demo organization
# - Admin and agent users
# - Sample call data

πŸ“Š Features

πŸ”΄ Live Dashboard

  • Real-time Agent Monitoring: Live agent status and call activity
  • Active Call Display: Current calls with duration and status
  • WebSocket Integration: Real-time updates using ActionCable
  • Agent Statistics: Call counts and performance metrics

πŸ“ˆ Reports & Analytics

  • Call Reports: Comprehensive call history and analytics
  • Date Range Filtering: Custom date range selection
  • Data Export: CSV and PDF export capabilities
  • Visual Charts: Interactive charts and graphs

🎀 Call Management

  • Call History: Detailed call records with filtering
  • Recording Playback: Audio recording management
  • Search & Filter: Advanced search and filtering options
  • Status Tracking: Call status and duration tracking

πŸ” Authentication & Security

  • Devise Authentication: Secure user authentication system
  • Session Management: Persistent login sessions
  • Protected Routes: Authentication-based route protection
  • Organization Support: Multi-tenant organization structure

πŸ—οΈ Modern Rails Architecture

  • Rails 7 Monolith: Server-rendered ERB templates
  • Stimulus Controllers: Progressive JavaScript enhancement
  • ActionCable: Real-time WebSocket connections
  • Responsive Design: Mobile-friendly CSS with modern layouts
  • Asset Pipeline: Optimized asset compilation and delivery

πŸ’» Development Commands

Essential Commands

# Development
bundle exec rails server       # Start Rails server
bin/rails assets:precompile    # Build and precompile assets
bundle install                 # Install Ruby dependencies
bin/rails console              # Open Rails console

# Database
bin/rails db:create db:migrate db:seed  # Create, migrate, and seed database
bin/rails db:migrate           # Run migrations only
bin/rails db:seed               # Seed database with sample data

# Testing & Quality
bundle exec rails test                    # Run all Rails tests
bundle exec rails test test/integration/  # Run integration tests only
bundle exec rails test test/system/       # Run system tests (if available)
bundle exec rails test test/integration/login_test.rb  # Run login tests specifically
bundle exec rubocop                      # Run RuboCop linting

Manual Commands (if needed)

# Manual dependency installation
bundle install                 # Install Ruby gems

# Manual database operations
bin/rails db:create            # Create database
bin/rails db:migrate           # Run migrations  
bin/rails db:seed              # Seed with sample data

# Manual server start
bundle exec rails server       # Start Rails server directly

# Asset compilation
bin/rails assets:precompile    # Precompile assets

πŸ“± Application Structure

voipappz-mini-app-template/
β”œβ”€β”€ web/                       # Rails application
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ controllers/       # Rails controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard_controller.rb    # Live dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ calls_controller.rb        # Call management
β”‚   β”‚   β”‚   β”œβ”€β”€ reports_controller.rb      # Analytics
β”‚   β”‚   β”‚   └── auth_controller.rb         # Authentication
β”‚   β”‚   β”œβ”€β”€ views/             # ERB templates
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/     # Dashboard views
β”‚   β”‚   β”‚   β”œβ”€β”€ calls/         # Call management views
β”‚   β”‚   β”‚   β”œβ”€β”€ reports/       # Report views
β”‚   β”‚   β”‚   └── shared/        # Shared partials
β”‚   β”‚   β”œβ”€β”€ models/            # ActiveRecord models
β”‚   β”‚   β”‚   β”œβ”€β”€ user.rb        # User with Devise
β”‚   β”‚   β”‚   β”œβ”€β”€ organization.rb # Organization model
β”‚   β”‚   β”‚   └── item.rb        # Call/Item model
β”‚   β”‚   β”œβ”€β”€ channels/          # ActionCable channels
β”‚   β”‚   β”‚   └── dashboard_live_channel.rb
β”‚   β”‚   β”œβ”€β”€ javascript/        # Stimulus controllers
β”‚   β”‚   β”‚   └── controllers/   # JavaScript controllers
β”‚   β”‚   β”‚       β”œβ”€β”€ clock_controller.js
β”‚   β”‚   β”‚       β”œβ”€β”€ live_updates_controller.js
β”‚   β”‚   β”‚       └── filters_controller.js
β”‚   β”‚   β”œβ”€β”€ assets/            # CSS and assets
β”‚   β”‚   β”‚   └── stylesheets/
β”‚   β”‚   β”‚       └── application.css  # Main stylesheet
β”‚   β”‚   └── services/          # Business logic services
β”‚   └── config/                # Rails configuration
β”œβ”€β”€ README.md                  # This file
β”œβ”€β”€ ARCHITECTURE.md            # Architecture documentation
β”œβ”€β”€ DEVELOPMENT.md             # Development guide
└── DEPLOYMENT.md              # Deployment instructions

πŸ”§ Tech Stack

Technology Purpose Version
Backend
Ruby on Rails Web framework, MVC architecture 7.1.3
ActionCable WebSocket connections Built-in
Devise Authentication framework Latest
SQLite Database (development) 1.4+
Frontend
ERB Templates Server-rendered views Built-in
Stimulus JavaScript framework Built-in
CSS3 Modern responsive styling Built-in
Asset Pipeline Asset compilation Built-in
Optional
Redis ActionCable adapter (production) 4.0+
AnyCable Scalable WebSocket connections 1.5+

πŸ§ͺ Testing

Running Tests

The project includes comprehensive test coverage with both integration and unit tests.

Test User Accounts:

Available Test Commands:

# Run all tests
bundle exec rails test

# Run specific test types
bundle exec rails test test/integration/           # Integration tests
bundle exec rails test test/controllers/          # Controller tests
bundle exec rails test test/models/               # Model tests
bundle exec rails test test/services/             # Service tests

# Run specific test file
bundle exec rails test test/integration/login_test.rb

# Run tests with verbose output
bundle exec rails test -v

Login Test Coverage: The test/integration/login_test.rb file includes comprehensive login functionality tests:

  • βœ… Successful login with valid credentials
  • βœ… Failed login with invalid email/password
  • βœ… Redirect behavior for authenticated users
  • βœ… Login form validation and accessibility
  • βœ… Logout functionality
  • βœ… Page content and branding verification

Test Environment Setup

# Prepare test database (automatic, but can be run manually)
RAILS_ENV=test bin/rails db:create db:migrate

# Load test fixtures (automatic during test runs)
RAILS_ENV=test bin/rails db:fixtures:load

πŸ” Troubleshooting

Common Issues

Server Won't Start

# Check Ruby version
ruby --version  # Should be 3.3.0+

# Install dependencies
bundle install

# Check database
bin/rails db:migrate

Port Already in Use

# Kill process on port 3000
lsof -ti:3000 | xargs kill -9

# Or use different port
bin/rails server -p 3001

Asset Issues

# Precompile assets manually
bin/rails assets:precompile

# Clear asset cache
bin/rails assets:clobber
bin/rails assets:precompile

ActionCable Not Working

# Check cable.yml configuration
# For development, use 'async' adapter
# For production, use 'redis' or 'any_cable'

Authentication Issues

# Generate new Devise secret key
bin/rails credentials:edit

# Reset database and reseed
bin/rails db:drop db:create db:migrate db:seed

Missing Dependencies

# Reinstall Ruby dependencies
bundle install

# Check for missing gems
bundle check

πŸ› οΈ Configuration

Database Configuration

  • Development: SQLite (file-based)
  • Test: SQLite (in-memory)
  • Production: Configurable (PostgreSQL recommended)

ActionCable Configuration

# config/cable.yml
development:
  adapter: async  # For development

production:
  adapter: redis  # For production
  url: redis://localhost:6379/1

Authentication

  • Uses Devise for user authentication
  • JWT tokens for API authentication
  • Session-based authentication for web interface
  • Password recovery and user registration

🚒 Production Deployment

Environment Setup

# Required environment variables
RAILS_ENV=production
RAILS_MASTER_KEY=your-master-key
DATABASE_URL=postgresql://user:pass@host:5432/dbname
REDIS_URL=redis://your-redis-server:6379/1  # If using Redis

Build Commands

# Precompile assets
RAILS_ENV=production bin/rails assets:precompile

# Run database migrations
RAILS_ENV=production bin/rails db:migrate

# Start production server
RAILS_ENV=production bundle exec rails server

πŸ“„ License

MIT License - see LICENSE file for details.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub
  • Check the troubleshooting section above
  • Review the ARCHITECTURE.md for technical details
  • See DEVELOPMENT.md for development guidance

πŸ”— Documentation

External Resources


Built with ❀️ as a Rails monolith for VoIP call centers

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published