Top Related Projects
Deliver web apps with confidence 🚀
Angular Style Guide: A starting point for Angular development teams to provide consistency through good practices.
🌱 [Deprecated] Extensible, reliable, modular, PWA ready starter project for Angular (2 and beyond) with statically typed build and AoT compilation
MFE Starter
Quick Overview
Angular-JumpStart is a comprehensive starter project for Angular applications. It provides a solid foundation for building scalable and maintainable web applications using Angular, incorporating best practices and common features required in most projects.
Pros
- Includes a well-structured project setup with modular architecture
- Implements lazy loading for improved performance
- Incorporates Angular Material for consistent UI components
- Provides examples of services, routing, and state management
Cons
- May be overwhelming for beginners due to its comprehensive nature
- Some included features might not be necessary for smaller projects
- Requires understanding of Angular ecosystem and related technologies
- Could potentially become outdated if not regularly maintained
Code Examples
- Lazy loading a module:
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: '/customers' },
{ path: 'customers/:id', data: { preload: true }, loadChildren: () => import('./customer/customer.module').then(m => m.CustomerModule) },
{ path: 'customers', loadChildren: () => import('./customers/customers.module').then(m => m.CustomersModule) },
{ path: 'orders', loadChildren: () => import('./orders/orders.module').then(m => m.OrdersModule) },
{ path: '**', pathMatch: 'full', redirectTo: '/customers' }
];
- Using Angular Material in a component:
import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
@Component({
selector: 'app-customer-list',
template: `
<button mat-raised-button color="primary" (click)="openDialog()">Add Customer</button>
`
})
export class CustomerListComponent {
constructor(public dialog: MatDialog) {}
openDialog() {
this.dialog.open(CustomerDialogComponent);
}
}
- Implementing a service with HttpClient:
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Customer } from './customer.model';
@Injectable({
providedIn: 'root'
})
export class CustomerService {
private apiUrl = 'api/customers';
constructor(private http: HttpClient) {}
getCustomers(): Observable<Customer[]> {
return this.http.get<Customer[]>(this.apiUrl);
}
}
Getting Started
-
Clone the repository:
git clone https://github.com/DanWahlin/Angular-JumpStart.git
-
Install dependencies:
cd Angular-JumpStart npm install
-
Start the development server:
ng serve -o
-
Open your browser and navigate to
http://localhost:4200
to see the application running.
Competitor Comparisons
Deliver web apps with confidence 🚀
Pros of Angular
- Official framework repository with comprehensive documentation and resources
- Larger community and ecosystem, leading to more third-party libraries and tools
- Regular updates and long-term support from Google
Cons of Angular
- Steeper learning curve for beginners due to its complexity and size
- Heavier initial bundle size, which may impact load times for smaller applications
- More opinionated structure, potentially limiting flexibility for some developers
Code Comparison
Angular-JumpStart:
@Component({
selector: 'app-root',
template: `
<router-outlet></router-outlet>
`
})
export class AppComponent {
title = 'Angular JumpStart';
}
Angular:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'angular';
}
Key Differences
- Angular-JumpStart is a starter project designed to help developers quickly set up an Angular application with best practices and common features.
- Angular is the core framework repository, containing the source code and documentation for the entire Angular ecosystem.
- Angular-JumpStart provides a more opinionated structure and includes additional features out of the box, while Angular gives developers more flexibility in structuring their applications.
- Angular-JumpStart may be more suitable for beginners or those looking for a quick start, while Angular is better for developers who want full control over their project setup.
Angular Style Guide: A starting point for Angular development teams to provide consistency through good practices.
Pros of angular-styleguide
- Comprehensive style guide for Angular development
- Widely adopted and recognized in the Angular community
- Includes explanations and rationale for each guideline
Cons of angular-styleguide
- Primarily focused on coding style and best practices, not a complete project setup
- May require additional resources for project structure and tooling
- Less hands-on compared to a full project template
Code Comparison
Angular-JumpStart:
@Component({
selector: 'app-root',
template: `
<router-outlet></router-outlet>
`
})
export class AppComponent implements OnInit {
constructor() {}
ngOnInit() {}
}
angular-styleguide (example guideline):
/* avoid */
const getCustomers = function() {
//...
};
/* recommend */
function getCustomers() {
//...
}
Angular-JumpStart provides a complete project structure with working components, while angular-styleguide offers coding guidelines and best practices. The former is more suitable for quickly starting a new project, while the latter is valuable for maintaining consistent code quality across Angular applications.
🌱 [Deprecated] Extensible, reliable, modular, PWA ready starter project for Angular (2 and beyond) with statically typed build and AoT compilation
Pros of angular-seed
- More comprehensive and feature-rich, offering a wider range of tools and configurations
- Better suited for larger, more complex Angular applications
- Includes advanced features like lazy loading and AOT compilation out of the box
Cons of angular-seed
- Steeper learning curve due to its complexity and extensive feature set
- May be overkill for smaller projects or beginners learning Angular
- Requires more setup and configuration to get started
Code Comparison
Angular-JumpStart:
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
AppRoutingModule
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
angular-seed:
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
RouterModule.forRoot(routes),
SharedModule.forRoot()
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
The main difference in the code snippets is that angular-seed uses a custom SharedModule and directly imports RouterModule with routes, while Angular-JumpStart uses a separate AppRoutingModule for routing configuration.
MFE Starter
Pros of PatrickJS-starter
- More comprehensive tooling setup, including Webpack, Jest, and TypeScript
- Includes server-side rendering (SSR) configuration out of the box
- Provides a more opinionated structure for larger-scale applications
Cons of PatrickJS-starter
- Steeper learning curve due to additional complexity
- Less focus on basic Angular concepts, which may be overwhelming for beginners
- Fewer inline comments and explanations compared to Angular-JumpStart
Code Comparison
Angular-JumpStart:
@Component({
selector: 'app-root',
template: `
<router-outlet></router-outlet>
`
})
export class AppComponent implements OnInit {
constructor() {}
ngOnInit() {}
}
PatrickJS-starter:
@Component({
selector: 'app-root',
template: `
<header>
<nav>
<a [routerLink]=" ['./'] ">Index</a>
<a [routerLink]=" ['./home'] ">Home</a>
<a [routerLink]=" ['./detail'] ">Detail</a>
<a [routerLink]=" ['./about'] ">About</a>
</nav>
</header>
<main>
<router-outlet></router-outlet>
</main>
<footer>
<span>WebPack Angular 2 Starter by <a [href]="url">@AngularClass</a></span>
</footer>
`
})
export class AppComponent {}
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Angular JumpStart with TypeScript
The goal of this jumpstart app is to provide a simple way to get started with Angular 2+ while also showing several key Angular features. The sample relies on the Angular CLI to build the application.
Looking for expert onsite Angular/TypeScript training? We've trained the biggest (and smallest :-)) companies around the world for over 15 years. For more information visit https://codewithdan.com.
Angular Concepts Covered
- TypeScript version that relies on classes and modules
- Modules are loaded with System.js
- Defining routes including child routes and lazy loaded routes
- Using Custom Components including custom input and output properties
- Using Custom Directives
- Using Custom Pipes
- Defining Properties and Using Events in Components/Directives
- Using the Http object for Ajax calls along with RxJS observables
- Working with Utility and Service classes (such as for sorting and Ajax calls)
- Using Angular databinding Syntax [], () and [()]
- Using template-driven and reactive forms functionality for capturing and validating data
- Optional: Webpack functionality is available for module loading and more (see below for details)
- Optional: Ahead-of-Time (AOT) functionality is available for a production build of the project (see below for details)
Standalone Components Example
An example of this application that uses standalone components (no modules) can be found in the standalone-components
branch.
Running the Application with Node.js
-
Install the latest LTS version of Node.js from https://nodejs.org. IMPORTANT: The server uses ES2015 features AND the Angular CLI so you need a modern version of Node.js.
-
Run
npm install
to install app dependencies -
Run
ng build angular-jumpstart
to build and bundle the code. If you'd like to build and watch the code (in case you plan to make changes) runng build angular-jumpstart --watch
instead. -
Run
npm start
in a separate terminal window to launch the web and RESTful API server. This will server the APIs and the Angular app. -
Go to http://localhost:8080 in your browser
NOTE: You'll need to supply your own Google Maps API key in the shared/map.component.ts
file to see the full map functionality. Update https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY
with your key.
Simply clone the project or download and extract the .zip to get started.
Once the app is running you can play around with editing customers after you login. Use any email address and any password that's at least 6 characters long (with 1 digit).
Here are a few screenshots from the app:
Running Angular Playground
This application includes Angular Playground (http://www.angularplayground.it) which provides a great way to isolate components in a sandbox rather than loading the entire application to see a given component. To run the playground run the following command:
npm run playground
Then open a browser and visit http://localhost:4201
and follow the directions there (or visit their website for more information).
Running Cypress End to End Tests
- Run
npm install cypress --save-dev
to install Cypress. - Run
npm run cypress
to start the Cypress test runner.
Running in Kubernetes
- Install Docker Desktop from https://www.docker.com/get-started
- Start Docker and enable Kubernetes in the Docker Desktop preferences/settings
- Run
docker-compose build
to create the images - Run
kubectl apply -f .k8s
to start Kubernetes - Visit
http://localhost
- Stop Kubernetes using
kubectl delete -f .k8s
Running with Skaffold
If you'd like to use the Skaffold tool to run the project in Kubernetes, install it, and run the following command:
skaffold dev
To generate the skaffold.yaml
file that's included in the project the following command was run and the image context paths it defines were modified:
skaffold init -k '.k8s/*.yml' \
-a '{"builder":"Docker","payload":{"path":".docker/nginx.dev.dockerfile"},"image":"nginx-angular-jumpstart"}' \
-a '{"builder":"Docker","payload":{"path":".docker/node.dockerfile"},"image":"node-service-jumpstart"}'
If you wanted to generate the initial Kubernetes manifest files from an existing docker-compose.yml file you can use the following command. It uses the Kompose tool behind the scenes to create the YAML files
skaffold init --compose-file docker-compose.yml \
-a '{"builder":"Docker","payload":{"path":".docker/nginx.dev.dockerfile"},"image":"nginx-angular-jumpstart"}' \
-a '{"builder":"Docker","payload":{"path":".docker/node.dockerfile"},"image":"node-service-jumpstart"}'
Running in the Azure Static Web Apps Service
Check out my post on Getting Started with Azure Static Web Apps.
Kubernetes Day Zero Webinar: Deploying to Kubernetes
Dan Wahlin
Twitter: @DanWahlin
Resources mentioned:
- https://github.com/danwahlin/angular-jumpstart
- https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
- https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#-strong-api-overview-strong-
- https://kubernetes.io/docs/reference/kubectl/cheatsheet/
Agenda
-
Container Orchestration Options (Docker Swarm, Kubernetes)
-
Using Docker Compose
docker-compose build docker-compose up docker-compose down
-
Docker Stacks --> Docker Desktop --> Kubernetes
docker stack deploy -c docker-compose.yml angular-jumpstart docker stack ls docker stack rm angular-jumpstart
-
Deploying Containers to Kubernetes
kompose convert -h kompose convert -f docker-compose.yml -o ./[your-folder-goes-here]
Tweak the generated YAML. Then once ready run:
kubectl apply -f [your-folder-name]
My Kubernetes for Developers video courses on Pluralsight.com:
https://pluralsight.pxf.io/danwahlin
Azure Container Apps
Build API Image
-
Go to https://github.com/danwahlin/angular-jumpstart and fork the repo.
-
Clone the forked repo to your machine.
-
Run
docker-compose build node
. -
Tag the image with your Docker Hub repo name:
docker tag node-service-jumpstart <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart
-
docker push <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart
Create environment
az containerapp env create -n angular-jumpstart-env -g Angular-Jumpstart-RG \
--location westus3
Deploy the API Container App
az containerapp create -n angular-jumpstart-api -g Angular-Jumpstart-RG \
--environment angular-jumpstart-env \
--image <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart \
--ingress external --target-port 8080
Note the fully qualified domain (fqdn) value assigned to the
angular-jumpstart-api
container app. You'll need this value in the next section.
Add an .env File
-
Create a
.env
file in the project root. -
Add the following key/value to the
.env
file:
NG_APP_API_URL=<FQDN_VALUE_FROM_YOUR_angular-jumpstart-api_CONTAINER_APP>
Build the UI Image
-
Run
docker-compose build nginx
. -
Tag the image with your Docker Hub repo name:
docker tag nginx-angular-jumpstart <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart
-
Push the image to Docker Hub:
docker push <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart
Deploy UI Container App
Change the image name below to match your image tag from the previous step.
az containerapp create -n angular-jumpstart-ui -g Angular-Jumpstart-RG \
--environment angular-jumpstart-env \
--image <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart \
--ingress external --target-port 80
View the UI App
Navigate to the FQDN value shown after running the previous command.
Add GitHub Continuous Deployment
-
Create a service principal:
az ad sp create-for-rbac \ --name AngularJumpStartServicePrincipal \ --role "contributor" \ --scopes /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/Angular-Jumpstart-RG \ --sdk-auth
-
Add a GitHub action for the UI container app:
az containerapp github-action add \ --repo-url "https://github.com/<OWNER>/<REPOSITORY_NAME>" \ --context-path "./.docker/nginx.dockerfile" \ --branch main \ --name angular-jumpstart-ui \ --image <YOUR_DOCKER_HUB_NAME>/nginx-angular-jumpstart --resource-group Angular-Jumpstart-RG \ --registry-url docker.io \ --registry-username <REGISTRY_USER_NAME> \ --registry-password <REGISTRY_PASSWORD> \ --service-principal-client-id <CLIENT_ID> \ --service-principal-client-secret <CLIENT_SECRET> \ --service-principal-tenant-id <TENANT_ID> \ --login-with-github
-
Add a GitHub action for the API container app:
az containerapp github-action add \ --repo-url "https://github.com/<OWNER>/<REPOSITORY_NAME>" \ --context-path "./.docker/node.dockerfile" \ --branch main \ --name angular-jumpstart-api \ --image <YOUR_DOCKER_HUB_NAME>/node-service-jumpstart --resource-group Angular-Jumpstart-RG \ --registry-url docker.io \ --registry-username <REGISTRY_USER_NAME> \ --registry-password <REGISTRY_PASSWORD> \ --service-principal-client-id <CLIENT_ID> \ --service-principal-client-secret <CLIENT_SECRET> \ --service-principal-tenant-id <TENANT_ID> \ --login-with-github
-
IMPORTANT: Once the GitHub actions are added, pull the latest changes to your local repository.
-
Open each action file in
.github/workflows
and change the properties underon:
to the following (in both files):# When this action will be executed on: push: branches: - main pull_request: types: [opened, synchronize, reopened, closed] branches: - main
-
Make the following changes to each respective workflow file:
angular-jumpstart-ui workflow
build-args: NG_APP_API_URL=${{ secrets.NG_APP_API_URL }} file: ./.docker/nginx.dockerfile context: ./
angular-jumpstart-api workflow
file: ./.docker/node.dockerfile context: ./
-
Go to your GitHub.com and navigate to your forked repo. Select
Settings --> Secrets --> Actions
from the toolbar. -
Add the following key/value into the repository secrets. This is needed for the CI build that generates the UI image.
NG_APP_API_URL=<FQDN_VALUE_FROM_YOUR_angular-jumpstart-api_CONTAINER_APP>
-
Push your changes up to your repo.
-
Go to your GitHub repo on Github.com and select
Actions
from the toolbar. You should see the actions building (and hopefully deploy successfully). -
Go to the FQDN of your
angular-jumpstart-ui
container app in the browser. The app should load if your GitHub actions deployed successfully.
Top Related Projects
Deliver web apps with confidence 🚀
Angular Style Guide: A starting point for Angular development teams to provide consistency through good practices.
🌱 [Deprecated] Extensible, reliable, modular, PWA ready starter project for Angular (2 and beyond) with statically typed build and AoT compilation
MFE Starter
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot