Skip to content

Commit 582942e

Browse files
authored
Feature/updates (#42)
* feat: add Playwright for end-to-end testing and LHCI for performance tracking - Added Playwright as a testing framework with configuration in playwright.config.ts - Introduced new npm scripts for end-to-end testing and performance tracking - Updated package.json with new dependencies and scripts for CI builds * feat(api): generate API service and models for posts and users - Added BaseService for common API functionality. - Implemented CRUD operations for posts: create, read, update, delete, and patch. - Implemented user retrieval by ID and all users. - Generated models for Post, User, Address, Company, Geo, and PostInput. - Created request builder for handling HTTP requests with parameters. - Updated ApiService to utilize generated services for user and post operations. * feat: refactor API interactions by implementing facade services for users and posts * feat(about): update profile image source to local asset and add alt text * Add OpenAPI drift check to CI and refresh generated client * Fix OpenAPI drift and align quality workflow with master * Regenerate OpenAPI client to match current generator output * feat: implement centralized branding configuration and update components to use branding service * feat: update branding colors and styles across components for a cohesive design
1 parent 9f6389a commit 582942e

File tree

66 files changed

+4845
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4845
-328
lines changed

.github/workflows/quality.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Quality Gates
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
smoke-and-lighthouse:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
cache: 'npm'
22+
23+
- name: Install dependencies
24+
run: npm ci --legacy-peer-deps
25+
26+
- name: Check OpenAPI generated client is up-to-date
27+
run: npm run openapi:check
28+
29+
- name: Install Playwright browser
30+
run: npx playwright install --with-deps chromium
31+
32+
- name: Run smoke tests
33+
run: npm run e2e:ci
34+
35+
- name: Run Lighthouse CI
36+
run: npm run lhci
37+
38+
- name: Upload Playwright report
39+
if: always()
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: playwright-report
43+
path: playwright-report
44+
if-no-files-found: ignore

.lighthouserc.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"numberOfRuns": 1,
5+
"startServerCommand": "npx http-server ./dist/angular-tailwind-template/browser -p 4173 -s",
6+
"url": ["http://127.0.0.1:4173/"]
7+
},
8+
"assert": {
9+
"assertions": {
10+
"categories:performance": [
11+
"warn",
12+
{
13+
"minScore": 0.5
14+
}
15+
],
16+
"categories:accessibility": [
17+
"error",
18+
{
19+
"minScore": 0.85
20+
}
21+
],
22+
"categories:best-practices": [
23+
"warn",
24+
{
25+
"minScore": 0.8
26+
}
27+
],
28+
"categories:seo": [
29+
"error",
30+
{
31+
"minScore": 0.85
32+
}
33+
]
34+
}
35+
},
36+
"upload": {
37+
"target": "temporary-public-storage"
38+
}
39+
}
40+
}

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@ npm start
4646
- **[Quickstart Guide](QUICKSTART.md)** - 5-Minuten Setup für geforktes Projekt
4747
- **[Contributing Guide](CONTRIBUTING.md)** - Wie du zum Template beitragen kannst
4848

49+
## 🎯 Branding konfigurieren
50+
51+
Alle zentralen Branding-Werte sind über eine Datei konfigurierbar:
52+
53+
- `src/assets/branding/brand.config.json`
54+
55+
Darüber steuerst du u. a.:
56+
57+
- Farben (Primary, Secondary, Accent)
58+
- Schriftart (globale Font Family)
59+
- Hero-Hintergrundbild
60+
- App-Name, Logo-Initiale, Footer-Labels und Links
61+
- Developer-Daten auf der About-Seite
62+
63+
Nach Änderungen reicht ein normaler Neustart des Dev-Servers (`npm start`) oder ein Reload bei laufendem Server.
64+
65+
## 🗺️ Roadmap (3 Phasen)
66+
67+
### Phase 1: Quick Wins
68+
69+
- Playwright Smoke-Tests fuer Kernrouten (`/`, `/login`, `/components`)
70+
- Lighthouse CI als Quality Gate fuer Accessibility/SEO/Performance
71+
- CI-Artefakte fuer Testreports (Playwright HTML Report)
72+
73+
### Phase 2: Mid-Term
74+
75+
- API Client Generierung via OpenAPI
76+
- Error Monitoring (z. B. Sentry) mit globaler Fehlerkorrelation
77+
- Verbesserte Release Automation (Conventional Commits + semantic-release)
78+
79+
### Phase 3: Enterprise Hardening
80+
81+
- SSR + Hydration fuer SEO/Core Web Vitals
82+
- PWA-Strategie (Offline/Fallback/Installbarkeit)
83+
- Security/Compliance Gates (Dependency + Secret Scans, CSP-Validierung)
84+
4985
## ✨ Features
5086

5187
### 🇩🇪 **D-Stack & DSGVO Compliance**
@@ -189,9 +225,24 @@ npm start
189225
# Production build
190226
npm run build
191227

228+
# Generate typed Angular client from OpenAPI
229+
npm run openapi:generate
230+
192231
# Run tests
193232
npm test
194233

234+
# End-to-end smoke tests
235+
npm run e2e
236+
237+
# E2E tests for CI
238+
npm run e2e:ci
239+
240+
# Lighthouse CI (build + audit)
241+
npm run lhci
242+
243+
# Combined quality checks
244+
npm run quality
245+
195246
# Code formatting
196247
npm run format
197248

