Angular starter for enterprise-grade front-end projects.
https://my-angular-boilerplate.vercel.app/
Contributing Guidelines
·
Submit an Issue
- Strict mode.
- Lazy loading.
- Smart and pure components pattern.
- SCAM pattern.
- Self-contained components and encapsulated modules.
- Components types (e.g. component, page).
- Amazing directory structure.
- Unit tests with Jest instead of Karma & Jasmine.
- e2e tests with Cypress (removed in favor of the official cypress schematic as an opt-in feature)
- PWA
- Dynamic titles and content meta tags.
- TailwindCSS + Autoprefixer + PurgeCSS setup.
- Dark mode and theme configuration.
- Scalable CSS architecture in favor of TailwindCSS layers.
- Lighthouse reports improved.
- Migration from TSLint to ESLint.
- Run unit tests & lint code on Git Hooks using Husky & validate commit messages using commitlint
- GitHub Actions workflows for code analysis and unit tests.
Types of pages
public: everybody can see them
private: only logged in users can see them
- General
- home
- not-found
- footer
- header
- layout
- SeoService
- ThemeService
- click-outside (detects when the user clicks outside an element).
- bytes (transforms a numeric value into bytes, KB, MB, GB, etc.).
-
Change application title:
Go to
src/index.html
and inside thetitle
tag, replace "Angular Boilerplate" with your app name. -
Change paths of the pages:
Go to
src/app/core/utils/router.utils.ts
to find all the registered routes inside a config object. -
Change titles, descriptions, and robots of the pages:
Every page has a
.route
file that contains an exported constant that holds the title, description and a robot's metatag that indicates if it can be indexed or followed by a web crawler. -
Change your TailwindCSS configuration:
You can find the config file in the project root, then you can refer to https://tailwindcss.com/docs/configuration to learn how to make your own adjustments.
-
Set a default theme (First time load)
Go to
src\app\@core\services\theme\theme.config.ts
and change the following line of codefrom operating system preference
export const DEFAULT_BASE_THEME = ThemeList.System;
to light mode
export const DEFAULT_BASE_THEME = ThemeList.Light;
or dark mode
export const DEFAULT_BASE_THEME = ThemeList.Dark;
There are certain features that you may or may not like to have in your projects, and here's how to remove them:
Husky allows you to easily run scripts on Git Hooks & commitlint validates if a commit message follows a certain convention.
-
Remove execution of tests and linting on pre-commit:
- Go to
angular-boilerplate\.husky
and remove the npm scripts inside thepre-commit
file or the file itself.
- Go to
-
Remove execution of build on pre-push:
- Go to
angular-boilerplate\.husky
and remove the npm scripts inside thepre-push
file or the file itself.
- Go to
-
Remove conventional commit messages validation:
- Go to
angular-boilerplate\.husky
and remove the commandnpx commitlint --edit $1
inside thecommit-msg
file or the file itself. - Remove the file
angular-boilerplate\.commitlintrc
. - Run the following command:
npm uninstall @commitlint/cli @commitlint/config-conventional
OR
yarn remove @commitlint/cli @commitlint/config-conventional
- Go to
-
Fully remove Husky & commitlint
- Remove the folder
angular-boilerplate\.husky
. - Remove the file
angular-boilerplate\.commitlintrc
. - Run the following commands:
npm uninstall husky @commitlint/cli @commitlint/config-conventional
OR
yarn remove husky @commitlint/cli @commitlint/config-conventional
- Remove the folder
TailwindCSS is a utility-first CSS Framework fully customizable & fully tree shakeable. If you want to replace it with another CSS framework or don't want to use a CSS framework at all, you can easily remove it from the project.
- Remove
angular-boilerplate\tailwind.config.js
file. - Run the following command:
npm uninstall tailwindcss autoprefixer postcss
OR
yarn remove tailwindcss autoprefixer postcss
├───app
│ ├───@core
│ │ ├───directives
│ │ │ └───click-outside
│ │ ├───guards
│ │ ├───interceptors
│ │ ├───pipes
│ │ │ └───bytes
│ │ ├───services
│ │ │ ├───seo
│ │ │ └───theme
│ │ └───utils
│ ├───@shared
│ │ └───ui (layout components)
│ │ ├───footer
│ │ ├───header
│ │ ├───layout
│ │ └───not-found
│ ├───components (generic shared components)
│ └───pages
│ ├───home
├───assets
├───environments
└───theme
├───01-base
├───02-components
└───03-utilities
Command | Description | NPM | Yarn | Background command |
---|---|---|---|---|
ng | See available commands | npm run ng | yarn ng | ng |
start | Run your app in development mode | npm start | yarn start | ng serve |
build | Build your app for production | npm run build | yarn build | ng build |
build:stats | Build your app for production and generate a "stats.json" file | npm run build:stats | yarn build:stats | ng build --stats-json |
watch | Run build when files change. | npm run watch | yarn watch | ng build --watch --configuration development |
test | Run your unit tests | npm run test | yarn test | ng test |
lint | Use ESLint to lint your app | npm run lint | yarn lint | ng lint |
analyze | Open webpack-bundle-analyzer | npm run analyze | yarn analyze | webpack-bundle-analyzer dist/angular-boilerplate/stats.json |