Skip to content

dev-mhany/nextjs-mui-audit-toolkit

Repository files navigation

Next.js + MUI Audit Toolkit

Comprehensive auditing solution for Next.js applications using Material-UI

A powerful toolkit that combines static analysis, runtime testing, and automated reporting to ensure your Next.js + Material-UI projects follow best practices for performance, accessibility, security, and code quality.

Audit Toolkit Demo

🌟 Key Features

πŸ” Comprehensive Analysis

  • Static Code Analysis: Pattern-based scanning for MUI best practices
  • Runtime Performance Testing: Lighthouse integration with PWA audits
  • Accessibility Validation: WCAG AA compliance checking
  • Bundle Analysis: Import optimization and size monitoring
  • Security Scanning: XSS prevention and secure coding practices

πŸš€ Dual Interface Options

  • πŸ–₯️ Web Application: Modern React interface for repository auditing
  • ⚑ CLI Tool: Command-line interface for development workflows
  • πŸ”„ GitHub Actions: Automated CI/CD integration

πŸ“Š Intelligent Reporting

  • Automated Grading: A-F scoring with weighted categories
  • Line-Level Precision: Exact file and line issue reporting
  • Multiple Formats: JSON, HTML, and Markdown reports
  • Progress Tracking: Real-time audit execution monitoring

πŸš€ Quick Start

Option 1: Web Application (Recommended)

The easiest way to audit repositories through a modern web interface:

# Quick setup
./setup.sh  # Linux/macOS
# or
./setup.ps1  # Windows

# Manual setup
cd webapp
npm install
cp .env.example .env.local
# Edit .env.local with your GitHub token
npm run dev

Then visit: http://localhost:3000

Option 2: CLI Tool

For direct command-line usage and CI/CD integration:

# Navigate to CLI tool
cd "audit script"
npm install

# Run audit on current project
npm run audit

# Audit specific project
node src/index.js --path /path/to/project --output ./results

πŸ“ Project Structure

nextjs-mui-audit-toolkit/
β”œβ”€β”€ webapp/                    # 🌐 Web Application
β”‚   β”œβ”€β”€ src/app/              # Next.js 14 App Router
β”‚   β”œβ”€β”€ src/components/       # React components
β”‚   β”œβ”€β”€ src/lib/              # Utility libraries
β”‚   └── package.json          # Web app dependencies
β”œβ”€β”€ audit script/             # ⚑ CLI Tool
β”‚   β”œβ”€β”€ src/                  # Core audit logic
β”‚   β”œβ”€β”€ tests/                # Test suites
β”‚   β”œβ”€β”€ examples/             # Sample projects
β”‚   └── package.json          # CLI tool dependencies
β”œβ”€β”€ .github/workflows/        # πŸ”„ GitHub Actions
β”œβ”€β”€ DEPLOYMENT.md             # πŸ“š Deployment guide
└── setup.sh/setup.ps1       # πŸ› οΈ Quick setup scripts

🌐 Web Application

Modern interface for repository auditing with:

  • Repository URL Input: Audit any GitHub repository
  • Real-time Progress: Live tracking of audit execution
  • GitHub Integration: Automatic workflow creation and execution
  • Email Notifications: Get notified when audits complete
  • Results Dashboard: View audit history and analytics
  • Mobile Responsive: Works on desktop and mobile devices

Web App Features

Feature Description
πŸ”— Repository Input Paste GitHub URL and start auditing
πŸ” Token Support Private repository access via GitHub tokens
⚑ GitHub Actions Automated audit execution in the cloud
πŸ“§ Email Alerts Completion notifications via email
πŸ“Š Analytics Audit history and performance metrics
🎨 Material-UI Beautiful, responsive interface

Tech Stack: Next.js 14, TypeScript, Material-UI v5, GitHub API

⚑ CLI Tool

Command-line interface for development workflows:

  • Static Analysis: File scanning with custom rule engine
  • ESLint Integration: Comprehensive linting with MUI plugins
  • Performance Testing: Lighthouse CI with custom budgets
  • Accessibility Testing: Playwright + Axe integration
  • Bundle Analysis: Import patterns and size optimization
  • PWA Validation: Progressive Web App compliance

CLI Features

Feature Description
πŸ“ Rule Engine 50+ custom rules for Next.js + MUI
🎯 Grading System Automated A-F scoring
πŸ” Line Precision Exact file/line issue reporting
πŸš€ Performance Core Web Vitals and bundle analysis
β™Ώ Accessibility WCAG AA compliance validation
πŸ”’ Security XSS prevention and secure patterns

