pickstack

Full-stack: Angular + NestJS starter

Angular Material and a NestJS API: modules, DI and decorators on both sides; web/ and server/ side by side. A tested combination you can create in one command and keep extending.

$ npm create pickstack@latest my-app -- --framework angular --modules nestjs,angular-material,vitest,testing-library,eslint,prettier --yes
Customize in the configurator

New files

server/.env.example
PORT=3001
server/.gitignore
node_modules
dist
.env
server/nest-cli.json
{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "deleteOutDir": true
  }
}
server/package.json
{
  "name": "my-app-server",
  "private": true,
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "dev": "nest start --watch --exec \"node --env-file-if-exists=.env\"",
    "build": "nest build",
    "start": "node --env-file-if-exists=.env dist/main",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@nestjs/common": "^12.6.2",
    "@nestjs/core": "^12.6.2",
    "@nestjs/platform-express": "^12.6.2",
    "reflect-metadata": "^0.2.2",
    "rxjs": "~7.8.2"
  },
  "devDependencies": {
    "@nestjs/cli": "^12.0.15",
    "@nestjs/schematics": "^12.0.16",
    "@types/express": "^5.0.6",
    "@types/node": "^24.19.2",
    "tslib": "^2.9.1",
    "typescript": "~6.0.3"
  },
  "engines": {
    "node": ">=22.12.0"
  }
}
server/README.md
# my-app-server

NestJS API on port 3001. Copy `.env.example` to `.env` to change settings.

```bash
npm install
npm run dev
```
server/src/app.controller.ts
import { Controller, Get, Query } from "@nestjs/common";
import { AppService } from "./app.service.js";

@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get("health")
  health(): { ok: boolean } {
    return { ok: true };
  }

  @Get("hello")
  hello(@Query("name") name?: string): { message: string } {
    return { message: this.appService.greet(name ?? "world") };
  }
}
server/src/app.module.ts
import { Module } from "@nestjs/common";
import { AppController } from "./app.controller.js";
import { AppService } from "./app.service.js";

@Module({
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
server/src/app.service.ts
import { Injectable } from "@nestjs/common";

@Injectable()
export class AppService {
  greet(name: string): string {
    return `Hello, ${name}!`;
  }
}
server/src/main.ts
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module.js";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix("api");
  const port = Number(process.env.PORT ?? 3001);
  await app.listen(port);
  console.log(`API listening on http://localhost:${port}`);
}
await bootstrap();
server/tsconfig.build.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "rootDir": "./src"
  },
  "include": ["src"],
  "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}
server/tsconfig.json
{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "nodenext",
    "resolvePackageJsonExports": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2023",
    "sourceMap": true,
    "outDir": "./dist",
    "incremental": true,
    "skipLibCheck": true,
    "strict": true,
    "strictPropertyInitialization": false,
    "types": ["node"]
  }
}
web/.gitignore
node_modules
dist
.angular
.env
.env.local
.DS_Store
web/.prettierignore
dist
.angular
pnpm-lock.yaml
package-lock.json
yarn.lock
bun.lock
web/.prettierrc
{
  "overrides": [
    {
      "files": "*.html",
      "options": {
        "parser": "angular"
      }
    }
  ]
}
web/angular.json
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "packageManager": "npm",
    "analytics": false,
    "schematicCollections": ["angular-eslint"]
  },
  "newProjectRoot": "projects",
  "projects": {
    "my-app": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular/build:application",
          "options": {
            "browser": "src/main.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "public"
              }
            ],
            "styles": ["src/material-theme.scss", "src/styles.css"]
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kB",
                  "maximumError": "1MB"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "4kB",
                  "maximumError": "8kB"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "optimization": false,
              "extractLicenses": false,
              "sourceMap": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular/build:dev-server",
          "options": {
            "proxyConfig": "proxy.conf.json"
          },
          "configurations": {
            "production": {
              "buildTarget": "my-app:build:production"
            },
            "development": {
              "buildTarget": "my-app:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "test": {
          "builder": "@angular/build:unit-test",
          "options": {
            "setupFiles": ["src/test-setup.ts"]
          }
        },
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
          }
        }
      }
    }
  }
}
web/eslint.config.js
// @ts-check
import eslint from "@eslint/js";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import angular from "angular-eslint";
import eslintConfigPrettier from "eslint-config-prettier/flat";

