Skip to main content
doc0blade47/compdocumentation home
Sign in

Developer Tooling

Last updated Oct 11, 2026
Relevant source files

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.

Badge Icon Encoding Script

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.

Architecture and Data Flow

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

Key Components

  • 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 RegExp(`export const ${componentName} = \\(props.*?\\) => \\(\\s*(<svg[\\s\\S]*?<\\/svg>)\\s*\\);`, 's');
      const match = logosContent.match(regex);
      if (!match) {
        console.warn(`Warning: Could not find ${componentName}`);
        return null;
      }
      return match[1]
        .replace(/\{props\}/g, '')
        .replace(/\{\.\.\.props\}/g, '')
        .trim();
    }
    Sources: apps/api/scripts/encode-badge-icons.ts:14-27
  • 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).
    • Examples: 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.

NestJS CLI Configuration

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.

Configuration Options

OptionDescriptionValue
$schemaJSON schema for validation of the configuration file.https://json.schemastore.org/nest-cli
collectionSpecifies the schematics collection to use for generating NestJS artifacts.@nestjs/schematics
sourceRootDefines the root directory where application source files reside.src
compilerOptionsOptions passed to the TypeScript compiler via the NestJS CLI.{ "deleteOutDir": true }
compilerOptions.deleteOutDirIf true, the output directory (dist by default) is deleted before each build.true
Sources: apps/api/nest-cli.json:1-6

Project Dependencies and Scripts

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.

Dependencies

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

Scripts

The scripts section defines various command-line shortcuts for common tasks. These scripts automate repetitive actions, ensuring consistency across development environments.

  1. Build Operations

    The build scripts compile the NestJS application. The build:docker script includes a Prisma generation step, essential for containerized environments.

  2. Database Management

    Scripts for generating Prisma client, getting database schemas, and running migrations. The db:getschema script combines schemas from a shared package.

  3. Development & Debugging

    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.

  4. Testing

    A comprehensive set of scripts for running unit, integration, and end-to-end tests, including coverage reports and debugging options.

  5. Code Quality

    Scripts for formatting code with Prettier and linting with ESLint to maintain consistent code style and identify potential issues.

  6. Deployment

    A specific script for deploying Trigger.dev workflows.

| Script Name | Command | Description | | :-------------------- | :---

Was this page helpful?