README
Welcome to our comprehensive documentation. Get started with installation guides and explore our architecture.
π Mercury CRM - Developer Documentation
Welcome to Mercury CRM, a powerful and scalable Customer Relationship Management system built with modern web technologies. This documentation will guide you through every aspect of our application, from initial setup to advanced customization.
π― What is Mercury CRM?
Mercury CRM is a comprehensive business solution featuring:
- ποΈ HMVC Architecture - Modular, scalable, and maintainable codebase
- π± WhatsApp Integration - Advanced Waha module for business communication
- βοΈ Cloud Storage - Seamless AWS S3 integration
- π Advanced Analytics - Real-time insights and reporting
- π Enterprise Security - Multi-layer authentication and authorization
- π Multi-tenant Support - Scalable for businesses of all sizes
β‘ Quick Start
Get up and running in 5 minutes:
# 1. Clone the repository
git clone <repository-url>
cd mercury-crm
# 2. Install dependencies
composer install
npm install
# 3. Setup environment
cp .env.example .env
php artisan key:generate
# 4. Run migrations
php artisan migrate --seed
# 5. Start development server
php artisan serve
π‘ Tip: For detailed installation instructions, see our Installation Guide
π Documentation Sections
π Getting Started
- Installation Guide - Complete setup instructions
- HMVC Architecture - Understanding our modular approach
- Project Structure - Code organization and patterns
π Core Modules
- Lead Module - CRM lead management with clean architecture β
ποΈ Architecture & Design
- Waha Module - WhatsApp integration architecture
- S3 Storage Service - File management and cloud storage
- Database Design - Schema patterns and relationships
βοΈ Configuration & Services
- Environment Setup - Configuration management
- API Documentation - RESTful API reference
- Authentication - Security and access control
ποΈ System Architecture
Our system follows an API-first architecture with clear separation between frontend and backend:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β API Gateway β β Backend β
β (Next.js) βββββΊβ (Laravel) βββββΊβ (HMVC) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββββ
β Services β
β β’ Waha β
β β’ S3 Storage β
β β’ Analytics β
β β’ Notificationsβ
βββββββββββββββββββ
API-First Design
- Backend: Laravel provides RESTful APIs with JWT authentication
- Frontend: Next.js consumes APIs independently
- Documentation: Interactive Swagger docs at
/docs/adminand/docs/instructor - Modularity: Each service can be developed and deployed independently
π οΈ Technology Stack
Backend
- PHP 8.4+ - Modern PHP with type declarations
- Laravel 11 - Robust framework with advanced features
- MySQL 8.0 - High-performance database
- Redis - Caching and session management
Frontend
- Next.js - React-based full-stack framework
- React - Component-based UI library
- TypeScript - Type-safe JavaScript development
Infrastructure
- Docker - Containerized development environment
- AWS S3 - Scalable file storage
- WhatsApp API - Business communication platform
π Module Overview
Our HMVC architecture consists of several specialized modules:
| Module | Purpose | Key Features |
|---|---|---|
| Lead β | CRM lead management | Clean architecture, third-party integrations, edit API |
| Actions | System actions and commands | Error handling, logging |
| Admin | Administrative interface | User management, system config |
| Waha | WhatsApp integration | Message handling, webhooks |
| Attachment | File management | S3 integration, media processing |
| Company | Business management | Multi-tenant support |
| Instructor | Training management | Course and certification handling |
π Development Workflow
1. Feature Development
# Create feature branch
git checkout -b feature/new-feature
# Development workflow
composer install
npm run dev
php artisan serve
# Run tests
php artisan test
npm run test
2. Code Standards
- PSR-12 coding standards
- Type declarations for all methods
- PHPDoc documentation
- Unit & Feature tests for all new code
3. Module Creation
# Generate new module
php artisan module:make ModuleName
# Generate module components
php artisan module:make-controller ModuleName ControllerName
php artisan module:make-model ModuleName ModelName
php artisan module:make-migration ModuleName create_table_name
π Security Features
- π‘οΈ Authentication - Multi-factor authentication support
- π Authorization - Role-based access control (RBAC)
- π Data Encryption - End-to-end encryption for sensitive data
- π API Security - JWT tokens and rate limiting
- π Audit Logging - Comprehensive activity tracking
π Performance & Monitoring
- β‘ Caching - Redis-based caching strategy
- π Monitoring - Application performance metrics
- π Logging - Structured logging with context
- π± Real-time - WebSocket support for live updates
π§ͺ Testing Strategy
# Run all tests
php artisan test
# Run specific test suite
php artisan test --testsuite=Unit
php artisan test --testsuite=Feature
# Generate coverage report
php artisan test --coverage
Testing Levels
- Unit Tests - Individual component testing
- Feature Tests - End-to-end workflow testing
- Integration Tests - Module interaction testing
π Deployment
Production Deployment
# Production optimization
composer install --no-dev --optimize-autoloader
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Database migrations
php artisan migrate --force
# Queue processing
php artisan queue:work --daemon
Environment Requirements
- PHP 8.4+ with required extensions
- MySQL 8.0+ or PostgreSQL 13+
- Redis 6.0+ for caching
- Node.js 16+ for asset compilation
π€ Contributing
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Follow our coding standards
- Write comprehensive tests
- Submit a pull request
Development Setup
# Clone your fork
git clone <your-fork-url>
cd mercury-crm
# Install dependencies
composer install
npm install
# Setup development environment
./setup-dev.sh
π Support & Resources
Getting Help
- π Documentation - Comprehensive guides and examples
- π Issues - Report bugs and request features
- π¬ Discussions - Community Q&A and ideas
- π§ Contact - Direct support for enterprise users
Useful Links
- API Documentation - Interactive API explorer
- Architecture Guide - Deep dive into our HMVC pattern
- Deployment Guide - Production deployment strategies
- Troubleshooting - Common issues and solutions
πΊοΈ Roadmap
Current Version (v2.0)
- β HMVC Architecture
- β Waha WhatsApp Integration
- β S3 File Management
- β Advanced Authentication
Upcoming Features
- π GraphQL API - Modern API architecture
- π± Mobile App - Native mobile applications
- π€ AI Integration - Intelligent automation
- π Advanced Analytics - Business intelligence tools
π Ready to Build?
Choose your path:
π‘ Pro Tip: Our documentation is interactive! Use the search feature to quickly find what you need, and don't forget to check out our Swagger API documentation for hands-on API testing.
Built with β€οΈ by the Mercury CRM Team