pickstack

Angular + Material starter

Angular Material, TanStack Query, Vitest. A tested combination you can create in one command and keep extending.

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

Packages

PackageVersionType
@angular/cdk^22.3.0runtime
@angular/material^22.3.0runtime
@tanstack/angular-query^5.108.4runtime
@angular-eslint/builder^22.8.0dev
@eslint/js^10.0.1dev
@testing-library/angular^19.6.0dev
@testing-library/dom^10.4.2dev
@testing-library/jest-dom^8.0.0dev
@testing-library/user-event^14.6.13dev
angular-eslint^22.8.0dev
eslint^10.15.0dev
eslint-config-prettier^10.1.8dev
jsdom^31.0.1dev
prettier^3.10.1dev
typescript-eslint^8.74.0dev
vitest^5.1.1dev

New files

.prettierignore
dist
.angular
pnpm-lock.yaml
package-lock.json
yarn.lock
bun.lock
.prettierrc
{
  "overrides": [
    {
      "files": "*.html",
      "options": {
        "parser": "angular"
      }
    }
  ]
}
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,
]);
public/stack.json
[
  "Angular 22",
  "TypeScript",
  "Angular Material",
  "TanStack Query",
  "Vitest",
  "Testing Library",
  "ESLint",
  "Prettier"
]
src/app/api/stack.ts
/** Loads the stack list served from `public/stack.json`. */
export async function fetchStack(): Promise<string[]> {
  const response = await fetch("stack.json");
  if (!response.ok) throw new Error(`Request failed: ${response.status}`);
  return response.json();
}
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();
  });
});
src/app/components/stack-list/stack-list.html
<p class="text">
  @if (stack.isPending()) {
    Loading…
  } @else if (stack.isError()) {
    Could not load the stack.
  } @else if (stack.data(); as data) {
    Built with {{ data.join(", ") }}.
  }
</p>
src/app/components/stack-list/stack-list.ts
import { Component } from "@angular/core";
import { injectQuery } from "@tanstack/angular-query";
import { fetchStack } from "../../api/stack";

@Component({
  selector: "app-stack-list",
  templateUrl: "./stack-list.html",
})
export class StackList {
  protected readonly stack = injectQuery(() => ({
    queryKey: ["stack"],
    queryFn: fetchStack,
  }));
}
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%;
}
src/test-setup.ts
import "@testing-library/jest-dom/vitest";
tsconfig.spec.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "types": ["vitest/globals"]
  },
  "include": ["src/**/*.d.ts", "src/**/*.spec.ts", "src/test-setup.ts"]
}

Changes to existing files

angular.json (changed)
⋯ 2 unchanged lines   "version": 1,   "cli": {     "packageManager": "npm",+    "analytics": false,+    "schematicCollections": ["angular-eslint"]−    "analytics": false   },   "newProjectRoot": "projects",   "projects": {⋯ 15 unchanged lines                 "input": "public"               }             ],+            "styles": ["src/material-theme.scss", "src/styles.css"]−            "styles": ["src/styles.css"]           },           "configurations": {             "production": {⋯ 30 unchanged lines             }           },           "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"]+          }         }       }     }⋯ 3 unchanged lines
src/app/app.config.ts (changed)
⋯ 2 unchanged lines   provideBrowserGlobalErrorListeners, } from "@angular/core"; import { provideRouter } from "@angular/router";+import { provideTanStackQuery, QueryClient } from "@tanstack/angular-query"; import { routes } from "./app.routes";   export const appConfig: ApplicationConfig = {+  providers: [+    provideBrowserGlobalErrorListeners(),+    provideRouter(routes),+    provideTanStackQuery(() => new QueryClient()),+  ],−  providers: [provideBrowserGlobalErrorListeners(), provideRouter(routes)], };  
src/app/components/counter/counter.html (changed)
+<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>−<div class="card">−  <p class="count">{{ count() }}</p>−  <div class="row">−    <button type="button" class="btn" (click)="decrement()">-1</button>−    <button type="button" class="btn" (click)="increment()">+1</button>−  </div>−</div>  
src/app/components/counter/counter.ts (changed)
 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 {⋯ 11 unchanged lines
src/app/pages/about/about.html (changed)
 <section class="page">   <h1 class="title">About</h1>+  <p class="text">+    Built with Angular 22, TypeScript, Angular Material, TanStack Query, Vitest,+    Testing Library, ESLint, Prettier.+  </p>−  <p class="text">Built with Angular 22, TypeScript.</p> </section>  
src/app/pages/home/home.html (changed)
 <section class="page">   <h1 class="title">my-app</h1>   <app-counter />+  <app-stack-list /> </section>  
src/app/pages/home/home.ts (changed)
 import { Component } from "@angular/core"; import { Counter } from "../../components/counter/counter";+import { StackList } from "../../components/stack-list/stack-list";   @Component({   selector: "app-home",+  imports: [Counter, StackList],−  imports: [Counter],   templateUrl: "./home.html", }) export class Home {}⋯ 1 unchanged lines
src/index.html (changed)
⋯ 4 unchanged lines     <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>⋯ 3 unchanged lines
src/styles.css (changed)
⋯ 87 unchanged lines   background: #334155; }  +.counter {+  min-width: 16rem;+  text-align: center;+}+ +.actions {+  justify-content: center;+  gap: 0.75rem;+}+ 
tsconfig.app.json (changed)
⋯ 3 unchanged lines     "types": []   },   "include": ["src/**/*.ts"],+  "exclude": ["src/**/*.spec.ts", "src/test-setup.ts"]−  "exclude": ["src/**/*.spec.ts"] }  
tsconfig.json (changed)
⋯ 22 unchanged lines   "references": [     {       "path": "./tsconfig.app.json"+    },+    {+      "path": "./tsconfig.spec.json"     }   ] }⋯ 1 unchanged lines

Project files

Related templates