export default defineConfig([
  {
    files: ["**/*.ts"],
    extends: [
      eslint.configs.recommended,
      tseslint.configs.recommended,
      tseslint.configs.stylistic,
      angular.configs.tsRecommended,
    ],
    processor: angular.processInlineTemplates,
    rules: {
      "@angular-eslint/directive-selector": [
        "error",
        { type: "attribute", prefix: "app", style: "camelCase" },
      ],
      "@angular-eslint/component-selector": [
        "error",
        { type: "element", prefix: "app", style: "kebab-case" },
      ],
    },
  },
  {
    files: ["**/*.html"],
    extends: [
      angular.configs.templateRecommended,
      angular.configs.templateAccessibility,
    ],
    rules: {},
  },
  eslintConfigPrettier,
]);
web/package.json
{
  "name": "my-app",
  "private": true,
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "ng": "ng",
    "dev": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "typecheck": "ngc -p tsconfig.app.json --noEmit",
    "test": "ng test --watch=false",
    "lint": "ng lint",
    "format": "prettier --write .",
    "format:check": "prettier --check ."
  },
  "dependencies": {
    "@angular/cdk": "^22.3.0",
    "@angular/common": "^22.3.0",
    "@angular/compiler": "^22.3.0",
    "@angular/core": "^22.3.0",
    "@angular/forms": "^22.3.0",
    "@angular/material": "^22.3.0",
    "@angular/platform-browser": "^22.3.0",
    "@angular/router": "^22.3.0",
    "rxjs": "~7.8.2",
    "tslib": "^2.9.1"
  },
  "devDependencies": {
    "@angular-eslint/builder": "^22.8.0",
    "@angular/build": "^22.3.0",
    "@angular/cli": "^22.3.0",
    "@angular/compiler-cli": "^22.3.0",
    "@eslint/js": "^10.0.1",
    "@testing-library/angular": "^19.6.0",
    "@testing-library/dom": "^10.4.2",
    "@testing-library/jest-dom": "^8.0.0",
    "@testing-library/user-event": "^14.6.13",
    "angular-eslint": "^22.8.0",
    "eslint": "^10.15.0",
    "eslint-config-prettier": "^10.1.8",
    "jsdom": "^31.0.1",
    "prettier": "^3.10.1",
    "typescript": "~6.0.3",
    "typescript-eslint": "^8.74.0",
    "vitest": "^5.1.1"
  }
}
web/proxy.conf.json
{
  "/api": {
    "target": "http://localhost:3001",
    "secure": false
  }
}
web/public/robots.txt
User-agent: *
Disallow:
web/README.md
# my-app

Stack: Angular 22, TypeScript, Angular Material, NestJS, Vitest, Testing Library, ESLint, Prettier.

## Getting started

```bash
npm install
npm run dev
```

## Scripts

- `npm run ng`
- `npm run build`
- `npm run watch`
- `npm run typecheck`
- `npm run test`
- `npm run lint`
- `npm run format`
- `npm run format:check`

## API

The API lives in `../server` (NestJS). Start it with `npm run dev` there; requests to `/api` from this app are proxied to it in development.

## Push to GitHub

Create an empty repository on GitHub, then:

```bash
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<your-username>/my-app.git
git push -u origin main
```
web/src/app/app.config.ts
import {
  type ApplicationConfig,
  provideBrowserGlobalErrorListeners,
} from "@angular/core";
import { provideRouter } from "@angular/router";
import { routes } from "./app.routes";

export const appConfig: ApplicationConfig = {
  providers: [provideBrowserGlobalErrorListeners(), provideRouter(routes)],
};
web/src/app/app.html
<main class="app">
  <nav class="nav">
    <a class="link" routerLink="/">Home</a>
    <a class="link" routerLink="/about">About</a>
  </nav>
  <router-outlet />
</main>
web/src/app/app.routes.ts
import type { Routes } from "@angular/router";
import { Home } from "./pages/home/home";

export const routes: Routes = [
  { path: "", component: Home },
  {
    path: "about",
    loadComponent: () => import("./pages/about/about").then((m) => m.About),
  },
];
web/src/app/app.ts
import { Component } from "@angular/core";
import { RouterLink, RouterOutlet } from "@angular/router";

@Component({
  selector: "app-root",
  imports: [RouterLink, RouterOutlet],
  templateUrl: "./app.html",
})
export class App {}
web/src/app/components/api-greeting/api-greeting.ts
import { Component, signal } from "@angular/core";

@Component({
  selector: "app-api-greeting",
  template: `<p class="text">{{ message() }}</p>`,
})
export class ApiGreeting {
  protected readonly message = signal("Calling the API…");

  constructor() {
    fetch("/api/hello?name=my-app")
      .then((response) => {
        if (!response.ok) throw new Error(`HTTP ${response.status}`);
        return response.json();
      })
      .then((data) => this.message.set(data.message))
      .catch(() =>
        this.message.set("The API isn't running: start it in server/."),
      );
  }
}
web/src/app/components/counter/counter.html
<mat-card appearance="outlined" class="counter">
  <mat-card-header>
    <mat-card-title>Counter</mat-card-title>
  </mat-card-header>
  <mat-card-content>
    <p class="count">{{ count() }}</p>
  </mat-card-content>
  <mat-card-actions class="actions">
    <button matButton="outlined" type="button" (click)="decrement()">-1</button>
    <button matButton="filled" type="button" (click)="increment()">+1</button>
  </mat-card-actions>
</mat-card>
web/src/app/components/counter/counter.spec.ts
import { render, screen } from "@testing-library/angular";
import userEvent from "@testing-library/user-event";
import { Counter } from "./counter";