docs/CUSTOMIZATION.md

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,53 @@ theme: {
8888
}
8989
```
9090

91+
### Branding zentral konfigurieren (empfohlen)
92+
93+
Alle Branding-Werte (Design + Texte) sind zentral konfigurierbar in:
94+
95+
- `src/assets/branding/brand.config.json`
96+
97+
Beispiel:
98+
99+
```json
100+
{
101+
"design": {
102+
"fontFamily": "Inter, sans-serif",
103+
"primary": "#4f46e5",
104+
"secondary": "#7c3aed",
105+
"accent": "#ec4899",
106+
"background": "#f9fafb",
107+
"surface": "#ffffff",
108+
"text": "#111827",
109+
"textMuted": "#6b7280",
110+
"heroImageUrl": "https://example.com/hero.jpg"
111+
},
112+
"text": {
113+
"appName": "Mein Produkt",
114+
"appInitial": "M",
115+
"skipToContentLabel": "Zum Hauptinhalt springen",
116+
"complianceBadgeLabel": "D-Stack Ready",
117+
"complianceText": "Dieses Template ist konform mit den Standards des",
118+
"complianceLinkLabel": "deutschland-stack",
119+
"complianceLinkUrl": "https://technologie.deutschland-stack.gov.de/",
120+
"footerCompanyName": "Mein Unternehmen",
121+
"footerLearnMoreUrl": "https://github.com/my-org/my-repo",
122+
"privacyLabel": "Datenschutz",
123+
"imprintLabel": "Impressum",
124+
"developerName": "Max Mustermann",
125+
"developerRole": "Frontend Engineer",
126+
"developerLinkedinUrl": "https://www.linkedin.com/in/max/",
127+
"developerImageUrl": "assets/img/max.jpg"
128+
}
129+
}
130+
```
131+
132+
Hinweise:
133+
134+
- Der `BrandingService` lädt die Datei beim App-Start.
135+
- Fehlende Felder fallen automatisch auf Defaults zurück.
136+
- Im Dev-Modus gibt es Warnungen in der Konsole, wenn Felder fehlen.
137+
91138
### D-Stack Banner anpassen/entfernen
92139

93140
**`src/app/app.component.html`**
@@ -262,30 +309,25 @@ rm -rf src/app/features/admin
262309

263310
## 🔌 API Integration
264311

265-
### API Service anpassen
312+
### API Services anpassen (OpenAPI + Facades)
266313

267-
**`src/app/core/services/api.service.ts`**
268-
269-
```typescript
270-
@Injectable({
271-
providedIn: 'root',
272-
})
273-
export class ApiService {
274-
private apiUrl = environment.apiUrl;
314+
Das Template nutzt generierte OpenAPI-Services plus Facade-Schicht:
275315

276-
constructor(private http: HttpClient) {}
316+
- OpenAPI Spec: `openapi/openapi.yaml`
317+
- Generator Config: `ng-openapi-gen.json`
318+
- Generierter Client: `src/app/core/api/generated/`
319+
- App-nahe Facades:
320+
- `src/app/core/services/users-facade.service.ts`
321+
- `src/app/core/services/posts-facade.service.ts`
277322

278-
// Eigene API-Endpunkte hinzufügen
279-
getMyData(): Observable<any> {
280-
return this.http.get(`${this.apiUrl}/my-endpoint`);
281-
}
323+
Bei API-Änderungen:
282324

283-
postMyData(data: any): Observable<any> {
284-
return this.http.post(`${this.apiUrl}/my-endpoint`, data);
285-
}
286-
}
325+
```bash
326+
npm run openapi:generate
287327
```
288328

329+
Danach bindest du neue Endpunkte idealerweise über die Facades in deine Komponenten ein.
330+
289331
### Eigene Models erstellen
290332

291333
**`src/app/core/models/my-model.ts`**

e2e/smoke.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { expect, test } from '@playwright/test';
2+
3+
test.describe('Smoke tests', () => {
4+
test('loads home route and core layout', async ({ page }) => {
5+
await page.goto('/');
6+
7+
await expect(page).toHaveTitle(/Angular \+ Tailwind Template/i);
8+
await expect(page.getByText(/D-Stack Ready/i).first()).toBeVisible();
9+
await expect(page.getByRole('link', { name: /Datenschutz/i })).toBeVisible();
10+
});
11+
12+
test('navigates to login page', async ({ page }) => {
13+
await page.goto('/login');
14+
15+
await expect(page.getByRole('heading', { level: 2 })).toBeVisible();
16+
await expect(page.locator('input#email')).toBeVisible();
17+
await expect(page.locator('input#password')).toBeVisible();
18+
});
19+
20+
test('components route resolves', async ({ page }) => {
21+
const response = await page.goto('/components');
22+
expect(response?.ok()).toBeTruthy();
23+
});
24+
});

ng-openapi-gen.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "./node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
3+
"input": "./openapi/openapi.yaml",
4+
"output": "./src/app/core/api/generated",
5+
"indexFile": true,
6+
"removeStaleFiles": true,
7+
"ignoreUnusedModels": false,
8+
"module": false,
9+
"apiService": "ApiClient",
10+
"services": true,
11+
"models": true,
12+
"enumStyle": "alias",
13+
"promises": false,
14+
"nullSafeAdditionalProps": true
15+
}

0 commit comments

Comments
 (0)