Reader small image

You're reading from  Angular for Enterprise Applications - Third Edition

Product typeBook
Published inJan 2024
Reading LevelExpert
PublisherPackt
ISBN-139781805127123
Edition3rd Edition
Languages
Right arrow
Author (1)
Doguhan Uluca
Doguhan Uluca
author image
Doguhan Uluca

Doguhan Uluca is a Principal Fellow at Excella in Washington, D.C., where he leads strategic initiatives and delivers critical systems. He has technical expertise in usability, mobility, performance, scalability, cybersecurity, and architecture. He is the author of the Angular for Enterprise Application Development books, has spoken at over 30 conferences, and is an Angular GDE Alumni. Doguhan has delivered solutions for Silicon Valley startups, Fortune 50 companies, and the U.S. Federal Government, and he is passionate about contributing to open-source projects and teaching.
Read more about Doguhan Uluca

Right arrow

Preface

Welcome to the wonderful world of Angular enterprise development! Standalone projects, signals, and the control flow syntax have injected fresh blood into the framework. At the time that this book is published, Angular 17.1 has been released with features to bring Signals-based components closer to reality, keeping the Angular ecosystem as vibrant as ever. If this trajectory holds, by Angular 20, the framework will be easier than ever to use and will make it possible to create reliable and high-performance applications of any size. This new edition of the book refocuses the content on enterprise architecture and continues the journey toward mastering sophisticated and scalable Angular solutions ready for complex business needs.

Much like the previous edition, this book has been meticulously designed to equip you with indispensable knowledge and pragmatic examples so you can architect, build, and deliver robust Angular applications. The emphasis remains on adopting an efficient and minimalist approach – maximizing the capabilities of Angular itself and eschewing unnecessary dependencies. This results in streamlined code that is simpler to maintain as Angular continues its rapid pace of progress.

The fundamental concepts you will learn from this book remain evergreen, even as tools and techniques continue to evolve. Router-first architecture, Angular components, the reactive programming model, the powerful routing system, and intuitive template syntax have stood the test of time. And they will provide you with a solid foundation as frameworks change and new versions emerge.

This edition includes extensively expanded coverage of key topics like change detection, state management, decoupled components, modular design, router orchestration, and integration with backend systems. You’ll also learn crucial real-world skills for enterprise development, like user authentication, data validation, optimization best practices, and CI/CD pipelines.

This definitive guide shares hard-won lessons on building web systems ready for the demands of any business. Over the years, the code and the content have been reviewed and improved by leading experts in the industry, and this edition is no different. Learn from the collective experience of these experts with actionable recipes, insider tips, and sample apps that showcase professional techniques.

Visit the companion site at https://AngularForEnterprise.com to join the community and stay current.

Who this book is for

This book is for experienced developers. If you’re new to Angular, start with the excellent tutorials at https://angular.dev/tutorials to become familiar with the basics and return to this book. As an Angular developer, you will deepen your understanding of the framework and be exposed to the entire gamut of designing and deploying an Angular application to production. You will learn about Angular patterns that are easy to understand and teach others. As a freelancer, you will pick up effective tools and technologies to deliver your Angular app securely, confidently, and reliably. As an enterprise developer, you will learn patterns and practices to write Angular applications with a scalable architecture and leverage popular enterprise tools.

What this book covers

Chapter 1, Angular’s Architecture and Concepts, introduces Angular as a mature platform for building sophisticated, high-performance web applications using TypeScript, RxJS, and NgRx. It introduces key concepts like reactive programming, the Flux pattern, standalone components, fine-grained reactivity with Signals, and the importance of keeping Angular updated.

Chapter 2, Forms, Observables, Signals, and Subjects, covers creating search functionality, using forms, enabling interaction between components, avoiding memory leaks, comparing imperative and reactive programming, chaining API calls, using signals for better performance, and building a small weather application to demonstrate basic Angular concepts.

Chapter 3, Architecting an Enterprise App, covers best practices and considerations for succeeding as a technical lead or architect on an enterprise Angular project, including ingredients for running a successful project, why Angular suits enterprise needs, performance optimization tools and techniques like the 80-20 rule and Router-first architecture, and agile planning with Kanban boards.

Chapter 4, Creating a Router-First Line-of-Business App, covers using the Angular CLI to generate project scaffolding and components, implementing branding and icons, debugging routers with DevTools, and the core tenets of router-first architecture – defining roles early, lazy loading, walking skeleton navigation, designing around data entities, completing high-level UX design, achieving stateless and decoupled components, differentiating controls and components, and maximizing code reuse with TypeScript/ECMAScript.

Chapter 5, Designing Authentication and Authorization, covers implementing token-based authentication with JWTs using TypeScript for safe data handling, building extendable services with OOP principles like inheritance and abstract classes, the fundamentals of caching and HTTP interceptors to preserve login state, and an in-memory authentication service for testing. The key topics are building secure authentication and authorization services and applying SOLID principles to make them extensible.

Chapter 6, Implementing Role-Based Navigation, covers designing conditional navigation experiences, creating reusable UI services for alerts, using route guards to control access, emphasizing server-side security, dynamically providing different auth providers based on environment, and implementing authentication with Firebase.

