<<<<<<< HEAD
A comprehensive multi-portal Customer Relationship Management system built with Next.js 16, React 19, and NX monorepo. Supports employees, clients, suppliers, and professionals with role-based access.
- MISE installed:
curl https://mise.jdx.dev/install.sh | bash - Node.js (managed by MISE)
- pnpm (managed by MISE)
# Install MISE and setup environment
mise install
mise doctor
# Install Nx CLI globally
mise run 100-000-001-nx-pnpm-install# Install all dependencies
mise run test-install
# Quick health check
mise run check# Start development server - Choose your preferred tool:
mise run dev # MISE
just dev # Just
make dev # Make
pnpm run dev # npm scripts
# All commands do the same thing!π You're done! Visit http://localhost:4200 to see the portal selection page.
This project supports 4 task runners for maximum flexibility:
| Tool | Best For | Quick Example |
|---|---|---|
| MISE | Environment management & testing | mise run test-all |
| Just | Modern syntax, powerful features | just ci |
| Make | Universal compatibility, CI/CD | make check |
| pnpm | IDE integration, simplicity | pnpm run test |
π See TASKS.md for complete task runner guide
# Development
mise run dev | just dev | make dev | pnpm run dev
# Testing
mise run test-unit | just test | make test | pnpm run test
# Linting
mise run test-lint | just lint | make lint | pnpm run lint
# Health Check
mise run check | just check | make check | pnpm run check
# CI Pipeline
mise run ci | just ci | make ci | pnpm run ci| Command | Description | When to Use |
|---|---|---|
mise run test-setup |
Environment verification | First time setup |
mise run test-install |
Install dependencies | After cloning |
mise run test-lint |
Code quality checks | Before commits |
mise run test-typecheck |
TypeScript validation | During development |
mise run test-unit |
Unit tests | Feature development |
mise run test-e2e |
End-to-end tests | Integration testing |
mise run test-build |
Production build | Pre-deployment |
mise run test-all |
Complete test suite | CI/CD pipeline |
# Quick start
make setup # Initial setup
make dev # Development server
make check # Health check (lint + types + unit)
make all # Full test suite
make ci # CI simulation
# Testing phases
make lint # ESLint
make typecheck # TypeScript
make test # Unit tests
make e2e # E2E tests
make build # Production build
# Development
make test-watch # Watch mode
make clean # Clean artifacts
make reset # Full reset# Run complete CI pipeline locally
mise run ci
# or
make ci
# This runs: lint β typecheck β test-coverage β e2e β buildnexo-prj/
βββ apps/
β βββ nexo-prj/ # Main Next.js application
β β βββ src/app/ # App Router pages
β β β βββ page.tsx # Portal selection
β β β βββ employee/ # Employee portal
β β β βββ client/ # Client portal
β β β βββ supplier/ # Supplier portal
β β β βββ professional/ # Professional portal
β β βββ specs/ # Unit tests
β β βββ public/ # Static assets
β βββ nexo-prj-e2e/ # E2E tests (Playwright)
βββ libs/
β βββ shared-ui/ # Shared UI components
βββ nx.json # NX configuration
βββ package.json # Workspace dependencies
βββ tsconfig.base.json # TypeScript config
- Next.js 16 - React framework with App Router
- React 19 - UI library
- TypeScript 5.9 - Type safety
- NX 22.3.3 - Monorepo management
- MUI v7 - Component library
- Tailwind CSS - Utility classes
- Emotion - CSS-in-JS
- Vitest - Unit testing
- Playwright - E2E testing
- Testing Library - Component testing
- Jest - Test runner (via NX)
- ESLint - Code linting
- Prettier - Code formatting
- MISE - Environment management
- pnpm - Package management
- β NextAuth.js - Authentication system
- β React Hook Form - Form management
- β TanStack Table - Data tables
- β Recharts - Data visualization
- β PDF.js - Document viewing
- β Multi-portal routing - Role-based portals
- Component rendering tests
- Hook testing
- Utility function tests
- Business logic validation
- Portal navigation
- User interactions
- Form submissions
- Authentication flows
# Unit tests
mise run test-unit # Run all unit tests
mise run test-unit-watch # Watch mode
mise run test-unit-coverage # With coverage
# E2E tests
mise run test-e2e # Headless mode
mise run test-e2e-ui # With UI
# Component specific
mise run test-app # Main app tests
mise run test-components # Shared UI tests# Start with health check
make check
# Work on features
make dev
# Test your changes
make test
# Before commit
make lint && make typecheck# Create feature branch
git checkout -b feature/new-portal
# Development cycle
make dev # Work
make test # Test
make check # Verify
make build # Build check
# Commit
git add .
git commit -m "feat: add new portal functionality"# Full verification
make all
# Performance check
make perf
# CI simulation
make ciMISE not found
curl https://mise.jdx.dev/install.sh | bash
source ~/.bashrcDependencies issues
make reset # Full clean reinstallPort already in use
lsof -ti:4200 | xargs kill -9
make devTest failures
make clean
make test # Re-run tests# Debug unit tests
make debug-unit
# Debug E2E tests
make debug-e2e- ESLint: Zero warnings/errors
- TypeScript: Strict mode enabled
- Test Coverage: >90% target
- Build: Clean production builds
- Build Time: < 2 seconds (incremental)
- Test Time: < 30 seconds (full suite)
- Bundle Size: Optimized with NX
- Setup:
make setup(3 minutes) - Verify:
make check(1 minute) - Explore:
make dev(immediate feedback) - Learn:
make help(comprehensive guide)
- Commits: Conventional commits
- PRs: Include tests and documentation
- Reviews: Automated + manual review
- Unit Tests: All new functions/components
- E2E Tests: All new user flows
- Coverage: Maintain >90%
- CI: All checks must pass
# Simulated CI pipeline (run with: make ci)
- Code Quality (ESLint)
- Type Safety (TypeScript)
- Unit Tests (Vitest)
- E2E Tests (Playwright)
- Build Verification (NX)
- Performance Tests- Docker: Containerized builds
- Static Export: CDN deployment ready
- Multi-environment: Dev/Staging/Prod configs
- β Setup Time: < 5 minutes
- β Test Feedback: < 30 seconds
- β Build Time: < 2 minutes
- β Onboarding: Self-service
- β Quality Gates: Automated
- β Documentation: Comprehensive
π Happy coding! The NEXO frontend is designed for rapid development with comprehensive testing at every step.
A comprehensive, cloud-native CRM system built with modern technologies and best practices.
# Setup entire development environment (one command!)
bash scripts/setup-dev.sh
# Or using MISE
mise run setup
# Or using Make
make setupThis will:
- β Check all prerequisites (Docker, pnpm, Nx)
- β Validate configurations
- β Install dependencies
- β Start Docker services
- β Run health checks
# Start development environment
mise run dev # or: make dev
# Run all tests
mise run test:all # or: make test-all
# View service URLs
mise run urls # or: make urls
# Stop environment
mise run dev:stop # or: make dev-stop- Docker 24.0+ with Docker Compose
- Node.js 22.6.0+
- pnpm 9.13.2+
- Nx 20.2.2+ (optional, will be installed)
- MISE (optional but recommended) - Install
- Make (optional alternative to MISE)
NEXO CRM follows a microservices architecture with:
- Frontend: Next.js 15 (App Router) with React 19
- Backend: NestJS with GraphQL
- Database: PostgreSQL 16
- Cache: Redis 7
- Auth: Keycloak (OAuth 2.0 / OpenID Connect)
- Monitoring: Prometheus + Grafana
- Container Orchestration: Docker Compose (dev) / Kubernetes (prod)
See ARCHITECTURE.md for detailed architecture documentation.
Testing Philosophy: Every step must be testable and simple.
mise run test:quick
# or
make test-quickValidates:
- Docker Compose configuration
- Kubernetes manifests
- Nx installation
mise run test:all
# or
make test-allRuns:
- β Configuration validation
- β Docker services health checks
- β Service connectivity tests
- β Application linting
- β Unit tests
- β Build verification
# Test Helm charts
mise run test:helm:validate
make test-helm-validate
# Test monitoring stack
mise run test:monitoring
make test-monitoring
# Test backend health
mise run test:backend:health
make test-backend-health
# Test database connectivity
mise run test:backend:database
make test-backend-database# Watch mode for development
cd nexo-prj
nx affected --target=test --watchSee docs/TESTING.md for comprehensive testing guide.
.
βββ .github/workflows/ # CI/CD pipelines
βββ docker/ # Docker Compose configuration
β βββ docker-compose.yml
βββ k8s/ # Kubernetes manifests
βββ nexo-prj/ # Nx monorepo workspace
β βββ apps/
β β βββ employee-portal/ # Frontend application
β β βββ api-gateway/ # Backend API (to be added)
β βββ libs/ # Shared libraries
βββ scripts/ # Automation scripts
β βββ setup-dev.sh # Development setup
β βββ test-docker-health.sh # Health checks
β βββ validate-k8s.sh # K8s validation
β βββ ci-test.sh # CI/CD pipeline
βββ docs/ # Documentation
β βββ TESTING.md # Testing guide
β βββ docker.md # Docker guide
βββ .mise.toml # MISE task definitions
βββ Makefile # Make targets (alternative)
βββ README.md # This file
# View all available tasks
mise tasks
# Development
mise run dev # Start dev environment
mise run dev:frontend # Start frontend only
mise run dev:backend # Start backend only
mise run dev:stop # Stop environment
# Docker
mise run docker:up # Start services
mise run docker:down # Stop services
mise run docker:logs # View logs
mise run docker:ps # List containers
mise run docker:clean # Clean resources
# Testing
mise run test:all # All tests
mise run test:quick # Quick validation
mise run test:docker:health # Health checks
mise run k8s:validate # Validate K8s manifests
# Utilities
mise run urls # Show service URLs
mise run db:shell # PostgreSQL shell
mise run redis:shell # Redis CLI
mise run clean:all # Clean everything# View all available targets
make help
# Same commands as MISE, with hyphenated names
make dev
make test-all
make docker-up
make urls# Run scripts directly
bash scripts/setup-dev.sh
bash scripts/test-docker-health.sh
bash scripts/validate-k8s.sh
bash scripts/ci-test.shAfter starting with mise run dev or make dev:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001 (GraphQL: http://localhost:3001/graphql)
- Keycloak: http://localhost:8080
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3002
- pgAdmin: http://localhost:5050 (admin@nexo.local / admin)
- RedisInsight: http://localhost:5540
- PostgreSQL: localhost:5432 (nexo_user / nexo_password)
- Redis: localhost:6379
- ARCHITECTURE.md - System architecture and design decisions
- QUICK_REFERENCE.md - Quick command reference card
- docs/TESTING.md - Comprehensive testing guide
- docs/ADVANCED_MONITORING.md - Monitoring, alerts, and APM
- docs/BACKUP_AUTOMATION.md - Database backup and recovery
- docs/DATABASE_ADMIN_TOOLS.md - Database admin UI guide
- docs/docker.md - Docker setup and configuration
- helm/README.md - Helm charts for Kubernetes deployment
- PROMPTS/ - Development prompts and phases
-
Create feature branch:
git checkout -b ft/your-feature
-
Run tests before starting:
mise run test:quick
-
Develop your feature in
nexo-prj/ -
Test your changes:
cd nexo-prj nx affected --target=test nx affected --target=lint -
Run full test suite:
mise run test:all
-
Commit and push:
git add . git commit -m "feat: your feature description" git push origin ft/your-feature
cd nexo-prj
# Generate new application
nx g @nx/next:app my-app
# Generate new library
nx g @nx/js:lib my-lib
# Show project graph
nx graph
# Build affected projects
nx affected --target=build
# Test affected projects
nx affected --target=test# Start all services
mise run docker:up
# View logs (all services)
mise run docker:logs
# View specific service logs
mise run logs:frontend
mise run logs:postgres
# Execute commands in containers
mise run db:shell # PostgreSQL
mise run redis:shell # Redis
# Restart services
mise run docker:restart# Backup database
mise run db:backup
# Restore database
docker compose -f docker/docker-compose.yml exec -T postgres \
psql -U nexo_user -d nexo_crm < backup.sql
# Reset database (WARNING: deletes all data)
mise run docker:clean
mise run docker:upmise run k8s:validatemise run k8s:dry-runmise run k8s:deploy- OAuth 2.0 / OpenID Connect authentication via Keycloak
- Role-based access control (RBAC)
- Secure secrets management
- Container security scanning (Trivy)
- Regular dependency updates
GitHub Actions workflow runs on every push:
- Validate - Configuration validation
- Docker Tests - Health and connectivity checks
- Application Tests - Lint, test, build
- Security Scan - Vulnerability scanning
- Integration Tests - Full pipeline test
- Deploy - Staging/Production deployment
See .github/workflows/ci.yml for pipeline configuration.
- Grafana: Metrics visualization (http://localhost:3002)
- System Overview Dashboard
- Backend API Metrics Dashboard
- Database Metrics Dashboard
- Prometheus: Metrics collection (http://localhost:9090)
- Jaeger: Distributed tracing (http://localhost:16686)
- OTEL Collector: APM and telemetry (http://localhost:55679)
- Default credentials: admin/admin
See ADVANCED_MONITORING.md for complete monitoring guide.
- pgAdmin: PostgreSQL management (http://localhost:5050)
- RedisInsight: Redis monitoring (http://localhost:5540)
- See DATABASE_ADMIN_TOOLS.md
# Create backup
mise run db:backup
# Test restore
mise run db:restore:test
# Full restore (DESTRUCTIVE)
mise run db:restore
# View backup statistics
mise run db:backup:statsSee BACKUP_AUTOMATION.md for complete backup guide.
# Check Docker is running
docker info
# Check port conflicts
docker ps
# Clean and restart
mise run docker:clean
mise run docker:up# Run diagnostic tests
mise run test:all
# Check service health
mise run test:docker:health
# View logs
mise run docker:logs# Add user to docker group
sudo usermod -aG docker $USER
# Re-login for changes to take effectSee docs/TESTING.md for more troubleshooting tips.
- Read ARCHITECTURE.md to understand the system
- Run
mise run setupto initialize your environment - Create a feature branch:
git checkout -b ft/your-feature - Make your changes and test:
mise run test:all - Commit using conventional commits:
feat:,fix:,docs:, etc. - Push and create a pull request
[Your License Here]
[Your Team Information Here]
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ by the NEXO CRM Team
ft/docker