Skip to content

Commit 764ff9b

Browse files
committed
feat: production-ready Angular 21 SSR architecture with modern Node 24+ requirements
0 parents  commit 764ff9b

128 files changed

Lines changed: 21439 additions & 0 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Exclude node_modules (re-installed during build)
2+
node_modules/
3+
4+
# Exclude build output
5+
dist/
6+
.angular/
7+
.husky
8+
9+
# Exclude git metadata
10+
.git/
11+
12+
# Exclude log files
13+
*-dev.log
14+
npm-debug.log*
15+
yarn-debug.log*
16+
yarn-error.log*
17+
18+
# Exclude editor and OS specific files
19+
.DS_Store
20+
.idea/
21+
.vscode/
22+
23+
# Exclude docker files
24+
Dockerfile
25+
.dockerignore
26+
27+
# Exclude environment files if they contain secrets (following security rules)
28+
# .env.local
29+
# .env.*.local
30+
# .env.development.local
31+
# .env.test.local
32+
# .env.production.local

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI Build & Test
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [24.x]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run Tests (Headless)
30+
run: npm run test -- --watch=false --browsers=ChromeHeadless
31+
32+
- name: Run Angular Build (Production + SSR)
33+
run: npm run build:prod
34+
35+
- name: Verify Build Artifacts
36+
run: |
37+
if [ ! -d "dist/personal-website/browser" ]; then
38+
echo "Build failed: Browser bundle missing"
39+
exit 1
40+
fi
41+
if [ ! -d "dist/personal-website/server" ]; then
42+
echo "Build failed: Server bundle missing"
43+
exit 1
44+
fi
45+
echo "Build succeeded. Artifacts verified."

