Skip to Content
Apso is in public beta. Get started
GuidesFrameworksTypeScript (NestJS)Overview

TypeScript and NestJS

Choose TypeScript when your team wants a NestJS service with TypeORM, class-validator, Jest, and Swagger/OpenAPI. Apso generates ordinary framework source that can run without an Apso runtime dependency.

Create the service

apso init --name project-api --language typescript --skip-platform cd project-api

To link the project to Apso Cloud during initialization, run apso login and remove --skip-platform.

Configure local development

Use PGlite for the shortest local path:

.env
DATABASE_TYPE=pglite DATABASE_SYNC=true APP_PORT=3100

Generate and run the service:

apso schema validate apso generate apso dev

Open http://localhost:3100/_docs and exercise the generated routes.

Project structure

project-api/ ├── .apsorc ├── .env ├── package.json └── src/ ├── autogen/ # Generated entities, DTOs, services, controllers, modules ├── extensions/ # Product-specific logic preserved across generation ├── config/ # Application, database, HTTP, and OpenAPI setup ├── migrations/ # Reviewed database changes ├── app.module.rest.ts ├── main.ts └── orm.config.ts

The generated entity folders use the entity names from .apsorc. Route names are plural and case-preserving, such as /Projects and /Tasks.

Common commands

TaskCommand
Start with file watchingapso dev or npm run start:dev
Generate framework layersapso generate
Validate the schemaapso schema validate
Test a migration locallyapso migrate
Run unit testsnpm test
Run end-to-end testsnpm run test:e2e
Check lintnpm run lint
Build production outputnpm run build
Run TypeORM migrationsnpm run db:migrate

Add product logic

Keep generated CRUD layers under src/autogen/. Add custom controllers, services, integrations, and hooks under src/extensions/, then register them through the extension module pattern used by the generated project.

Do not make product changes directly in src/autogen/. Run apso generate after schema changes and expect those files to be replaced.

Production boundary

The output is a NestJS application. You can deploy it through Apso Cloud, build its Dockerfile, or use the standard NestJS build and process model in your own infrastructure. Commit .apsorc, generated source, migrations, extensions, package manifests, and tests.

Next steps

Last updated on