Skip to content

Commit 9e95cb1

Browse files
Feature/part7 (#54)
* Add Firebase configuration files and Docker setup for Angular SSR application and LLMs files * Upgrade Angular dependencies and update build configurations for improved performance * Upgrade @ngrx and ngx-quill dependencies to latest versions for improved compatibility * Add initial Angular application structure and configuration files * Add code-samples-mfe project structure and initial configuration * Add app description and project structure for angular.fun multi-project workspace * Add CLAUDE.md for project guidance and architecture overview * Add CLAUDE.md for project guidance and architecture overview * Create folder structure for new projects * Refactor component selectors and add ESLint configuration for multiple projects * Enhance ESLint configuration with boundaries plugin and project-specific rules * Refactor app component and configuration for shared services; update ESLint rules for boundaries enforcement * Refactor app component and configuration for shared services; update ESLint rules for boundaries enforcement * Refactor styles and configuration; integrate TailwindCSS and enhance button styles * Refactor components and routes; rename selectors and update navigation logic * Rename components and update selectors for consistency; change 'app-label' to 'web-label' and 'app-post-card' to 'web-post-card' * Refactor project structure and components; rename files for clarity and consistency, add login component and styles, and update routing logic * Refactor login and add-post components; enhance layout structure, update styles for consistency, and improve responsiveness * Add tag multi-select component; implement styles and HTML structure for tag selection, search functionality, and dropdown menu * Refactor component structure and update routing; rename files for clarity, adjust router links, and implement new layout component * Enhance main layout and styling; implement gradient background, improve spacing, and update component structure for better layout consistency * Refactor imports and update paths; streamline module imports for consistency and clarity across components * Refactor imports and update paths; streamline shared module imports for consistency and clarity across components * Add prerender parameters generator and update routing; implement route generation from Supabase posts and adjust Angular SSR configuration * Refactor component structure and update selectors; rename login and register components for consistency, adjust template syntax, and improve import paths * Refactor posts list component layout; simplify structure, enhance styling, and improve button positioning for better responsiveness * Update ESLint configuration; add environment files pattern and enhance module allowance rules for improved structure and clarity * Refactor import paths and component structure; streamline imports from shared module for consistency and clarity across components * Refactor import paths and update module exports; streamline imports from shared module and enhance public API structure for improved clarity and maintainability * Update ESLint configuration and improve tag multi-select component; enhance rules for clarity and safety, and utilize optional chaining for better null handling * Refactor components to enhance memory management and type safety; implement DestroyRef cleanup for event listeners and MutationObserver, convert @input to signal inputs, and standardize error handling for improved clarity and maintainability * Improve error handling in posts and tags stores; enhance error messages to provide more context and ensure type safety for error handling * Refactor post component HTML for improved readability; streamline markup and enhance structure for better maintainability * Refactor dynamic dialog service for improved readability; streamline component creation and enhance code structure for better maintainability * Add ESLint configuration for shared projects; implement linting options and specify file patterns for improved code quality * Fix path in environment file generation; update output location for environment.ts to ensure correct file structure in CI workflow * Update Node.js version in CI configuration; change from 18 to 22 for compatibility with latest features * Update GitHub Actions configuration; upgrade Node.js version to 20 and actions to v4 for improved performance and compatibility * Add RouterTestingModule to AppComponent tests for improved routing functionality * Add RouterTestingModule and Zoneless Change Detection to AppComponent tests for improved routing and performance * Add Playwright tests for Admin application and update build configurations * Update e2e test command to use 'e2e:web:local' for improved testing accuracy * Update e2e test command to use 'e2e:web:local' for improved testing accuracy
1 parent 24ba1ea commit 9e95cb1

File tree

281 files changed

+30363
-7078
lines changed

Some content is hidden

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

281 files changed

+30363
-7078
lines changed

.firebaserc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"projects": {
3+
"default": "your-firebase-project-id"
4+
},
5+
"targets": {
6+
"your-firebase-project-id": {
7+
"hosting": {
8+
"admin": [
9+
"admin-site-id"
10+
],
11+
"samples": [
12+
"samples-site-id"
13+
]
14+
}
15+
}
16+
}
17+
}

.github/workflows/PR_Check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: PR Check
22

