API: Career Path Endpoints
Relevant source files
The following files were used as context for generating this wiki page:The Career Path API endpoints are a set of dynamic server-side routes within the Astro framework responsible for delivering certification data tailored to specific cybersecurity career paths. These endpoints generate JSON responses that are consumed by front-end components to display lists of relevant certifications.
There are two primary endpoints for each career path: one that provides the raw certification data and another that provides a pre-computed search index for that data, optimizing client-side search functionality. These endpoints are generated statically at build time for each defined career path.
Architecture Overview
The system uses Astro's file-based dynamic routing. The [path] in the file names src/pages/career-paths/[path]/... acts as a dynamic parameter. At build time, Astro's getStaticPaths function generates a unique URL for each career path. When a request hits one of these URLs, the corresponding GET handler fetches certification data from the content collection, filters it based on the career path, and returns it as a JSON payload.
The following diagram illustrates the overall request flow for fetching career path data.
Career Path Definitions
All available career paths are defined in a constant array CareerPathsList. This list is the single source of truth for career path names throughout the application.
Sources: src/lib/career-paths.ts:17-30
Available Career Paths
| Career Path Name |
|---|
| Blue Team Specialist |
| Cloud Security Specialist |
| Cybersecurity Manager |
| Malware Developer |
| OSINT Specialist |
| Penetration Tester |
| Red Team Specialist |
| Risk Management Specialist |
| Security Operations Specialist |
| Threat Hunter |
A special constant, CAREER_PATH_SPECIAL_HIDDEN, is defined with the value __HIDDEN__. This is used to filter out a placeholder entry and is not exposed as a public API path.
Sources: src/lib/career-paths.ts:14, src/pages/career-paths/[path]/data.json.ts:13-15
Static Path Generation
The getStaticPaths function is used by Astro to determine which routes to pre-render at build time. It iterates over CareerPathsList, converts each name to a URL-friendly kebab-case string (e.g., "Blue Team Specialist" becomes "blue-team-specialist"), and creates a route parameter object for each one.
Sources: src/pages/career-paths/[path]/data.json.ts:12-24
// src/pages/career-paths/[path]/data.json.ts:12-24
export function getStaticPaths() {
const career_paths: CareerPathCollection = CareerPathsList.filter((entry) => {
return entry !== CAREER_PATH_SPECIAL_HIDDEN;
});
const kebab_career_paths = career_paths.map((career_path) => {
return dash(career_path);
});
return kebab_career_paths.map((path) => ({
params: {
path,
},
}));
}
A helper function, makeCareerPathLookupTable, creates a mapping from the kebab-case path back to the original career path name (e.g., { "blue-team-specialist": "Blue Team Specialist" }). This is used by the GET handlers to identify which career path's data to fetch.
Sources: src/pages/career-paths/[path]/data.json.ts:26-36
API Endpoints
GET /career-paths/[path]/data.json
This endpoint returns a JSON array of all certification metadata associated with a specific career path.
Request Flow
The following sequence diagram shows the process for handling a request to this endpoint.
Response Body
The response is a JSON array where each object conforms to the CertificationMetadata interface.
Sources: src/types/certification-metadata.ts
| Field | Type | Description |
|---|---|---|
image | string | URL path to the certification's image. |
provider | string | The name of the certification provider, title-cased. |
title | string | The full title of the certification. |
acronym | string | The acronym for the certification. |
last_updated_at | Date | The date the certification information was last updated. |
reference | string | A URL to the official certification page. |
aliases | string[] | (Optional) An array of alternative names or acronyms. |
career_paths | string[] | An array of career paths this certification is relevant to. |
price | string | The price of the certification, formatted as a string. |
currency | string | The currency for the price (e.g., "USD"). |
slug | string | The unique slug for the certification page (e.g., comptia/network+). |
GET /career-paths/[path]/data-index.json
This endpoint returns a pre-computed Fuse.js search index for the certifications within a specific career path. This allows for efficient client-side searching without needing to load and index the full dataset in the browser.
Request Flow
This index is consumed by front-end components like ReactiveDatatable to power the search functionality.
Sources: src/components/astro/database/reactive-datatable.tsx:168-176
Core Data and Schema
Certification Data Source
The underlying data for all certifications is stored as Markdown files (.md/.mdx) within the src/content/certifications/ directory. Astro's content collections feature is used to query this data.
Sources: src/content.config.ts:6
Certification Schema
The frontmatter of each certification Markdown file must adhere to a schema defined using Zod. This ensures data consistency.
The following diagram shows the relationship between a certification and its career paths.
This ER diagram represents the schema defined in src/content.config.ts.
Sources: src/content.config.ts:5-20
The schema is defined as follows:
| Field | Zod Type | Description |
|---|---|---|
title | z.string() | The full title of the certification. |
acronym | z.string() | The common acronym for the certification. |
last_updated_at | z.date() | Date of the last update to the content. |
image | image() | An optimized image asset for the certification. |
reference | z.string() | A URL to the official source. |
aliases | z.array(z.string()) | Optional array of alternative names. |
draft | z.boolean() | A flag to exclude the entry from production builds. |
career_paths | z.array(z.enum(...)) | An array of associated career paths from CareerPathsList. |
price | z.string() | The cost of the certification. |
currency | z.string() | The currency of the price. |
Sources: src/content.config.ts:8-19
Data Retrieval Function
The getCertificationMetadata function is the central utility for fetching and transforming certification data from the content collection. It filters out drafts, applies an optional additional filter (used here for career paths), and maps the raw collection entry to the clean CertificationMetadata type.
Sources: src/pages/database/data.json.ts:8-28