Data Schema: Certification Metadata
Relevant source files
The following files were used as context for generating this wiki page:The CertificationMetadata is the core data structure used throughout the CyberPath application to represent individual cybersecurity certifications. This schema defines the properties of a certification, from basic information like title and provider to relational data like associated career paths.
Certification data is stored as Markdown files with frontmatter and managed as an Astro content collection. This data is then processed and exposed via JSON API endpoints, which are consumed by frontend components to display certification information in a searchable, reactive data table.
CertificationMetadata Type Definition
The canonical definition of the certification data structure is the CertificationMetadata TypeScript interface. This interface is used across the application, particularly in API responses and frontend components.
Sources: src/types/certification-metadata.ts
Interface Diagram
This diagram shows the structure of the CertificationMetadata interface.
Fields
The table below details each field in the CertificationMetadata interface.
| Field | Type | Description |
|---|---|---|
image | string | The source URL of the certification's image. |
provider | string | The name of the organization providing the certification. |
title | string | The full title of the certification. |
acronym | string | The acronym for the certification (e.g., "CISSP"). |
last_updated_at | Date | The date when the certification information was last updated. |
reference | string | A URL to the official certification page. |
aliases | string[] | An optional array of alternative names or acronyms for the certification. |
career_paths | string[] | An array of career paths this certification is relevant to. |
price | string | The price of the certification exam or materials. |
currency | string | The currency for the price (e.g., "USD"). |
slug | string | A unique, URL-friendly identifier for the certification. |
Sources: src/types/certification-metadata.ts:1-13
Content Collection Schema
The project uses Astro's content collections to manage certification data. Each certification is a Markdown file located in src/content/certifications/. The frontmatter of these files must adhere to a schema defined using Zod. This ensures data integrity and type safety at the content layer.
Sources: src/content.config.ts
Zod Schema Definition
The schema is defined in src/content.config.ts and validates the frontmatter of each certification's Markdown file.
// src/content.config.ts:6-20
const certifications = defineCollection({
loader: glob({ pattern: '**/*.{md,mdx}', base: "./src/content/certifications" }),
schema: ({image}) =>
z.object({
title: z.string(),
acronym: z.string(),
last_updated_at: z.date(),
image: image(),
reference: z.string(),
aliases: z.array(z.string()).optional(),
draft: z.boolean().default(false),
career_paths: z.array(z.enum(CareerPathsList)),
price: z.string(),
currency: z.string(),
}),
});
- The
draftfield is used to exclude certain entries from the production build. - The
career_pathsfield is validated against an enum of allowed values defined inCareerPathsList.
Sources: src/content.config.ts:6-20, src/lib/career-paths.ts:11-23
Data Fetching and Transformation
Certification data is retrieved from the content collection and transformed into the CertificationMetadata format by the getCertificationMetadata function. This function is central to providing data to the application's API endpoints.
getCertificationMetadata Flow
This flowchart illustrates the process of fetching and transforming certification data.
Sources: src/pages/database/data.json.ts:9-28
The key transformations include:
- Filtering: Entries with
draft: truein their frontmatter are excluded. - Provider Derivation: The
providername is derived from the parent directory name of the content file (e.g.,comptia/a-plus.mdbecomes providerComptia). - Image Path: The
imageobject from the content collection is resolved to itssrcpath string. - Slug Creation: The
slugis set to the content entry'sid(e.g.,comptia/a-plus.md).
Sources: src/pages/database/data.json.ts:23-27
API Endpoints
Several JSON API endpoints are provided to expose the certification data to the frontend.
| Endpoint | Description |
|---|---|
/database/data.json | Returns an array of all certification metadata objects. |
/database/data-index.json | Returns a pre-computed Fuse.js search index for all certifications. |
/career-paths/[path]/data.json | Returns an array of certifications filtered by a specific career path. |
/career-paths/[path]/data-index.json | Returns a pre-computed Fuse.js search index for certifications within a specific career path. |
Sources: src/pages/database/data.json.ts, src/pages/database/data-index.json.ts, src/pages/career-paths/[path]/data.json.ts, src/pages/career-paths/[path]/data-index.json.ts
Data Consumption
The primary consumer of the certification data is the ReactiveDatatable component, which provides a searchable and paginated table of certifications.
ReactiveDatatable Loading Sequence
This diagram shows how the ReactiveDatatable component fetches data and initializes the search functionality.
Search Configuration
The client-side search is powered by Fuse.js. The search configuration defines which fields of the CertificationMetadata object are searchable and their relative importance (weight).
| Key | Weight |
|---|---|
title | 0.7 |
acronym | 0.6 |
aliases | 0.5 |
provider | 0.4 |
career_paths | 0.3 |
This configuration prioritizes matches in the title and acronym over other fields.