33
on:
44
pull_request:
5-
branches:
6-
- main
5+
branches:
6+
- main
77

88
jobs:
99
test:
@@ -16,12 +16,12 @@ jobs:
1616
- name: Set up Node.js
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: '18'
19+
node-version: '22'
2020

2121
- name: Generate environment.ts from secrets
2222
shell: bash
2323
run: |
24-
cat > src/environments/environment.ts <<'EOF'
24+
cat > environments/environment.ts <<'EOF'
2525
export const environment = {
2626
production: false,
2727
supabaseUrl: '${{ secrets.SUPABASE_URL }}',

.github/workflows/e2e-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,15 @@ jobs:
4040
- run: |
4141
echo "SUPABASE_ANON_KEY=$(supabase status -o env | grep SUPABASE_ANON_KEY | cut -d= -f2)" >> $GITHUB_ENV
4242
43+
- name: Start Angular web app
44+
run: npm run start:local &
45+
env: { NODE_ENV: "test" }
46+
47+
- name: Wait for Angular web app (≤30 s)
48+
run: npx --yes wait-on http://localhost:4200 --timeout 30000
49+
4350
- run: npx playwright install --with-deps
44-
- run: npm run e2e:local
51+
- run: npm run e2e:web:local
4552
env: { CI: "true" }
4653

4754
- uses: actions/upload-artifact@v4

.github/workflows/google-cloudrun-docker.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,31 @@ jobs:
99
test:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1313

14-
- uses: actions/setup-node@v3
14+
- uses: actions/setup-node@v4
1515
with:
16-
node-version: '18'
17-
16+
node-version: '20'
17+
cache: npm
18+
1819
- run: npm ci
1920

20-
- run: npm run test -- --browsers=ChromeHeadless --watch=false --no-progress
21+
- run: npm run test:all -- --browsers=ChromeHeadless --watch=false --no-progress
2122

2223
deploy:
2324
runs-on: ubuntu-latest
2425
needs: test
2526
steps:
26-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2728

28-
- uses: actions/setup-node@v3
29+
- uses: actions/setup-node@v4
2930
with:
30-
node-version: '18'
31+
node-version: '20'
32+
cache: npm
3133

3234
- run: npm ci
3335

34-
- run: npm run build --prod
36+
- run: npm run build -- --configuration production
3537

3638
- uses: google-github-actions/auth@v2
3739
with:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ adminSdkConf.json
5252
/test-results/
5353
/playwright-report/
5454
/playwright/.cache/
55+
56+
#llms
57+
/llms/private
58+
/llms/priv

.prettierrc

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"endOfLine": "lf",
9+
"bracketSpacing": true,
10+
"bracketSameLine": false,
11+
"arrowParens": "avoid",
12+
"overrides": [
13+
{
14+
"files": "*.html",
15+
"options": {
16+
"parser": "angular"
17+
}
18+
},
19+
{
20+
"files": "*.scss",
21+
"options": {
22+
"singleQuote": false
23+
}
24+
},
25+
{
26+
"files": "*.md",
27+
"options": {
28+
"proseWrap": "preserve"
29+
}
30+
}
31+
]
32+
}

CLAUDE.md

