Compliance Score & Trust Badges
Relevant source files
The following files were used as context for generating this wiki page:
The Compliance Score and Trust Badge system provides a quantitative assessment of a website's legal and regulatory posture. By analyzing technical configurations—such as the CMS framework, tracking pixels, and targeted jurisdictions—the system generates a weighted score between 0 and 100. This score serves as the foundation for "Trust Badges," which are verifiable, public snapshots that merchants can display to demonstrate their commitment to privacy and compliance.
Sources: src/components/ClauseEngine.tsx:75-81, src/app/score/[slug]/page.tsx:42-47
Compliance Score Calculation
The compliance score is calculated through a multi-dimensional matrix that evaluates four core categories. Each category contributes 25% to the final weighted average.
Score Dimensions
| Category | Description | Calculation Basis |
|---|---|---|
| Contract Protection | Strength of legal liability shifting. | Ratio of protective clauses generated for the specific framework. |
| Privacy Coverage | Depth of consumer-facing disclosures. | Detection of tracking pixels and depth of regional disclosures. |
| Pre-Launch Readiness | Operational engineering readiness. | Completion of framework-specific and universal critical checklist items. |
| Regulatory Breadth | Geographic and industry scope. | Number of jurisdictions covered and presence of Enterprise modules (HIPAA, etc.). |
Sources: src/components/ClauseEngine.tsx:556-590, src/tests/ClauseEngine.test.ts:153-170
Logic Flow for Score Generation
The calculateComplianceScore function processes the generated compliance package to derive these metrics. For example, Regulatory Breadth is significantly boosted by the addition of Enterprise modules like HIPAA or PCI-DSS.
The diagram shows how various components of a compliance package feed into the four-pillar calculation engine to produce the final overall score.
Sources: src/components/ClauseEngine.tsx:556-590, src/app/dashboard/DashboardWizard.tsx:210-230
Trust Badges & Public Verification
Once a score is generated, it can be "published" to create a permanent, public snapshot. This snapshot is accessible via a unique slug and allows third parties to verify the compliance claims without needing authentication.
Public Score Page
The public score page displays:
- The Verified Score: A large numeric display (0-100).
- Compliance Banding: Descriptive labels based on the score (e.g., "Strong compliance posture" for scores $\ge$ 80).
- Certified Badge: A dynamic SVG badge generated via an API route.
- Timestamp: The date the specific snapshot was published.
Sources: src/app/score/[slug]/page.tsx:12-23, src/app/score/[slug]/page.tsx:42-65
Badge Visualization
The UI uses consistent color coding to represent different levels of compliance readiness.
| Score Range | Visual Color | Interpretation |
|---|---|---|
| 80 - 100 | Emerald / Green | Strong compliance posture |
| 60 - 79 | Yellow / Amber | Moderate — improvements recommended |
| 0 - 59 | Red | At risk — action needed |
Sources: src/app/score/[slug]/page.tsx:11-20, src/app/dashboard/home/CommandCenterView.tsx:300-305
Command Center Monitoring
For authenticated users, the Command Center provides an aggregate view of compliance across all active projects. This includes a global "Aggregate Score" and status indicators that flag if a project's score is "Outdated" due to regulatory changes.
The sequence diagram illustrates how the dashboard monitors projects and alerts users if regulatory updates have rendered their existing compliance scores "outdated."
Sources: src/app/dashboard/home/CommandCenterView.tsx:130-150, src/app/dashboard/home/CommandCenterView.tsx:190-205
Data Structure: ComplianceScore
The internal representation of the score used across the API and UI.
export interface ComplianceScore {
overall: number;
contractProtection: number;
privacyCoverage: number;
preLaunchReadiness: number;
regulatoryBreadth: number;
}
Sources: src/components/ClauseEngine.tsx:75-81
Conclusion
The Compliance Score & Trust Badge system transforms complex legal and technical requirements into actionable, easy-to-understand metrics. By combining real-time calculation with public verification capabilities, it enables developers and merchants to quantify and display their compliance status reliably.
Sources: src/app/dashboard/DashboardWizard.tsx:440-460, src/app/score/[slug]/page.tsx:65-72