Frontend Documentation

The Compliance Scorecard frontend is a modern React 18 single-page application built with Material-UI, providing an intuitive and responsive interface for compliance management.

React 18.3.1

Modern functional components with hooks

Material-UI v5

Comprehensive component library with theming

Redux Toolkit

Predictable state management with persistence

Built on Material Dashboard Pro: The frontend uses the Creative Tim Material Dashboard Pro template as its foundation, customized for compliance management workflows.

Project Structure

src/
├── components/              # Reusable UI components
│   ├── MD*/                # Material Dashboard components
│   └── utils/              # Component utilities
├── features/               # Redux slices by domain
│   ├── company/           # Company management
│   ├── user/              # User authentication
│   ├── assessmentConfig/  # Assessment configuration
│   ├── asset-management/  # Asset management
│   └── storeConfig/       # Redux store setup
├── views/                 # Page components and layouts
│   ├── components/        # Shared view components
│   ├── containers/        # Layout containers
│   └── pages/             # Main application pages
├── assets/                # Static assets
│   ├── images/           # Images and icons
│   ├── theme/            # Material-UI theme configuration
│   └── videos/           # Video assets
├── context/               # React context providers
├── helpers/               # Utility functions
├── utils/                 # General utilities
└── routes.js              # Application routing configuration

Technology Stack

Core React Stack
React 18.3.1 React Router 6.30.0 React Redux 8.1.3
  • Functional components with hooks
  • Context API for global state
  • Concurrent features and Suspense
  • Client-side routing with React Router
State Management
Redux Toolkit 1.9.7 Local Storage
  • Modern Redux with RTK
  • Async thunks for API calls
  • State persistence to localStorage
  • Feature-based store organization
UI & Styling
Material-UI 5.17.1 Emotion Tinycolor2
  • Material Design components
  • Custom theme configuration
  • Dark/light mode support
  • Responsive design system
Development Tools
Formik 2.4.6 Yup 0.32.11 Axios 1.9.0
  • Form management with validation
  • HTTP client with interceptors
  • Error tracking with Sentry
  • Testing with Jest and React Testing Library

Authentication System

Secure authentication powered by Auth0 with role-based access control and automatic token management.

Auth0 Integration

// App.js - Auth0 Setup
import { useAuth0 } from "@auth0/auth0-react";

const { getAccessTokenSilently } = useAuth0();

useEffect(() => {
  const getUserMetadata = async () => {
    try {
      const accessToken = await getAccessTokenSilently({
        audience: process.env.REACT_APP_AUTH0_AUDIENCE,
      });

      axios.defaults.headers.common["Authorization"] = `Bearer ${accessToken}`;
      localStorage.setItem("token", accessToken);
      localStorage.setItem("login_type", "auth0");
    } catch (e) {
      // Handle error
    }
  };
  getUserMetadata();
}, [getAccessTokenSilently]);
Auth Features
  • Silent token refresh
  • Role-based routing
  • Auto-logout timer
  • Permission-based UI
  • Secure token storage
  • Logout confirmation

Authentication Flow

1. Login

Auth0 hosted login page

2. Token

JWT access token received

3. Verification

User profile and permissions loaded

4. Dashboard

Redirect to appropriate dashboard

State Management with Redux Toolkit

Centralized state management using Redux Toolkit with feature-based organization and local storage persistence.

Store Configuration

// store.js
import { configureStore } from "@reduxjs/toolkit";
import rootReducer from "./rootReducer";

const store = configureStore({
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: false,
    }),
  reducer: rootReducer,
});

// Auto-save to localStorage
store.subscribe(() => 
  saveToLocalStorage(store.getState())
);

Feature Slices

Feature State
auth User authentication and profile
companies Company and client management
policies Policy lifecycle management
assessments Assessment events and templates
leaderboard Gamification and scoring
stripe Payment and billing

Async Actions Pattern

// Example: Policy Actions
import { createAsyncThunk } from '@reduxjs/toolkit';

