How gavilanch/angular-7-cloud-firestore-demo works
Project Type and Purpose
• This is a Single-Page Application (SPA) built entirely in Angular (v7) using the Angular CLI.
• Its sole purpose is a “Todo” front-end: users can add, list, and manage todo items. There is no back-end in this repo—data lives in the TodoService (in-memory or stubbable for future HTTP).
Top-Level File Structure Analysis
• Angular CLI scaffold: angular.json, tsconfig.json, src/, e2e/
• src/ contains:
• index.html, main.ts, polyfills.ts – bootstrapping & polyfills
• environments/ – environment.ts & environment.prod.ts for build-time config
• app/ – the heart of the app:
– app.module.ts & app-routing.module.ts – core module & router
– app.component.* – root component
– contact/, menu/ – shared UI components
– todo/ – feature folder with:
· models/ (Todo, TodoViewModel)
· services/ (TodoService)
· todo-form/ & todo-list/ components
• e2e/ & spec files for Protractor and Karma test harnesses
Key Architectural Elements
a. Presentation Layer
• Components (AppComponent, MenuComponent, ContactComponent, TodoFormComponent, TodoListComponent)
• Angular Router directs URL paths to components
b. Business-Logic Layer
• TodoService: holds/manipulates the list of Todo models, stub for HTTP calls
c. Data Layer
• In-memory list (could be replaced with HttpClient to talk to REST)
d. Configuration
• environment.ts files select API endpoints or flags at build time
e. Build & Deployment
• Angular CLI build (webpack under the covers) outputs to dist/
• e2e: Protractor; unit: Karma + Jasmine
Important Patterns & Principles
• Component-based architecture: each UI part is its own component with HTML+CSS+TS+spec
• Service for shared state & business logic (singleton, injectable)
• Separation of concerns: models under models/, services under services/, views in their own component folders
Summary
• Break the app into Presentation, Service, and Model layers.
• How the Angular CLI build & serve process feeds the browser.