Tech Stack: Node.js 18+, ESLint, Lighthouse, Playwright, Jest

πŸ”„ GitHub Actions Integration

Both interfaces support GitHub Actions for automated auditing:

# .github/workflows/audit.yml
name: Next.js + MUI Audit
on: [push, pull_request]
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Audit
        uses: ./
        with:
          output-path: ./audit-results

πŸ“Š Sample Report

{
  "grades": {
    "overallScore": 87,
    "letterGrade": "B+",
    "categories": {
      "muiUsage": { "score": 95, "weight": 30 },
      "performance": { "score": 82, "weight": 25 },
      "accessibility": { "score": 90, "weight": 20 },
      "security": { "score": 85, "weight": 15 },
      "codeQuality": { "score": 78, "weight": 10 }
    }
  },
  "summary": {
    "totalIssues": 12,
    "criticalIssues": 2,
    "filesScanned": 45,
    "rulesApplied": 52
  }
}

πŸ› οΈ Configuration

Environment Variables

# GitHub Integration
GITHUB_TOKEN=ghp_your_token_here
GITHUB_WEBHOOK_SECRET=your_secure_secret

# Email Notifications (Optional)
EMAIL_PROVIDER=smtp
EMAIL_HOST=smtp.gmail.com
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password

# Application Settings
NEXTAUTH_URL=https://your-app.vercel.app
LOG_LEVEL=info

Audit Configuration

// audit.config.js
module.exports = {
  rules: {
    'mui-imports': 'error',
    'theme-tokens': 'warn',
    accessibility: 'error'
  },
  performance: {
    budgets: {
      'first-load-js': 180
    }
  },
  output: {
    formats: ['json', 'html', 'markdown']
  }
}

πŸš€ Deployment

Web Application Deployment

Vercel (Recommended):

cd webapp
npx vercel --prod

Netlify:

cd webapp
npm run build
netlify deploy --prod --dir=.next

Docker:

cd webapp
docker build -t audit-webapp .
docker run -p 3000:3000 audit-webapp

CLI Tool Usage

Local Development:

cd "audit script"
npm install
npm run audit

CI/CD Integration:

# Add to your workflow
- name: Audit Next.js + MUI
  run: |
    cd "audit script"
    npm ci
    npm run audit -- --path . --output ./results

πŸ“š Documentation

Complete documentation is organized by component:

πŸ” Quick Access

🎨 Component Documentation

πŸ”§ Audit Script (CLI)

Location: /audit script/docs/

🌐 Web Application

Location: /webapp/docs/

Document Description
πŸ“– Web App README Complete web application guide
⚑ CLI README Command-line tool documentation
πŸš€ Deployment Guide Comprehensive deployment instructions
πŸ”§ Integration Guide CI/CD and workflow integration

πŸ§ͺ Testing

# Test web application
cd webapp
npm test
npm run test:e2e

# Test CLI tool
cd "audit script"
npm test
npm run test:integration

🀝 Contributing

  1. Fork the repository
  2. Choose your focus:
    • Web Application: cd webapp
    • CLI Tool: cd "audit script"
  3. Create feature branch: git checkout -b feature/amazing-feature
  4. Make changes and test
  5. Submit pull request

Development Guidelines

  • Code Quality: ESLint + Prettier configuration included
  • Testing: Write tests for new features
  • Documentation: Update relevant README files
  • Type Safety: Use TypeScript for new code
  • Commit Convention: Follow conventional commit format

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Next.js Team - Amazing React framework
  • Material-UI Team - Beautiful React components
  • GitHub - Actions platform and API
  • Vercel - Excellent hosting platform
  • Open Source Community - Tools and inspiration

πŸ“ž Support

🌟 Features Comparison

Feature Web App CLI Tool GitHub Actions
Repository Auditing βœ… βœ… βœ…
Real-time Progress βœ… ⚑ βœ…
Email Notifications βœ… ❌ βœ…
GitHub Integration βœ… ⚑ βœ…
Visual Dashboard βœ… ❌ ❌
CI/CD Integration ⚑ βœ… βœ…
Offline Usage ❌ βœ… ❌
Batch Processing ⚑ βœ… βœ…

Legend: βœ… Full Support | ⚑ Partial Support | ❌ Not Available


Built with ❀️ by dev-mhany

Automated auditing for Next.js + Material-UI projects

License: MIT Node.js Version Next.js Material-UI

Releases

No releases published

Packages

No packages published