export const fetchPolicies = createAsyncThunk(
  'policies/fetchPolicies',
  async ({ clientId, params }, { rejectWithValue }) => {
    try {
      const response = await axios.get(`/api/v3/clients/${clientId}/policies`, {
        params
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(error.response.data);
    }
  }
);

Routing & Navigation

Dynamic routing system with role-based access control and hierarchical navigation structure.

Route Configuration

// routes.js structure
const routes = [
  {
    type: "collapse",
    name: "Dashboard",
    key: "dashboard",
    icon: dashboard,
    route: "/dashboard",
    component: ,
  },
  {
    type: "collapse",
    name: "Policies",
    key: "policies",
    icon: description,
    collapse: [
      {
        name: "Policy Management",
        key: "policy-management",
        route: "/policies",
        component: ,
      },
      {
        name: "Policy Templates", 
        key: "policy-templates",
        route: "/policy-templates",
        component: ,
      }
    ]
  }
];
Navigation Features
  • Collapsible sidebar navigation
  • Breadcrumb navigation
  • Role-based menu filtering
  • Top navigation bar
  • Mobile-responsive drawer
  • Deep linking support

Protected Routes

Routes are protected based on user roles and permissions. The navigation menu dynamically adjusts to show only accessible features for the current user.

UI Component System

Custom Material-UI components with consistent theming and responsive design patterns.

MD Components

Custom Material Dashboard components:

  • MDBox - Flexible container
  • MDButton - Themed buttons
  • MDInput - Form inputs
  • MDTypography - Text components
  • MDAlert - Notification alerts
Data Visualization

Charts and data display:

  • Chart.js integration
  • Bar, line, and pie charts
  • Real-time data updates
  • Interactive dashboards
  • Export capabilities
Data Tables

Advanced table functionality:

  • DataTables.net integration
  • Sorting and filtering
  • Pagination and search
  • Responsive design
  • Export to CSV/PDF
Rich Text Editor

TinyMCE integration:

  • WYSIWYG policy editing
  • Custom plugins
  • Auto-save functionality
  • Version comparison
  • Document preview

Dashboard System

Role-based dashboard with customizable widgets and real-time compliance metrics.

Dashboard Components

Component Purpose User Roles
GameCharts Compliance scoring and gamification MSP Admin, Company User
AssessmentCharts Assessment completion metrics All Users
PolicyCharts Policy adoption and approval status MSP Admin, Company User
AssetTable Asset management overview MSP Admin, Company User
SatMetricsProgressBar Security awareness training progress All Users
Dashboard Features
  • Real-time compliance metrics
  • Interactive charts and graphs
  • Customizable widget layout
  • Export and reporting tools
  • Mobile-responsive design
  • Role-based content filtering

Policy Management Interface

Comprehensive policy lifecycle management with rich text editing, approval workflows, and version control.

Policy Creation & Editing
  • TinyMCE rich text editor integration
  • Section-based policy structure
  • Auto-save functionality
  • Template-based policy creation
  • Version comparison tools
// Policy Editor Components
- EditTemplate/EditTemplateFormikWrapper
- CreatePolicyDocument
- PolicyDocumentSections
- AutoSaveMCEPlugin
- VersionBrowserPlugin
Approval Workflow
  • Multi-stage review process
  • Reviewer assignment and notifications
  • Comment and feedback system
  • Approval/rejection workflows
  • Publication and distribution
// Workflow Components  
- ReviewPolicy/ReviewPolicyLanding
- PolicyReviewDataTable
- ApprovalNotifications
- PublishDocumentDialog

Policy Management Features

Version Control

Track changes with detailed version history and side-by-side comparison

PDF Generation

Generate formatted PDF documents with custom branding and layouts

Policy Adoption

Track policy adoption with campaigns and automated reminders

Assessment Management

Comprehensive assessment system with customizable templates, automated scoring, and detailed reporting.

Assessment Components

AssessmentDashboard/
├── AssessmentEvents/
│   ├── TakeAssessment/
│   └── components/
├── AssessmentTemplates/  
│   ├── ImportTemplateCSVDialog
│   └── GlobalTemplatesDataTable
├── AssessmentReports/
│   ├── SPRSReports/
│   └── ConsolidatedReports/
└── Ssp/
    ├── SspVersions/
    └── SspPDFDownloader/

Key Features

  • Template Management: Create and share assessment templates
  • Question Types: Multiple choice, text, file uploads
  • RACI Framework: Responsibility assignment matrix
  • Automated Scoring: Configurable scoring algorithms
  • Risk Matrix: Risk assessment and categorization
  • SPRS Reporting: Government compliance reporting
  • SSP Integration: System Security Plan generation

External Integrations

Extensive integration capabilities with 20+ external platforms for comprehensive compliance management.

RMM & Asset Management
  • ConnectWise
  • N-Central
  • Ninja RMM
  • Auvik
  • Nodeware
  • Hudu
  • MS Graph
  • Symbol API
Security Tools
  • Huntress
  • CyberCNS
  • Breach Secure Now
  • PHIN Security
  • Lionguard
  • Cyberhoot
  • ConnectSecure
  • Fifth Wall
Cloud Storage & Collaboration
  • Microsoft Graph (OneDrive, SharePoint)
  • Google Drive integration
  • MS Teams notifications
  • Slack integration
  • Email delivery systems
Payment & Billing
  • Stripe payment processing
  • Pax8 marketplace integration
  • Subscription management
  • Invoice generation
  • Usage tracking and billing

Component Library

Reusable components built on Material-UI with consistent theming and accessibility features.

// Example: Custom MD Component
import { forwardRef } from "react";
import MDTypographyRoot from "components/MDTypography/MDTypographyRoot";

const MDTypography = forwardRef(({ 
  color, 
  fontWeight, 
  textTransform, 
  verticalAlign, 
  textGradient, 
  opacity, 
  children, 
  ...rest 
}, ref) => (
  
    {children}
  
));

export default MDTypography;

Forms & Validation

Robust form handling with Formik and Yup validation, supporting complex multi-step workflows.

Form Technologies

  • Formik 2.4.6: Form state management
  • Yup 0.32.11: Schema validation
  • Material-UI: Form components
  • Custom Validators: Business logic validation

Form Patterns

  • Multi-step form wizards
  • Dynamic field generation
  • File upload handling
  • Auto-save functionality
  • Form state persistence
// Example: Formik Integration
import { Formik, Form } from 'formik';
import * as Yup from 'yup';

const validationSchema = Yup.object({
  policyTitle: Yup.string()
    .required('Policy title is required')
    .min(3, 'Title must be at least 3 characters'),
  category: Yup.string()
    .required('Category is required'),
  description: Yup.string()
    .max(500, 'Description too long')
});

const PolicyForm = () => (
  
    {/* Form fields */}
  
);

Data Tables

Advanced data table functionality with DataTables.net integration, supporting complex filtering, sorting, and export capabilities.

DataTables.net

Advanced table features with React integration

Search & Filter

Real-time search with advanced filtering options

Export Options

CSV, PDF, and Excel export functionality

Table Features

Feature Description Implementation
Responsive Design Mobile-friendly table layouts DataTables responsive extension
Server-side Processing Handle large datasets efficiently API integration with pagination
Custom Actions Row-level action buttons Custom column renderers
State Persistence Remember user preferences LocalStorage integration