Lines changed: 238 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## MOST IMPORTANT: Always read the LLM context files in `/llms/` before making any code changes or refactor proposals.
6+
7+
## MOST IMPORTANT: NO WRITE COMMENTS in the codebase. Use PR comments instead.
8+
9+
## Project Overview
10+
11+
This is **angular.fun** - a modern Angular 20+ blog application with Supabase backend. The project is currently a monolithic structure in `/src` but is being refactored into a multi-project workspace with micro-frontends and shared libraries.
12+
13+
### Current Architecture
14+
15+
- **Main App**: `/src/app` - Monolithic structure containing both reader and admin functionality
16+
- **Reader**: `/src/app/reader` - Public blog with SSG/SSR capabilities
17+
- **Admin**: `/src/app/admin` - Admin panel with CSR for content management
18+
- **Shared**: `/src/app/shared` - Common components, services, models, and stores
19+
20+
### Target Architecture (Multi-Project Workspace)
21+
22+
- **projects/web**: Public blog with hybrid rendering (SSG for articles, SSR for home)
23+
- **projects/admin**: Pure CSR admin panel for Firebase Hosting
24+
- **projects/code-samples-mfe**: Micro-frontend for code samples via Native Federation
25+
- **projects/shared**: Shared library with UI components, patterns, data-access, and models
26+
27+
## Common Development Commands
28+
29+
### Development
30+
31+
```bash
32+
npm start # Start main app (development mode)
33+
npm run start:local # Start with local Supabase configuration
34+
npm run start:local:docker # Open Docker for local development
35+
npm run start:local:backend # Start local Supabase instance
36+
```
37+
38+
### Building
39+
40+
```bash
41+
npm run build # Build for production
42+
npm run build:stats # Build with bundle analysis stats
43+
npm run analyze # Analyze bundle size with webpack-bundle-analyzer
44+
```
45+
46+
### Testing
47+
48+
```bash
49+
npm test # Run unit tests with Karma
50+
npm run e2e # Run E2E tests with Playwright
51+
npm run e2e:local # Run E2E tests against local environment
52+
```
53+
54+
### Supabase Management
55+
56+
```bash
57+
npx supabase start # Start local Supabase
58+
npx supabase stop # Stop local Supabase
59+
npm run schema:pull # Pull remote schema from cloud Supabase
60+
npm run db:createSeed # Create database seed file
61+
npm run db:seed # Initialize database with seed data
62+
```
63+
64+
### Project-Specific Commands
65+
66+
```bash
67+
ng serve admin # Serve admin project (when refactored)
68+
ng serve web # Serve web project (when refactored)
69+
ng build shared # Build shared library
70+
ng serve code-samples-mfe # Serve code samples micro-frontend
71+
```
72+
73+
## Key Technologies & Stack
74+
75+
- **Frontend**: Angular 20, NgRx Signals, Tailwind CSS, DaisyUI, Quill Editor, Highlight.js
76+
- **Backend**: Supabase (PostgreSQL, Authentication, Storage, Functions)
77+
- **Testing**: Playwright for E2E, Karma/Jasmine for unit tests
78+
- **Build**: Angular CLI with esbuild, SSR/SSG capabilities
79+
- **State Management**: NgRx SignalStore throughout all applications
80+
81+
## Code Architecture Patterns
82+
83+
### State Management
84+
85+
- Use NgRx SignalStore for all state management
86+
- Feature-scoped stores in individual feature directories
87+
- Shared stores in `/src/app/shared/stores` -> refactor to `/projects/shared/src/data-access/stores` in new architecture
88+
89+
### Component Structure
90+
91+
- Standalone components using Angular's modern APIs
92+
- Feature-based organization with lazy-loaded routes
93+
- UI components are pure and stateless (inputs/outputs only)
94+
- Business logic encapsulated in services and stores
95+
96+
### Data Access
97+
98+
- **Public/Reader**: Uses PostgREST endpoints for SSG/SSR compatibility
99+
- **Admin**: Uses `@supabase/supabase-js` browser client
100+
- **Authentication**: Supabase Auth with role-based access control
101+
- **Storage**: Supabase Storage CDN for images and assets
102+
103+
### Routing
104+
105+
- Lazy-loaded feature modules
106+
- Route-level providers for feature isolation
107+
- Functional guards for authentication (`authAdminGuard`)
108+
109+
## Development Guidelines
110+
111+
### File Organization
112+
113+
- The legacy monolith remains under `/src` until migration is complete — **do not modify** unless explicitly approved.
114+
- The target workspace lives under `/projects` and `/projects/shared`.
115+
116+
**Apps**
117+
118+
- `projects/web` — feature-first, standalone, lazy:
119+
- `app/` (bootstrap, root routes)
120+
- `features/<feature-name>/` (routes, components, stores, services)
121+
- `layout/` (shell, navigation, footer)
122+
- `core/` (app-level providers: http, interceptors, guards)
123+
- `projects/admin` — CSR-only, same structure as `web`.
124+
- `projects/code-samples-mfe` — remote MFE, only required features and mfe routing.
125+
126+
**Shared library**
127+
128+
- `projects/shared/`
129+
- `ui/` (pure presentational components; no business logic)
130+
- `pattern/` (composable building blocks, form controls, table abstractions)
131+
- `data-access/` (clients, repositories, query functions; PostgREST for web SSR/SSG, supabase-js for admin)
132+
- `models/` (types, DTOs, schema definitions)
133+
- `utils/` (pure functions, pipes, directives)
134+
135+
**General rules**
136+
137+
- Standalone + lazy everywhere; **no cross-feature TS imports**.
138+
- Promote reusable logic “upwards” (from feature → pattern/ui/data-access).
139+
- Keep guards/interceptors/providers at route-level or in `core/` per app.
140+
- Tailwind/DaisyUI configuration shared where possible; design tokens in `shared`.
141+
142+
See the [architecture.txt](llms/private/architecture.txt) document for authoritative rules and dependency boundaries.
143+
144+
### Styling
145+
146+
- Use Tailwind CSS with DaisyUI components
147+
- Custom color palette: primary (#12372A), secondary (#436850), tertiary (#ADBC9F), quaternary (#FBFADA)
148+
- Monitor CSS bundle size with budget limits in angular.json
149+
150+
### Type Safety
151+
152+
- Strict TypeScript configuration enabled
153+
- Supabase types generated in `/src/app/types/supabase/` -> refactor to `/projects/shared/src/models/supabase/`
154+
- Use proper interfaces for all data models
155+
156+
### Environment Configuration
157+
158+
- `environment.ts` - Production
159+
- `environment.development.ts` - Development
160+
- `environment.local.ts` - Local Supabase instance
161+
162+
## Supabase Integration
163+
164+
### Supabase Configuration
165+
166+
- projects/web uses PostgREST for SSG/SSR compatibility
167+
- rest uses `@supabase/supabase-js` for browser client
168+
169+
### Database Schema
170+
171+
- Posts, Comments, Tags, PostTags, Profiles tables
172+
- Row Level Security (RLS) policies for data protection
173+
- Migrations managed in `/supabase/migrations/`
174+
175+
### Authentication
176+
177+
- Email/password authentication
178+
- Role-based access (admin, user roles)
179+
- Protected admin routes with functional guards
180+
181+
### Local Development
182+
183+
- Use Docker for local Supabase instance
184+
- Access Supabase Studio at http://localhost:54323
185+
- Seed data available via scripts in `/scripts/`
186+
187+
## Testing Strategy
188+
189+
### E2E Tests (Playwright)
190+
191+
- Tests in `/e2e/` directory
192+
- Configured for multiple browsers (Chromium, Firefox, WebKit)
193+
- Helper utilities in `/e2e/helpers/`
194+
- Local and CI configurations available
195+
196+
### Unit Tests
197+
198+
- Colocated spec files with components/services
199+
- Karma + Jasmine test runner -> refactor to use Vitest in the future
200+
- Focus on business logic and component behavior
201+
202+
## Build & Deployment
203+
204+
### Bundle Optimization
205+
206+
- Lazy loading for all features
207+
- Bundle analysis with webpack-bundle-analyzer
208+
- Performance budgets enforced in angular.json
209+
- Tree-shaking enabled for optimal bundle sizes
210+
211+
### Target Deployments
212+
213+
- **Web**: Google Cloud Run (SSG/SSR)
214+
- **Admin**: Firebase Hosting (CSR)
215+
- **Code Samples MFE**: Firebase Hosting (MFE)
216+
- **Assets**: Supabase Storage CDN
217+
218+
## Migration Status
219+
220+
The project is currently migrating from monolithic structure to multi-project workspace:
221+
222+
- Current: Single app in `/src`
223+
- Target: Separate projects in `/projects/` with shared libraries
224+
- Architecture guidance available in `/llms/private/architecture.txt`
225+
226+
## LLM Context Files
227+
228+
Always read these files before making refactor proposals or code edits:
229+
230+
- [llms/**/architecture.txt](llms/private/architecture.txt)
231+
- [llms/**/llm-full.txt](llms/private/llm-full.txt)
232+
- [llms/**/app-description.txt](llms/private/app-description.txt)
233+
234+
These documents are authoritative for:
235+
236+
- Workspace and folder structure
237+
- Angular 20 style and coding conventions
238+
- Target apps, rendering modes, and deployment

0 commit comments

Comments
 (0)