# ๐ŸŽจ Playground Frontend This is the **frontend** of the Playground project. Built with **Angular 21** and **Angular Material**, including a light/dark theme toggle and multi-language support (EN/DE) via **ngx-translate**. The app is built as a static **Single Page Application (SPA)** served by **NGINX**, deployed at: ๐Ÿ‘‰ [https://app.andreas-dahm.eu](https://app.andreas-dahm.eu) --- ## ๐Ÿงฉ Tech Stack | Component | Purpose | | --------- | ------- | | Angular 21 | Frontend framework (standalone components, signals, zoneless change detection) | | Angular Material 21 | UI components & theming | | Tailwind CSS 4 | Utility-first styling (CSS-first config, no `tailwind.config.js`) | | ngx-translate 18 | i18n / instant translation | | Babylon.js 9 | WebGL/WebGPU rendering for the algorithm demos | | Swiper 14 | Image carousels in the project dialogs | | Angular Service Worker | PWA / offline caching | | NGINX | Serves the compiled SPA | | Docker + Gitea Actions | Automated build, test & image publishing | Requires **Node.js 22**. --- ## ๐Ÿ“ Project Structure ``` playground-frontend/ โ”œโ”€ src/ โ”‚ โ”œโ”€ app/ โ”‚ โ”‚ โ”œโ”€ layout/ # app shell, topbar, dialogs โ”‚ โ”‚ โ”œโ”€ pages/ # about, projects, algorithms, imprint, stopwatch, not-found โ”‚ โ”‚ โ”œโ”€ service/ # theme, language, SEO, GPU capability โ”‚ โ”‚ โ”œโ”€ shared/ # reusable components & helpers โ”‚ โ”‚ โ”œโ”€ constants/ โ”‚ โ”‚ โ”œโ”€ app.config.ts โ”‚ โ”‚ โ””โ”€ app.routes.ts โ”‚ โ”œโ”€ assets/ โ”‚ โ”‚ โ”œโ”€ i18n/ # en.json / de.json (keys must stay in sync) โ”‚ โ”‚ โ”œโ”€ logos/, flags/, icons/ โ”‚ โ”‚ โ””โ”€ projects/ # project screenshots โ”‚ โ”œโ”€ tailwind.css # Tailwind entry + @theme tokens โ”‚ โ”œโ”€ styles.scss # Material theme setup & component overrides โ”‚ โ””โ”€ index.html โ”œโ”€ scripts/check-i18n.mjs # fails the build on i18n key drift โ”œโ”€ Dockerfile โ”œโ”€ nginx.conf โ”œโ”€ ngsw-config.json # service worker caching rules โ”œโ”€ lighthouserc.json โ””โ”€ .gitea/workflows/build-Frontend-a.yml ``` --- ## ๐Ÿš€ Local Development **1. Install dependencies** ```bash npm install ``` **2. Start development server** ```bash ng serve --open ``` App runs at http://localhost:4200 **3. Docker build (local)** ```bash docker build -t playground-frontend:local . docker run -p 8080:80 playground-frontend:local ``` Then open http://localhost:8080 --- ## ๐Ÿงช Scripts | Command | Purpose | | ------- | ------- | | `npm start` | Dev server | | `npm run build` | Production build | | `npm run watch` | Rebuild on change (development configuration) | | `npm test` | Unit tests (Karma + Jasmine, headless Chrome) | | `npm run lint` | ESLint over `src/**/*.ts` and `src/**/*.html` | | `npm run i18n:check` | Verifies `en.json` and `de.json` share the exact same keys | --- ## โš™๏ธ Gitea Actions (CI/CD) CI/CD runs on a **self-hosted Gitea instance** at `git.andreas-dahm.eu`. Workflow file: `.gitea/workflows/build-Frontend-a.yml` Triggered on every push to `main` and on pull requests targeting `main`. **Job 1 โ€” `quality-check`** (runs on both pushes and PRs): 1. Lint & type check โ€” `npm run lint` 2. i18n key sync โ€” `npm run i18n:check` 3. Unit tests โ€” `npx ng test --watch=false` 4. Production build โ€” `npx ng build --configuration production` 5. Lighthouse audit โ€” `npx lhci autorun` (performance & SEO) **Job 2 โ€” `docker`** (only on a push to `main`, and only if `quality-check` passed): Builds the image and pushes it to the Gitea container registry at `git.andreas-dahm.eu` with these tags: ``` git.andreas-dahm.eu//playground:frontend-a- git.andreas-dahm.eu//playground:frontend-a-- git.andreas-dahm.eu//playground:frontend-a-main ``` **Required repository secret:** | Name | Description | | ---- | ----------- | | `TOKEN_GITEA` | Gitea access token used to authenticate against the container registry | --- ## ๐ŸŒ Deployment The built image is deployed via the `playground-deploy` repository on the Hostinger KVM server using **Traefik**: ```bash docker compose pull docker compose up -d ``` โœ… Live site at https://app.andreas-dahm.eu --- ## ๐Ÿช„ Maintainer Andreas Dahm ๐Ÿ“ง andreas.dahm@gmail.com ๐ŸŒ https://andreas-dahm.eu