.gitignore

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
/backend/node_modules
12+
Procfile
13+
/backend/Procfile
14+
**/*.zip
15+
npm-debug.log
16+
yarn-error.log
17+
/frontend-dev.log
18+
/backend-dev.log
19+
20+
# IDEs and editors
21+
.idea/
22+
.project
23+
.classpath
24+
.c9/
25+
*.launch
26+
.settings/
27+
*.sublime-workspace
28+
29+
# Visual Studio Code
30+
.vscode/*
31+
!.vscode/settings.json
32+
!.vscode/tasks.json
33+
!.vscode/launch.json
34+
!.vscode/extensions.json
35+
.history/*
36+
37+
# Miscellaneous
38+
/.angular/cache
39+
.sass-cache/
40+
/connect.lock
41+
/coverage
42+
/libpeerconnection.log
43+
testem.log
44+
/typings
45+
46+
# System files
47+
.DS_Store
48+
Thumbs.db
49+
.env

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm audit fix && npm test

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Contributing to the Senior Angular Showcase
2+
3+
Thank you for your interest in this project! As a showcase of senior-level Angular architecture, we maintain high standards for code quality and structural integrity.
4+
5+
## 📜 Principles
6+
7+
- **Architecture First**: All changes must adhere to the Core/Shared/Layout/Feature hierarchy.
8+
- **Standalone Only**: No `NgModules` are allowed.
9+
- **Performance Budget**: Avoid adding heavy third-party dependencies. Prioritize native Angular or lightweight custom implementations.
10+
- **Strict Typing**: No `any`. Use strict TypeScript types and interfaces.
11+
12+
## 🛠️ Development Workflow
13+
14+
1. **Fork & Clone**: Create your own branch from `main`.
15+
2. **Architecture Check**: Ensure new components are placed in the correct feature or shared directory.
16+
3. **Local Testing**: Run `npm run start` and verify changes in the browser.
17+
4. **Production Validation**: Run `npm run build:prod` to ensure hydration and SSR compatibility.
18+
19+
## 🎨 Styling Guidelines
20+
21+
- Use **Primeflex** for layout utilities.
22+
- Use **PrimeNG** for complex UI components (configured with Ripple: disabled).
23+
- Maintain the **Glassmorphism** aesthetic where applicable.
24+
25+
---
26+
27+
*This project is primarily a portfolio, but constructive feedback or architecture-improving PRs are always welcome.*

Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM node:24-alpine AS builder
2+
WORKDIR /app
3+
4+
COPY package.json package-lock.json ./
5+
RUN npm ci
6+
7+
COPY . .
8+
RUN npm run build:prod
9+
10+
RUN find ./dist -name "*.map" -type f -delete
11+
12+
FROM node:24-alpine
13+
WORKDIR /app
14+
15+
ENV NODE_ENV=production
16+
17+
COPY package.json package-lock.json ./
18+
RUN npm ci --omit=dev
19+
20+
COPY --from=builder /app/dist/personal-website ./dist/personal-website
21+
COPY server.static.mjs ./
22+
23+
USER node
24+
25+
ENV PORT=8080
26+
EXPOSE 8080
27+
28+
CMD ["node", "server.static.mjs"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Janfess
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Enterprise Angular 21 SSR Reference Architecture
2+
3+
> **A production-ready, highly optimized Angular architecture designed for scale, performance, and maintainability.**
4+
5+
This repository serves as a masterclass in modern Angular development. Engineered from the ground up by a Senior Angular Architect, it demonstrates how to architect a state-of-the-art (SOTA) frontend application using the absolute latest features of Angular 21. It is explicitly designed to serve as a technical reference for enterprise teams and prospective clients.
6+
7+
## 🚀 Why This Architecture is "Senior-Level"
8+
9+
Unlike typical frontend portfolios, this project treats the UI as a comprehensive, production-critical system:
10+
11+
- **Enterprise Feature-Driven Design:** The codebase strictly adheres to the `Core` / `Shared` / `Feature` / `Layout` module pattern. This eliminates circular dependencies, enforces a clean separation of concerns, and ensures the codebase remains maintainable as it scales.
12+
- **Aggressive Performance Optimization:** Utilizes intelligent asset preloading, HTTP `Link` headers, intersection observers for lazy loading, and advanced `@defer` blocks. The result is a near-instant First Contentful Paint (FCP) and exceptional Core Web Vitals.
13+
- **Node.js Express SSR & SSG Mastery:** Bypasses basic routing with a custom Express `server.ts` that handles dynamic `Accept-Language` locale detection, aggressive static asset caching (`Cache-Control`), security headers, and prerendering (SSG) for unparalleled SEO performance.
14+
- **Production-Grade DevOps & Automation:** Features an automated GitHub Actions CI/CD pipeline, strict TypeScript compilation enforcement, and Husky git hooks.
15+
- **Modern UI/UX Standards:** Built with PrimeNG 21 (Aura theme) and PrimeFlex, demonstrating deep expertise in integrating complex, enterprise-grade UI libraries cleanly into a modern Angular context.
16+
- **PWA & Offline Resilience:** Fully configured Service Worker with custom background update broadcasting (`sw-update-broadcast.service.ts`) for seamless, zero-downtime client updates.
17+
- **Decoupled Data Architecture:** Implements a strict Service Layer pattern for all HTTP interactions. Components are kept "lean" and unaware of API implementation details, while `InquiryService` handles data mutation, error catching, and state persistence via RxJS Observables.
18+
19+
20+
### System Architecture Flow
21+
22+
```mermaid
23+
graph TD
24+
Client[Client Browser] -->|HTTP Request| Express[Node.js Express Server]
25+
Express -->|Static Asset?| Static[Serve /browser files]
26+
Express -->|Dynamic Route?| Locale[Detect Locale via Headers/URL]
27+
Locale --> AngularEngine[Angular Node App Engine]
28+
AngularEngine -->|Prerendered?| SSG[Serve SSG HTML]
29+
AngularEngine -->|Dynamic?| SSR[Render Angular Component]
30+
SSR --> Express
31+
SSG --> Express
32+
Express -->|Response| Client
33+
```
34+
35+
### Data Interaction Flow (Reactive Pattern)
36+
37+
```mermaid
38+
graph LR
39+
View[Component Template] -->|User Action| Comp[Angular Component]
40+
Comp -->|Form Data| Service[InquiryService / Core]
41+
Service -->|HTTP POST| API[Backend API / Cloudflare]
42+
API -->|Response| Service
43+
Service -->|Observable| Comp
44+
Comp -->|Update UI| View
45+
```
46+
47+
### Component Structure
48+
49+
```mermaid
50+
graph TD
51+
App[AppRoot Component] --> Layout
52+
App --> RouterOutlet
53+
54+
Layout --> Header[Header Component]
55+
Layout --> Footer[Footer Component]
56+
57+
RouterOutlet --> Features
58+
59+
Features --> Home[Home Module]
60+
Features --> About[About Module]
61+
Features --> Legal[Legal Module]
62+
Features --> Prep[Prep Module]
63+
64+
Home --> SharedComponents
65+
About --> SharedComponents
66+
Legal --> SharedComponents
67+
68+
subgraph Shared
69+
SharedComponents[Buttons, Breadcrumbs, Schedulers]
70+
end
71+
72+
subgraph Core
73+
Services[SEO, SW Updates, Inquiry Handling, Layout Adjusters]
74+
end
75+
76+
Features -.->|Injects| Core
77+
```
78+
79+
## Project Structure
80+
81+
```
82+
src/
83+
├── app/
84+
│ ├── core/ # Singleton services (SEO, Updates, Inquiry, Adjustments)
85+
│ ├── features/ # Feature modules (Home, About, Legal, etc.)
86+
│ ├── layout/ # Global structural components (Header, Footer)
87+
│ └── shared/ # Reusable UI components and utilities
88+
├── assets/ # Static assets, fonts, icons
89+
├── environments/ # Environment-specific configuration
90+
└── locale/ # i18n translation files
91+
```
92+
93+
## Getting Started
94+
95+
### Prerequisites
96+
97+
- Node.js (v24 or higher recommended)
98+
- Angular CLI
99+
100+
### Installation
101+
102+
1. Clone the repository:
103+
```bash
104+
git clone <your-repo-url>
105+
cd personal-website-opensource
106+
```
107+
108+
2. Install dependencies:
109+
```bash
110+
npm install
111+
```
112+
113+
3. Configure Environment Variables:
114+
Update `src/environments/environment.ts` with your specific API and Worker URLs if you are connecting to a backend.
115+
116+
### Development Server
117+
118+
Run `npm run start` (or `ng serve`) for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
119+
120+
### Build
121+
122+
Run `npm run build:prod` to build the project for production. The build artifacts will be stored in the `dist/` directory. This utilizes Angular's static output mode for prerendering.
123+
124+
## License
125+
126+
This project is open-sourced under the MIT License.

0 commit comments

Comments
 (0)