Extensible Angular 13+ enterprise-grade project generator based on angular-cli with best practices from the community. Includes PWA, Cordova & Electron support, coding guides and more!
See generated project example here.
Benefits versus bare
A complete starter template: example app structure tailored for scalability, with examples and boilerplate code for every common thing needed in enterprise projects, such as unit tests, routing, authentication, HTTPS service extensions, i18n support with dynamic language change and automatic user language detection...
Improved tooling: SCSS & HTML linting, stricter TSLint rules, markdown-based local wiki server for documentation, automated localizable strings extraction, corporate proxy support, Cordova integration
API proxy example setup: develop and debug faster using any remote server
Generator output customization: with the provided add-on support, start multiple projects even faster by plugging in additions that fit your needs, such as your enterprise theme, SSO authentication, services integrations...
And there's even more! See What's in the box for more details.
- Install required tools:
npm install -g generator-ngx-rocket
- Create your application:
:bulb: Pro tip: the
ngxCLI can do more that just bootstrapping new projects! You can use it to run your NPM scripts with fuzzy matching (try
ngx cifor example) or help you maintaining your project up-to-date. Take a look at the full documentation!
The structure follows Angular style guide.
dist/ app production build docs/ project docs and coding guides cypress/ end-to-end tests src/ project source code |- app/ app components | |- @shared/ shared module (common components, directives, pipes and services) | |- app.component.* app root component (shell) | |- app.module.ts app root module definition | |- app-routing.module.ts app routes | +- ... additional modules and components |- assets/ app assets (images, fonts, sounds...) |- environments/ values for various build environments |- theme/ app global scss variables and theme |- translations/ translations files |- index.html html entry point |- main.scss global style entry point |- main.ts app entry point |- polyfills.ts polyfills needed by Angular +- test.ts unit tests entry point reports/ test and coverage reports proxy.conf.js backend proxy configuration
Task automation is based on NPM scripts.
||Run development server on
||Run test server on
||Lint code and build web app for production (with AOT) in
||Run unit tests via Karma or Jest in watch mode|
||Lint code and run unit tests once for continuous integration|
||Run e2e tests using Protractor|
||Extract strings from code and templates to
||Display project documentation|
Additional tasks for Cordova-based projects:
||Prepare for building mobile app (restore Cordova platforms and plugins)|
||Run app on target platform device or simulator|
||Build mobile app for production in
Additional tasks for Electron-based projects:
||Build desktop app|
||Run app on electron|
||Package app for all supported platforms|
When building the application, you can specify the target configuration using the additional flag
--configuration <name> (do not forget to prepend
-- to pass arguments to npm scripts).
The default build configuration is
npm start for a dev server. Navigate to
http://localhost:4200/. The app will automatically reload if you change
any of the source files.
You should not use
ng serve directly, as it does not use the backend proxy configuration by default.
npm run generate -- component <name> to generate a new component. You can also use
npm run generate -- directive|pipe|service|class|module.
If you have installed angular-cli globally with
npm install -g @angular/cli,
you can also use the command
ng generate directly.
What's in the box
- Optimized build and bundling process with Webpack
- Development server with backend proxy and live reload
- Cross-browser CSS with autoprefixer and browserslist
- Asset revisioning for better cache management
- Unit tests using Jasmine, Karma and headless Chrome
- End-to-end tests using Protractor
- Static code analysis: TSLint, Codelyzer, Stylelint and HTMLHint
- Local knowledgebase server using Hads
- Automatic code formatting with Prettier
- Deployment with the CLI using ng deploy
- UI based on:
- Optional utility libraries:
- I18n guide
- Working behind a corporate proxy
- Updating dependencies and tools
- Using a backend proxy for development
- Browser routing
--packageManager [npm|yarn]: specify whether to use Yarn or NPM as your package manager (default is NPM). You can also use the environment variable
NGX_PACKAGE_MANAGERto set this option globally.
--automate <json_file>: automate prompt answers using specified JSON file (see here for examples).
--addons <addon_name> [<addon_name>] ...: space-separated list of add-ons to use.
--no-update: do no update existing project (see also updating generated projects).
--no-analytics: do not report anonymous usage analytics. You can also use the environment variable
NGX_DISABLE_ANALYTICSto set this option globally.
--raw: do not use any UI library for templates.
--tools: generate only the toolchain, without application template.
--location-strategy [hash|path]: location strategy to use in Angular router (default is
--no-git: do not initialize git repository.
--no-strict: disable TypeScript strict type checking options.
--skip-quickstart: disable quick start message after project generation.
--no-prefix: do not add
--deploy <option>: choose automatic deployment option. Use
ngx n --deployto see possible values.
When generating a fullstack project (with both client and server code), you can use the environment variables
NGX_SERVER_PATH to customize the paths for client and server code. Be aware though that some
add-ons may force specific paths that will preempt your changes.
Updating generated projects
As new features and newer libraries and tools are added to the generator, you may want to update your project at some point. Here is how we suggest you to do it:
- Make sure your working directory is clean (no pending / uncommited changes).
ngx updateusing the CLI inside your project folder.
- The generator will then run again using the same options you used initially, prompting you for each file change. From there the recommended approach is simply to overwrite everything.
- Finally, use your source control to see the diff for each file and merge the changes manually.
Note: you can use the
--toolsoption to generate only the toolchain and not application templates, thus reducing the number of changes to merge.
Customize project generation
You can customize the generator output to change or enhance it to better suit your needs using add-ons.
To create a new add-on, you can use the
addon sub-generator of the CLI:
ngx new --addon
See the add-on generator documentation for more information about add-on creation.
First time contributors are welcome in this project! 🎉
To get started, take a look at the contributing guide. If you want to help and don't know what you can do, look for good first contribution issues, or if you're a seasoned OSS contributor look for PR welcome tags.
Thanks for helping ❤️