Chapter 7, Working with REST and GraphQL APIs, covers full-stack architecture using the MEAN stack – building a Node.js server with TypeScript, containerization with Docker, infrastructure as code with Docker Compose, CI/CD verification, designing REST APIs with OpenAPI and GraphQL with Apollo, implementing JWT authentication and RBAC middleware in Express, and building custom authentication providers in Angular using HttpClient and Apollo. The key topics are full-stack development, API design, RBAC, and end-to-end authentication.

Chapter 8, Recipes – Reusability, Forms, and Caching, covers building reusable forms, directives and user controls in Angular, including multi-step responsive forms, removing boilerplate code through inheritance and abstraction, dynamic form elements like date pickers, typeahead, and form arrays, interactive controls with input masking and custom components, seamless integration via ControlValueAccessor, and scaling form complexity linearly by extracting sections – as well as layout techniques like grid lists. The key topics are reusable, dynamic, and interactive form building blocks.

Chapter 9, Recipes – Master/Detail, Data Tables, and NgRx, completes coverage of major Angular application design considerations using router-first architecture and recipes to implement a line-of-business application, including editing users, resolving route data, reusing components, building master/detail views and data tables, implementing state management with NgRx or SignalStore, comparing state management options like NgRx Data, ComponentStore, Signals, Akita, and Elf, adding preload animations and global spinners, and previewing Angular’s signal-based future by refactoring an application to use SignalStore.

Chapter 10, Releasing to Production with CI/CD, covers implementing continuous integration/continuous delivery pipelines, emphasizing automated testing to enable rapid delivery in enterprises, configuring CI with CircleCI, enforcing quality gates with trunk-based development using GitHub flow, deploying to Vercel and Firebase, infrastructure as code techniques with Docker and NPM scripts, containerization and deployment to Google Cloud Run, gated CI workflows, CircleCI orchestration with workflows and orbs, code coverage metrics, and automated deployments to enable continuous delivery – allowing the rapid iteration and sharing of app builds.

Appendix A, Setting Up Your Development Environment, wraps things up with setting up efficient Angular development environments using CLI tools for automation and consistency across Windows and macOS, creating an initial Angular project, optimizing VS Code configuration, implementing automated linting and fixing for coding standard enforcement and error catching, documenting team norms through scripts, and how standardized environments and coding styles boost team productivity and troubleshooting.

To get the most out of this book

  • Set up your system for web development following the scripts covered in Appendix A, Setting Up Your Development Environment.
  • If you’re new to Angular, complete the tutorials at https://angular.dev/tutorials.
  • Follow the Technical requirements section at the beginning of each chapter and information boxes within sections.
  • Check the latest code examples on GitHub at https://github.com/duluca.
  • Sign up for the companion site to complete the self-assessment at https://angularforenterprise.com.
  • For beginners, developers new to Angular, or inexperienced developers:
    1. Follow the book in the published order, coding your solution alongside the content in each chapter.
    2. It helps to be familiar with full-stack web development but is not a prerequisite.

Download the example code files

You can get the latest version of the example code files on GitHub. Four projects directly support the content in this book:

  1. Web Development Environment Setup Scripts at https://github.com/duluca/web-dev-environment-setup
  2. Local Weather App at https://github.com/duluca/local-weather-app
  3. LemonMart at https://github.com/duluca/lemon-mart
  4. LemonMart Server at https://github.com/duluca/lemon-mart-server

In each chapter, you can find specific instructions to access chapter-specific versions of code examples referred to as stages. When demonstrating continuous integration and deployment configuration, Git branches and GitHub pull requests are utilized to demonstrate specific configuration elements.

Note that the code on GitHub may differ from the book’s content as Angular evolves.

Download the color images

We also provide a PDF file with color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781805127123.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and X handles. For example, “Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system.”

A block of code is set as follows:

{
  "name": "local-weather-app",
  "version": "0.0.0",
  "license": "MIT",
  ...
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },

Any cross-platform or macOS-specific command-line input or output is written as follows:

$ brew tap caskroom/cask

Windows-specific command-line input or output is written as follows:

PS> Set-ExecutionPolicy AllSigned; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance words in menus or dialog boxes also appear in the text like this. For example: “Select System info from the Administration panel.”

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book’s title in the subject of your message. If you have questions about any aspect of this book, please email us at questions@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packtpub.com/submit-errata, click Submit Errata, and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Share your thoughts

Once you’ve read Angular for Enterprise Applications, Third Edition, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application. 

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below
Qr code  Description automatically generated

https://packt.link/free-ebook/9781805127123

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Angular for Enterprise Applications - Third Edition
Published in: Jan 2024Publisher: PacktISBN-13: 9781805127123
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Doguhan Uluca

Doguhan Uluca is a Principal Fellow at Excella in Washington, D.C., where he leads strategic initiatives and delivers critical systems. He has technical expertise in usability, mobility, performance, scalability, cybersecurity, and architecture. He is the author of the Angular for Enterprise Application Development books, has spoken at over 30 conferences, and is an Angular GDE Alumni. Doguhan has delivered solutions for Silicon Valley startups, Fortune 50 companies, and the U.S. Federal Government, and he is passionate about contributing to open-source projects and teaching.
Read more about Doguhan Uluca