System Architecture
Core Features
Data Management
Frontend Components
Extensibility
The following files were used as context for generating this wiki page:
Developer tooling for the api application encompasses a suite of scripts, configurations, and dependencies designed to streamline development, build processes, and maintain code quality. This includes automated asset processing, project-specific CLI configurations, and a comprehensive set of development and production dependencies alongside various utility scripts for tasks like database management, testing, and deployment.
This page details the core components of the api application's developer tooling, providing insights into its structure and functionality.
The encode-badge-icons.ts script is a crucial utility for pre-processing static SVG assets. Its primary purpose is to extract SVG definitions of badge icons from a React component file, encode them as base64 data URLs, and then embed these data URLs into a TypeScript service file. This process optimizes the delivery of small icons by inlining them directly into the application's code, reducing HTTP requests.
The script operates by reading a source file containing SVG components, parsing their content, performing base64 encoding, and finally updating a target service file with the generated data.
This script is designed to be run manually or as part of a build process, indicated by its usage instruction: bun run apps/api/scripts/encode-badge-icons.ts.
Sources: apps/api/scripts/encode-badge-icons.ts:1-66
logos.tsx: The source file (located at ../../app/src/app/(app)/[orgId]/trust/portal-settings/components/logos.tsx) from which SVG definitions are extracted.extractSvg(componentName: string): A function that uses regular expressions to find and extract the SVG content corresponding to a given React component name within logos.tsx. It also cleans up props spread attributes from the SVG.
function extractSvg(componentName: string): string | null {
const regex = new
The nest-cli.json file configures the NestJS Command Line Interface (CLI) for the api application. This configuration dictates how the NestJS CLI interacts with the project, including source file locations and build options.
The package.json file for the api application defines its metadata, lists all required dependencies, and provides a set of scripts for various development, build, testing, and deployment tasks.
The api application relies on a wide array of packages for its functionality, ranging from core NestJS modules to database ORMs, cloud SDKs, AI tools, and utility libraries.
Sources: apps/api/package.json:5-104
The scripts section defines various command-line shortcuts for common tasks. These scripts automate repetitive actions, ensuring consistency across development environments.
The build scripts compile the NestJS application. The build:docker script includes a Prisma generation step, essential for containerized environments.
Scripts for generating Prisma client, getting database schemas, and running migrations. The db:getschema script combines schemas from a shared package.
Scripts for running the application in development mode, with watch functionality, and for debugging. The dev script uses concurrently to run both the NestJS API and Trigger.dev services simultaneously.
A comprehensive set of scripts for running unit, integration, and end-to-end tests, including coverage reports and debugging options.
| Script Name | Command | Description | | :-------------------- | :---
badges Array: An array of objects defining the specific badge icons to be processed. Each object includes name (component name in logos.tsx), type (key for the map), and label (human-readable name).
SOC2Type2, ISO27001, GDPR, HIPAA, PCIDSS.encodedBadges Map: An object that stores the final base64 encoded icon data URLs and their labels, keyed by the type property of each badge.trust-access.service.ts: The target service file (located at ../src/trust-portal/trust-access.service.ts) where the BADGE_ICON_MAP constant is updated.BADGE_ICON_MAP: A constant within trust-access.service.ts that holds the mapping of badge types to their encoded icon data and labels. The script dynamically generates and replaces this map.compilerOptions| Options passed to the TypeScript compiler via the NestJS CLI. |
{ "deleteOutDir": true } |
compilerOptions.deleteOutDir | If true, the output directory (dist by default) is deleted before each build. | true |
| Sources: apps/api/nest-cli.json:1-6 |
Scripts for formatting code with Prettier and linting with ESLint to maintain consistent code style and identify potential issues.
A specific script for deploying Trigger.dev workflows.