@hyperfrontend/project-scope/tech/backend

backend

Backend-framework detectors for Node.js HTTP frameworks.

Covers Express, NestJS, Fastify, Koa, and Hono. Each individual detector (expressDetector, nestDetector, fastifyDetector, koaDetector, honoDetector) follows the shared BackendDetector shape and produces a BackendDetection with confidence and evidence. detectBackendFrameworks runs them all against a project and returns the aggregate. Used by the cross-cutting heuristics/framework module to assemble the full stack picture.

API Reference

ƒ Functions

§function

detectBackendFrameworks(projectPath: string, packageJson?: PackageJson): BackendDetection[]

Detect all backend frameworks in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection[]
Array of detected frameworks, sorted by confidence

Example

Detecting multiple backend frameworks

const pkg = {
  dependencies: { '@nestjs/core': '^10.0.0', '@nestjs/common': '^10.0.0' },
  devDependencies: { express: '^4.18.0' },
}

const results = detectBackendFrameworks('/path/to/project', pkg)
// => [
//   { id: 'nestjs', name: 'NestJS', confidence: 85, ... },
//   { id: 'express', name: 'Express', confidence: 80, ... },
// ]
§function

expressDetector(projectPath: string, packageJson?: PackageJson): BackendDetection

Detect Express in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection
Detection result or null if not detected

Example

Detecting Express framework

const pkg = {
  dependencies: { express: '^4.18.2', cors: '^2.8.5' },
  devDependencies: { '@types/express': '^4.17.17' },
}

const result = expressDetector('/path/to/project', pkg)
// => {
//   id: 'express',
//   name: 'Express',
//   version: '4.18.2',
//   confidence: 100,
//   detectedFrom: [
//     { type: 'package.json', field: 'dependencies.express' },
//     { type: 'package.json', field: 'dependencies.@types/express' },
//     { type: 'package.json', field: 'dependencies (express middleware)' },
//   ],
// }
§function

fastifyDetector(projectPath: string, packageJson?: PackageJson): BackendDetection

Detect Fastify in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection
Detection result or null if not detected

Example

Detecting Fastify framework

const pkg = {
  dependencies: { fastify: '^4.24.0', '@fastify/cors': '^8.4.0' },
}

const result = fastifyDetector('/path/to/project', pkg)
// => {
//   id: 'fastify',
//   name: 'Fastify',
//   version: '4.24.0',
//   confidence: 95,
//   detectedFrom: [
//     { type: 'package.json', field: 'dependencies.fastify' },
//     { type: 'package.json', field: 'dependencies (fastify plugins)' },
//   ],
// }
§function

honoDetector(projectPath: string, packageJson?: PackageJson): BackendDetection

Detect Hono in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection
Detection result or null if not detected

Example

Detecting Hono framework

const pkg = {
  dependencies: { hono: '^3.11.0', '@hono/node-server': '^1.3.0' },
}

const result = honoDetector('/path/to/project', pkg)
// => {
//   id: 'hono',
//   name: 'Hono',
//   version: '3.11.0',
//   confidence: 100,
//   detectedFrom: [
//     { type: 'package.json', field: 'dependencies.hono' },
//     { type: 'package.json', field: 'dependencies (@hono adapters)' },
//   ],
// }
§function

koaDetector(projectPath: string, packageJson?: PackageJson): BackendDetection

Detect Koa in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection
Detection result or null if not detected

Example

Detecting Koa framework

const pkg = {
  dependencies: { koa: '^2.14.2', 'koa-router': '^12.0.0' },
  devDependencies: { '@types/koa': '^2.13.9' },
}

const result = koaDetector('/path/to/project', pkg)
// => {
//   id: 'koa',
//   name: 'Koa',
//   version: '2.14.2',
//   confidence: 100,
//   detectedFrom: [
//     { type: 'package.json', field: 'dependencies.koa' },
//     { type: 'package.json', field: 'dependencies.@types/koa' },
//     { type: 'package.json', field: 'dependencies (koa middleware)' },
//   ],
// }
§function

nestDetector(projectPath: string, packageJson?: PackageJson): BackendDetection

Detect NestJS in project.

Parameters

NameTypeDescription
§projectPath
string
Project directory path
§packageJson?
PackageJson
Optional pre-loaded package.json

Returns

BackendDetection
Detection result or null if not detected

Example

Detecting NestJS framework

// Project with nest-cli.json and NestJS packages
const pkg = {
  dependencies: {
    '@nestjs/core': '^10.2.0',
    '@nestjs/common': '^10.2.0',
    '@nestjs/platform-express': '^10.2.0',
  },
}

const result = nestDetector('/path/to/nest-project', pkg)
// => {
//   id: 'nestjs',
//   name: 'NestJS',
//   version: '10.2.0',
//   configPath: 'nest-cli.json',  // if present
//   confidence: 100,
//   detectedFrom: [
//     { type: 'package.json', field: 'dependencies.@nestjs/core' },
//     { type: 'package.json', field: 'dependencies.@nestjs/common' },
//     { type: 'config-file', path: 'nest-cli.json' },
//     { type: 'package.json', field: 'dependencies (@nestjs packages)' },
//   ],
// }

Interfaces

§interface

BackendDetection

Backend framework detection result.

Properties

§confidence:number
Detection confidence (0-100)
§configPath?:string
Config file path
§detectedFrom:DetectionSource[]
Detection sources
§id:string
Framework identifier
§name:string
Human-readable name
§version?:string
Detected version
§interface

BackendDetector

Backend detector interface.

Properties

§id:string
Framework identifier
§name:string
Human-readable name

Variables

§type

backendDetectors

All backend framework detectors