describe("Counter", () => {
  it("increments when +1 is clicked", async () => {
    const user = userEvent.setup();
    await render(Counter);

    await user.click(screen.getByRole("button", { name: "+1" }));

    expect(screen.getByText("1")).toBeInTheDocument();
  });
});
web/src/app/components/counter/counter.ts
import { Component, signal } from "@angular/core";
import { MatButton } from "@angular/material/button";
import {
  MatCard,
  MatCardActions,
  MatCardContent,
  MatCardHeader,
  MatCardTitle,
} from "@angular/material/card";

@Component({
  selector: "app-counter",
  imports: [
    MatButton,
    MatCard,
    MatCardActions,
    MatCardContent,
    MatCardHeader,
    MatCardTitle,
  ],
  templateUrl: "./counter.html",
})
export class Counter {
  protected readonly count = signal(0);

  protected increment(): void {
    this.count.update((value) => value + 1);
  }

  protected decrement(): void {
    this.count.update((value) => value - 1);
  }
}
web/src/app/pages/about/about.html
<section class="page">
  <h1 class="title">About</h1>
  <p class="text">
    Built with Angular 22, TypeScript, Angular Material, NestJS, Vitest, Testing
    Library, ESLint, Prettier.
  </p>
</section>
web/src/app/pages/about/about.ts
import { Component } from "@angular/core";

@Component({
  selector: "app-about",
  templateUrl: "./about.html",
})
export class About {}
web/src/app/pages/home/home.html
<section class="page">
  <h1 class="title">my-app</h1>
  <app-counter />
  <app-api-greeting />
</section>
web/src/app/pages/home/home.ts
import { Component } from "@angular/core";
import { ApiGreeting } from "../../components/api-greeting/api-greeting";
import { Counter } from "../../components/counter/counter";

@Component({
  selector: "app-home",
  imports: [Counter, ApiGreeting],
  templateUrl: "./home.html",
})
export class Home {}
web/src/index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>my-app</title>
    <base href="/" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link
      href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
      rel="stylesheet"
    />
    <link
      href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined"
      rel="stylesheet"
    />
  </head>
  <body>
    <app-root></app-root>
  </body>
</html>
web/src/main.ts
import { bootstrapApplication } from "@angular/platform-browser";
import { App } from "./app/app";
import { appConfig } from "./app/app.config";

bootstrapApplication(App, appConfig).catch((err) => console.error(err));
web/src/material-theme.scss
// Include theming for Angular Material with `mat.theme()`.
// This Sass mixin will define CSS variables that are used for styling Angular Material
// components according to the Material 3 design spec.
// Learn more about theming and how to use it for your application's
// custom components at https://material.angular.dev/guide/theming
@use "@angular/material" as mat;

html {
  height: 100%;
  @include mat.theme(
    (
      color: (
        primary: mat.$azure-palette,
        tertiary: mat.$blue-palette,
      ),
      typography: Roboto,
      density: 0,
    )
  );
}

body {
  // Default the application to a light color theme. This can be changed to
  // `dark` to enable the dark color theme, or to `light dark` to defer to the
  // user's system settings.
  color-scheme: light;

  // Set a default background, font and text colors for the application using
  // Angular Material's system-level CSS variables. Learn more about these
  // variables at https://material.angular.dev/guide/system-variables
  background-color: var(--mat-sys-surface);
  color: var(--mat-sys-on-surface);
  font: var(--mat-sys-body-medium);

  // Reset the user agent margin.
  margin: 0;
  height: 100%;
}
web/src/styles.css
:root {
  font-family: system-ui, sans-serif;
  color: #0f172a;
  background: #f8fafc;
}

body {
  margin: 0;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 2rem;
  box-sizing: border-box;
}

.title {
  font-size: 1.875rem;
  margin: 0;
}

.nav {
  display: flex;
  gap: 1rem;
}

.link {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  color: #0f172a;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.text {
  max-width: 28rem;
  text-align: center;
  color: #475569;
}

.card {
  background: #fff;
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.count {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.row {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  background: #0f172a;
  color: #fff;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font: inherit;
  cursor: pointer;
}

.btn:hover {
  background: #334155;
}

.counter {
  min-width: 16rem;
  text-align: center;
}

.actions {
  justify-content: center;
  gap: 0.75rem;
}
web/src/test-setup.ts
import "@testing-library/jest-dom/vitest";
web/tsconfig.app.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "types": []
  },
  "include": ["src/**/*.ts"],
  "exclude": ["src/**/*.spec.ts", "src/test-setup.ts"]
}
web/tsconfig.json
{
  "compileOnSave": false,
  "compilerOptions": {
    "strict": true,
    "noImplicitOverride": true,
    "noPropertyAccessFromIndexSignature": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "skipLibCheck": true,
    "isolatedModules": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "ES2022",
    "module": "preserve"
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  },
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    }
  ]
}
web/tsconfig.spec.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "types": ["vitest/globals"]
  },
  "include": ["src/**/*.d.ts", "src/**/*.spec.ts", "src/test-setup.ts"]
}

Project files

Related templates