Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Appendix A — Glossary: .NET Terms to JS/TS Terms

This table maps common .NET concepts, patterns, and tooling to their nearest equivalents in the modern JavaScript/TypeScript ecosystem. Entries are alphabetized by .NET term. Where no direct equivalent exists, the closest analog is listed with a clarifying note.


Full Mapping Table

.NET TermJS/TS EquivalentNotes
abstract classabstract class (TypeScript)TypeScript supports abstract natively. JS has no runtime enforcement — TS provides compile-time only.
Action / Func delegateFunction type literal / arrow function(x: number) => string is the TS equivalent of Func<int, string>.
ActionResult / IActionResultResponse (Web API) / return value + status code (NestJS)In NestJS, return the object and decorate with @HttpCode(). In Next.js, use NextResponse.
ADO.NETpg / mysql2 / better-sqlite3Low-level database driver packages. Equivalent raw SQL access layer.
API ControllerNestJS @Controller / Next.js Route HandlerNestJS uses class-based controllers. Next.js uses file-based route.ts exports.
appsettings.json.env / environment variablesdotenv loads .env files. Use zod or t3-env to validate and type env vars.
ASP.NET CoreExpress / Fastify / NestJS / Next.jsExpress is the closest analog. NestJS is the opinionated full-framework equivalent.
Assemblynpm package / ES moduleThe unit of distribution. Published via npm registry.
async / awaitasync / awaitIdentical syntax. JS async is single-threaded; no thread pool parallelism. Use Promise.all() for concurrency.
Attribute (C#)Decorator (@)TypeScript decorators are Stage 3. NestJS relies on them heavily. Behavior differs from C# attributes.
AutoMapperzod.transform() / plain mapping functions / ts-beltNo dominant library equivalent. Manual mapping functions or Zod schema transforms are idiomatic.
Background service / IHostedServiceWorker threads / BullMQ / setIntervalBullMQ (Redis-backed queues) is the production equivalent for background jobs.
BCrypt.Netbcrypt / argon2 npm packagesbcryptjs is pure JS. argon2 is preferred for new systems.
BlazorReact / Vue / SvelteBlazor (WASM) has no direct JS equivalent — it replaces JS with C#. React is the most comparable component model.
Build configuration (Debug/Release)NODE_ENV (development/production)Set via environment variable. Bundlers (Vite, webpack) tree-shake based on this value.
Builder patternMethod chaining / fluent APIsCommon in JS. Example: query.where(...).orderBy(...).limit(...) in Drizzle ORM.
Cancellation tokenAbortController / AbortSignalAbortController.signal is passed to fetch() and async operations for cancellation.
CQRS patternCQRS libraries / manual command/query separationNo dominant library. Nest has community CQRS module (@nestjs/cqrs). Often implemented manually.
Class library projectnpm package (local or published)A workspace package in a pnpm monorepo is the direct analog of a referenced class library.
ClaimsPrincipal / ClaimsJWT payload / session objectClaims live in the JWT payload or session store. Clerk, Auth.js expose typed user objects.
Code-first migrationsPrisma Migrate / Drizzle Kit push/generateBoth tools generate SQL migration files from the schema definition.
ConfigureServices (Startup)Module providers (NestJS) / middleware config (Express)NestJS @Module({ providers: [] }) is the DI registration point.
Connection stringDATABASE_URL environment variableConvention in the JS ecosystem. Prisma, Drizzle, and most ORMs read from DATABASE_URL.
Console applicationNode.js CLI script / tsx entrypointRun with node dist/index.js or tsx src/index.ts for ts-node style execution.
Controller (MVC)NestJS @Controller / Next.js Route Handler / Express routerDepends on framework. NestJS is the most direct analog for class-based MVC.
CORS middlewarecors npm package / built-in framework optionapp.use(cors({ origin: '...' })) in Express. NestJS has app.enableCors().
DateTime / DateTimeOffsetDate / Temporal (Stage 3) / dayjs / date-fnsJS Date is mutable and has quirks. date-fns or dayjs are standard libraries. Temporal is the modern replacement.
DbContext (EF Core)Prisma Client / Drizzle ORM instanceThe singleton database access object. Prisma Client is the direct analog.
DbSet<T>Prisma model accessor (prisma.user) / Drizzle table objectprisma.user.findMany() maps to dbContext.Users.ToList().
Decorator patternHigher-order functions / HOCs / class decoratorsHOFs are idiomatic in JS. Class-based decorators exist in TS/NestJS.
Dependency Injection (DI)NestJS DI container / manual constructor injectionNestJS has a full DI system. In plain Node/React, use module imports or React Context.
Dictionary<K,V>Map<K, V> / plain object Record<K, V>Map is the closest structural equivalent. Plain objects work for string keys.
dotnet CLInpm / pnpm / nest CLI / gh CLISee Appendix D for full command mapping.
dotnet ef (EF Core tools)prisma CLI / drizzle-kit CLIprisma migrate dev, drizzle-kit generate are the equivalent migration commands.
dotnet publishnpm run build / tsc / Vite buildProduces optimized output. For servers: tsc --outDir dist. For frontends: vite build.
dotnet restorepnpm installRestores/installs all declared dependencies.
dotnet runpnpm dev / tsx src/index.tsStarts the dev server with hot reload. tsx --watch for Node scripts.
dotnet testpnpm test / vitest run / jestRuns the test suite. Vitest is the modern standard.
dotnet watchnodemon / tsx --watch / vite dev serverFile watchers that restart on change. Vite’s HMR is near-instant.
DTOs (Data Transfer Objects)Zod schemas / TypeScript interfacesZod schemas validate at runtime and infer TS types. Interfaces are compile-time only.
Entity Framework CorePrisma / Drizzle ORM / TypeORMPrisma is the most popular. Drizzle is the lightweight, type-safe SQL alternative.
Enumconst enum / string union / enum (TS)Prefer string unions (`‘admin’
Environment (Development/Production)NODE_ENVSet at process start. process.env.NODE_ENV === 'production'.
Event sourcingEventStoreDB / custom event log in PostgreSQLNo dominant npm library. Community patterns exist using Postgres or Redis Streams.
ExceptionError / custom error subclassthrow new Error('message'). Custom errors: class NotFoundError extends Error {}.
Exception filterExpress error middleware / NestJS exception filterExpress: app.use((err, req, res, next) => {}). NestJS: @Catch() decorator.
Extension methodModule-level function / prototype extension (avoid)Idiomatic TS uses standalone utility functions. Prototype extension is discouraged.
FluentValidationZod / Yup / ValibotZod is dominant. Provides schema definition, parsing, and typed error messages.
Garbage CollectorV8 Garbage CollectorAutomatic. No manual control. Avoid memory leaks in closures and event listeners.
Generic type TGeneric type parameter <T>Identical syntax. TS generics are compile-time only; erased at runtime.
Guid / Guid.NewGuid()crypto.randomUUID() / uuid npm packagecrypto.randomUUID() is built into Node 19+. uuid package for older environments.
HttpClientfetch / axios / kyfetch is built into Node 18+. axios remains popular. ky is a modern wrapper.
HttpContextRequest / Response objectsExpress: req, res. Next.js: NextRequest, NextResponse. NestJS: injected via @Req().
IConfigurationprocess.env / t3-env / dotenvEnvironment variable access. t3-env adds Zod validation and TypeScript types.
IEnumerable<T>Iterable<T> / Array<T> / generator functionArrays are most common. Generators (function*) produce lazy iterables.
IHostBuilderNestJS NestFactory.create() / Express app initThe application bootstrap entry point.
ILogger / loggingpino / winston / consolapino is the highest-performance structured logger. consola for CLIs.
IMiddleware / middleware pipelineExpress middleware chain / NestJS middlewareapp.use(fn) in Express. NestJS has middleware, guards, interceptors, and pipes.
IOptions<T>Typed env config via t3-env or ZodNo built-in options pattern. t3-env provides the closest typed config experience.
IQueryable<T>Prisma query builder / Drizzle query builderLazy, chainable query builders. Not executed until awaited.
IServiceCollectionNestJS @Module({ providers })DI registration. NestJS modules declare what is injectable.
IServiceScopeNestJS request-scoped providers@Injectable({ scope: Scope.REQUEST }) creates a per-request provider instance.
Integration testSupertest + Vitest / Playwright API testssupertest sends HTTP requests to an Express/NestJS app in tests.
InterfaceTypeScript interface / type aliasTS interfaces are structural (duck typing). No runtime existence — compile-time only.
JWT (System.IdentityModel)jose / jsonwebtoken npm packagejose is the modern, Web Crypto-based library. jsonwebtoken is legacy but widely used.
LINQArray methods + Lodash / native array methodsmap, filter, reduce, find, some, every, flatMap. Lodash adds groupBy, orderBy, etc.
LINQ GroupByArray.prototype.reduce / lodash.groupBy / MapNo single built-in. Object.groupBy() landed in Node 21+ / ES2024.
LINQ SelectArray.prototype.map()Direct equivalent.
LINQ WhereArray.prototype.filter()Direct equivalent.
LINQ FirstOrDefaultArray.prototype.find()Returns undefined instead of null/default.
LINQ OrderByArray.prototype.sort() / lodash.orderByNative sort mutates in place. Use [...arr].sort() to avoid mutation.
List<T>Array<T>JS arrays are dynamic by default. No fixed-size array type.
Mediator pattern@nestjs/cqrs / custom event emitterEventEmitter in Node for basic pub/sub. NestJS CQRS module for formal mediator.
Memory cachelru-cache npm package / RedisIn-process cache: lru-cache. Distributed cache: Redis (via ioredis).
MiddlewareExpress middleware / NestJS middleware, guards, interceptorsExpress middleware is a function (req, res, next) => void.
Migration (EF Core)prisma migrate dev / drizzle-kit generateBoth generate SQL files tracked in source control.
Model bindingRequest body parsing / Zod parsingexpress.json() middleware parses JSON body. Zod validates and types the result.
Model validationZod / class-validator (NestJS)NestJS uses ValidationPipe + class-validator decorators for DTO validation.
MSTest / xUnit / NUnitVitest / JestVitest is the modern standard. API is compatible with Jest.
NamespaceES module (import/export)No direct equivalent. Modules replace namespaces. TypeScript namespace exists but is discouraged.
NuGetnpm registryPackage registry. pnpm add <package> installs from npm.
NuGet package referencepackage.json dependenciesDeclared in package.json. pnpm install resolves and installs.
Object initializer new Foo { Bar = 1 }Object literal { bar: 1 } / spreadTS uses plain object literals. Constructor call then property assignment is uncommon.
ORMPrisma / Drizzle / TypeORM / MikroORMPrisma and Drizzle are the modern choices. TypeORM is the legacy ActiveRecord-style option.
Pagination (manual)Cursor-based or offset pagination via ORMPrisma: take/skip for offset. cursor for keyset pagination.
Pattern matching (switch)switch / discriminated unions / match (ts-pattern)ts-pattern library provides exhaustive pattern matching similar to C# switch expressions.
Polly (resilience)axios-retry / p-retry / cockatielcockatiel is the most feature-complete resilience library (circuit breaker, retry, timeout).
readonlyreadonly (TS) / as constTS readonly on properties. as const freezes object types to literals.
Record<string, T>Record<string, T>Identical. TS has the same Record utility type.
ReflectionNo direct equivalentJS has no runtime type metadata by default. reflect-metadata polyfill used by NestJS/TypeORM.
Repository patternService class / Prisma repository patternOften implemented as a service wrapping Prisma calls. No enforced interface.
Response cachingHTTP cache headers / Cache-Control / RedisSet Cache-Control headers. Next.js has built-in fetch caching. Redis for server-side response cache.
RouteAttribute / routingExpress app.get('/path', handler) / Next.js file-based routingNestJS: @Get(':id'). Next.js: file system routing (app/users/[id]/route.ts).
Scaffoldnest generate / shadcn/ui CLI / create-next-appCode generators. nest g resource scaffolds a full CRUD module.
Sealed classfinal class (TS 5.x not yet) / discriminated unionNo native sealed in TS. Discriminated unions prevent unintended extension at the type level.
Secret Manager.env files / cloud secret stores (Doppler, Vault)Never commit .env with secrets. Use GitHub Actions secrets or Doppler for CI/CD.
Serilog / structured loggingpino / winstonpino outputs JSON structured logs by default. Use pino-pretty for dev formatting.
SignalRSocket.IO / WebSockets (ws) / Server-Sent EventsSocket.IO is the closest analog. Native WebSocket API available in Node 22+.
Singleton lifetimeModule-level singleton / NestJS default scopeIn NestJS, providers are singleton by default. In Node, module exports are cached singletons.
Solution file (.sln)pnpm workspace (pnpm-workspace.yaml)Groups multiple projects. pnpm workspaces replace the solution file concept.
static classPlain module (.ts file)A TS module with exported functions is the idiomatic static class replacement.
String interpolation $"..."Template literal `${value}`Identical concept, different syntax.
Swagger / OpenAPI@nestjs/swagger / zod-openapi / swagger-ui-expressNestJS has first-class Swagger support. Zod schemas can generate OpenAPI specs.
Task<T>Promise<T>Direct equivalent. async functions return Promise. No ValueTask equivalent.
Thread / ThreadPoolWorker threads (worker_threads module)Node is single-threaded by default. CPU-bound work offloaded to Worker threads.
try/catch/finallytry/catch/finallyIdentical syntax. Async errors require await inside try blocks.
Transient lifetimeScope.TRANSIENT (NestJS)@Injectable({ scope: Scope.TRANSIENT }) creates a new instance per injection.
Tuple (int, string)Tuple [number, string] (TS)TS tuples are typed array literals. Used heavily in React hooks (useState returns a tuple).
Type inferenceType inferenceTS infers types from assignments and return values. Explicit annotation often unnecessary.
Unit testVitest test / Jest testdescribe / it / expect API. Vitest is Vite-native and faster than Jest.
using statement (IDisposable)try/finally / using declaration (TC39 Stage 3)JS Stage 3 using keyword mirrors C#. Until stable, use try/finally or explicit .close().
var / implicit typingconst / let (TS infers)Prefer const. TS infers type from initializer. var exists in JS but is avoided.
ValueObject patternBranded types / z.brand() in ZodZod .brand() creates nominal types. Branded types add type-level identity without runtime cost.
Vertical slice architectureFeature-folder structure in NestJS / Next.jsOrganizing code by feature (/users/users.controller.ts, /users/users.service.ts) rather than by layer.
View / Razor PageReact component / Vue SFC / Next.js page.tsx / .vue files are the view layer. Server components in Next.js 13+ blend view and data.
ViewBag / ViewDataProps / component state / query paramsData passed to components via props in React/Vue. No global ViewBag concept.
Web API projectNestJS application / Next.js API routesNestJS is the full-framework equivalent. Next.js app/api/ for lighter API routes.
xUnit [Fact] / [Theory]Vitest it() / it.each()it.each([...]) is the parameterized test equivalent of [Theory] + [InlineData].

Quick-Reference: Lifetime Scope Equivalents

.NET DI LifetimeNestJS EquivalentNotes
SingletonDefault (no scope specified)Module-level singleton, shared across all requests.
ScopedScope.REQUESTNew instance per HTTP request.
TransientScope.TRANSIENTNew instance per injection point.

Quick-Reference: Data Access Layer Equivalents

.NET / EF CorePrismaDrizzle ORM
DbContextPrismaClient instancedrizzle(connection) instance
DbSet<User>prisma.userdb.select().from(users)
SaveChangesAsync()Implicit per operationImplicit per query
Migrations folderprisma/migrations/drizzle/migrations/
Include() (eager load)include: { posts: true }.leftJoin(posts, ...)
FromSqlRaw()prisma.$queryRawsql\SELECT …`` template tag

Last updated: 2026-02-18