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 --yesCustomize in the configurator
Packages
| Package | Version | Type |
|---|---|---|
@angular/cdk | ^22.3.0 | runtime |
@angular/material | ^22.3.0 | runtime |
@tanstack/angular-query | ^5.108.4 | runtime |
@angular-eslint/builder | ^22.8.0 | dev |
@eslint/js | ^10.0.1 | dev |
@testing-library/angular | ^19.6.0 | dev |
@testing-library/dom | ^10.4.2 | dev |
@testing-library/jest-dom | ^8.0.0 | dev |
@testing-library/user-event | ^14.6.13 | dev |
angular-eslint | ^22.8.0 | dev |
eslint | ^10.15.0 | dev |
eslint-config-prettier | ^10.1.8 | dev |
jsdom | ^31.0.1 | dev |
prettier | ^3.10.1 | dev |
typescript-eslint | ^8.74.0 | dev |
vitest | ^5.1.1 | dev |
New files
dist .angular pnpm-lock.yaml package-lock.json yarn.lock bun.lock
{
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
}
// @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,
]);
[
"Angular 22",
"TypeScript",
"Angular Material",
"TanStack Query",
"Vitest",
"Testing Library",
"ESLint",
"Prettier"
]
/** 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();
}
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();
});
});
<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>
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,
}));
}
// 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%;
}
import "@testing-library/jest-dom/vitest";
{
"extends": "./tsconfig.json",
"compilerOptions": {
"types": ["vitest/globals"]
},
"include": ["src/**/*.d.ts", "src/**/*.spec.ts", "src/test-setup.ts"]
}
Changes to existing files
⋯ 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
⋯ 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)], };
+<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>
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
<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>
<section class="page"> <h1 class="title">my-app</h1> <app-counter />+ <app-stack-list /> </section>
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
⋯ 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
⋯ 87 unchanged lines background: #334155; } +.counter {+ min-width: 16rem;+ text-align: center;+}+ +.actions {+ justify-content: center;+ gap: 0.75rem;+}+
⋯ 3 unchanged lines "types": [] }, "include": ["src/**/*.ts"],+ "exclude": ["src/**/*.spec.ts", "src/test-setup.ts"]− "exclude": ["src/**/*.spec.ts"] }
⋯ 22 unchanged lines "references": [ { "path": "./tsconfig.app.json"+ },+ {+ "path": "./tsconfig.spec.json" } ] }⋯ 1 unchanged lines
Project files
.gitignore.prettierignore.prettierrcREADME.mdangular.jsoneslint.config.jspackage.jsonpublic/robots.txtpublic/stack.jsonsrc/app/api/stack.tssrc/app/app.config.tssrc/app/app.htmlsrc/app/app.routes.tssrc/app/app.tssrc/app/components/counter/counter.htmlsrc/app/components/counter/counter.spec.tssrc/app/components/counter/counter.tssrc/app/components/stack-list/stack-list.htmlsrc/app/components/stack-list/stack-list.tssrc/app/pages/about/about.htmlsrc/app/pages/about/about.tssrc/app/pages/home/home.htmlsrc/app/pages/home/home.tssrc/index.htmlsrc/main.tssrc/material-theme.scsssrc/styles.csssrc/test-setup.tstsconfig.app.jsontsconfig.jsontsconfig.spec.json