Do you like angular-cli-skeleton? Please, add a 'star' to support this library
A simple ready to use skeleton project with angular-cli (optionally also angular-universal), Angular 9, Bootstrap 4, ng-bootstrap, ngrx-store and so on.
This project my previous older skeleton project called angular-webpack-skeleton.
If you like it, please add a star. It will be really appreciated.
- Typescript >= 3.7
- Angular 9
- IVY enabled by default for Angular >= 9
- Ahead of Time (AOT) enabled by default for Angular >= 5
- Lazy loading
- HttpClient of Angular >= 4.3
- RxJS 6 with pipeable operators
- i18n support to add multiple languages (in this example you can find a small example with english and italian)
- Bootstrap 4 with a custom theme (check
./src/_variables.scss), ng-bootstrap - FontAwesome 5
- Web App Manifest support to add it as a standalone app on mobile devices (see
manifest.webmanifest) - Service Workers to create an offline application (see
./src/ngsw-config.json) - socket.io (still work in progress and TEMPORARY DISABLED. Check this issue
- Reactive storage based on Redux
- @ngrx/store >= 9 with the new 'create...' apis
- @ngrx/store-devtools >= 9
- angular-cli
- different profiles: 'development', 'development with HMR', 'production' and 'production with SSR' (TEMPORARY DISABLED)
- Hot Module Replacement (HMR)
- Tree shaking
- SASS support
- build-optimizer for production builds
- Bundle Analyzer
- Proxying support (optional to proxy your rest services with webpack-dev-server)
- Server Side Rendering with angular-universal (TEMPORARY DISABLED - remember to enable SSR on CIs)
- AppShell (still work in progress and TEMPORARY DISABLED. Check this issue
- Testing
- Unit testing with Karma and Jasmine
- Custom advanced configuration to specify different browsers on CIs (check 'getBrowsers()' in
./karma.conf.js) - Multiple launcher for browsers (Chrome and ChromeHeadless). See
karma.conf.js - Chrome Headless support to run unit tests (better than PhantomJS)
- Multiple coverage reporters:
json,html,lcovonly,mochaand also in your console
- Custom advanced configuration to specify different browsers on CIs (check 'getBrowsers()' in
- End to end (E2E) testing with Protractor and WebDriver JS
- Code coverage with IstanbulJs
- Unit testing with Karma and Jasmine
- Code analysis and quality
- Documentation
- Docker
- Docker with the production build (no ssr at the moment) and ngnix (TEMPORARY DISABLED)
- See all my public repos here Docker Hub
- Continous Integration
- Multiple server-side implementations with NodeJS
- NodeJS + Express in Javascript (see
./servers/node-express-js) - NodeJS + Express in Typescript (see
./servers/node-express-ts) - NodeJS + Koa in Javascript (see
./servers/node-koa-js)
- NodeJS + Express in Javascript (see
- and many more...
- ??/11/2019 - COMING SOON!!! - 1.0.0 - Check HERE
- 04/03/2018 - 1.0.0-beta.2 - Check HERE
- 01/06/2018 - 1.0.0-beta.1 - Check HERE
Full changelog HERE
This reduced structure is based on Angular style-guide and on my personal experience. For the full file structure check HERE.
angular-cli-skeleton/
ββ.circleci/ * circle ci 2 config folder (is a CI service free for open source projects)
ββe2e/ * end-to-end tests with Protractor
β ββsrc * end-to-end test files
β β ββapp.e2e-spec.ts * e2e test for the main page
β β ββapp.po.ts * e2e page oject for home page
β ββprotractor.config.js * protractor config file for e2e testing
β ββprotractor-ci.config.js * protractor config file for e2e testing in Continous Integration
β ββtsconfig.ts * config file for typescript when running e2e tests
β
ββservers/ * server-side implementations to manage authentication
β ββnode-express-js * NodeJS with ExpressJS Javascript implementation
β ββnode-express-js * NodeJS with ExpressJS Typescript implementation
β ββnode-koa-js * NodeJS with KoaJS Javascript implementation
β
ββsrc/ * main source folder
β ββapp/ * source folder of 'app' SPA
β β ββapp-shell/ * app-shell folder (STILL UNUSED)
β β β
β β ββcore/ * CoreModule provides services. You can import this module only on time in the root module
β β β ββactions/ * folder of ngrx actions
β β β β ββhello-example.actions * hello-example ngrx action
β β β ββreducers/ * folder of ngrx reducers
β β β β ββhello-example.reducers * hello-example ngrx reducer
β β β ββservices/ * services of the CoreModule
β β β β ββauth-guard.service.ts * AuthGuard to check authentication on Angular routes
β β β β ββauth.service.ts * authentication service with login, logout and so on
β β β β ββexample.service.ts * example of a service that call an authenticated api called /secret
β β β β ββgithub.service.ts * example of a service with HttpClient that call github.com
β β β β ββservices.ts * export an array of services to easely import into the module's definition
β β β ββcore.module.ts * definition of the CoreModule
β β β ββmodule-import-guard.ts * guard to prevent multiple import of the CoreModule
β β β
β β ββpages/ * pages/features of the 'app' SPA
β β β ββ404/
β β β β ββnot-found.component.ts * 404 component shown for route '**'
β β β ββhome/
β β β β ββhome.component.ts * homepage component shown for route '/'
β β β β ββhome.html * homepage template
β β β β ββhome.scss * homepage scss file with local styles
β β β ββlazy/ * lazy loaded module shown for route 'lazy'
β β β β ββactions/ * ngrx actions only for this lazy loaded module
β β β β β ββpage-num.actions * page-num ngrx action
β β β β ββreducers/ * ngrx reducers only for this lazy loaded module
β β β β β ββindex.ts * main file of all reducers of this lazy loaded module
β β β β β ββpage-num.reducers * page-num ngrx reducer
β β β β ββlazy.component.spec.ts * unit test of lazy loaded component
β β β β ββlazy.component.ts * lazy loaded component
β β β β ββlazy.html * template of the lazy loaded component
β β β β ββlazy.module.ts * definition of the lazy loaded module
β β β β ββlazy.routes.ts * local routes for the lazy loaded module
β β β β ββlazy.scss * lazy loaded module's scss file with local styles
β β β profile/
β β β β ββprofile.component.ts * profile page with a call to a protected api (authenticated api with JWT). Is also contains font-awesome and ng- bootstrap examples.
β β β β ββprofile.html * profile template
β β β β ββprofile.scss * profile scss file with local styles
β β β ββsw/
β β β β ββsw.component.ts * service-worker component shown for route '/ sw'
β β β β ββsw.html * service-worker template
β β β β ββsw.scss * service-worker scss file with local styles
β β β ββcomponents.ts * export an array of components to easely import into the module's definition
β β β
β β ββreducers/ * define main ngrx reducer for the app SPA
β β β
β β ββshared/ * SharedModule provides common components, directives... It can be imported more times also by sub-modules
β β β ββcomponents/ * components of the SharedModule
β β β β ββfooter/ * footer component
β β β β ββnavbar/ * navbar componet
β β β β ββpage-header/ * page header component
β β β β ββcomponents.ts * export an array of components to easely import into the module's definition
β β β ββshared.module.ts * definition of the SharedModule
β β β
β β ββapp-routing.module.ts * routes module of the app SPA
β β ββapp.component.html * main template's component of the application
β β ββapp.component.scss * scss file for the main component of the application
β β ββapp.component.ts * main component of the application
β β ββapp.module.ts * root module of the application (browser- side)
β β ββapp.server.module.ts * root module of the application (server- side)
β β
β ββassets/ * images, icons and other stuff
β β
β ββenvironments/ * folder loaded by angular cli depending on dev, prod...
β β ββenvironment.hmr.ts * environment file for development with hmr
β β ββenvironment.prod.ts * environment file for production
β β ββenvironment.ts * environment file for development without hmr
β β
β ββlocale/ * localization file with all translations (english and italian only to do an example of i18n)
β β
β ββtheme/ * folder with a custom theme in scss
β β
β ββ_variables.scss * file with scss variables to customize bootstrap and to import fonts from third-party deps
β ββbrowserconfig.xml * config file for microsoft applications
β ββfavicon.png * application's icon
β ββhmr.ts * file to init HMR ir running with hrm enabled
β ββindex.html * index file of this application
β ββmain.server.ts * main file to boot this applcation on server-side with angular-universal
β ββmain.ts * main file to boot this applcation on browser-side (client)
β ββmanifest.webmanifest * web manifest
β ββpolyfills.ts * polyfills used by Angular to support older browsers
β ββstyles.scss * main scss file to define global styles
β ββtest.ts * test config file to load .spec.ts files
β ββtslint.json * tslint config file
β
ββangular-cli.json * angular-cli config file
ββbrowserslist * file to configure which browsers are supported by this application
ββkarma.conf.js * karma config file for unit testing
ββngsw-config.json * Service Workers config file
ββproxy.conf.json * proxy configuration for angular-cli when using 'npm start'
ββserver.ts * NodeJs server to enable Server Side Rendering
ββstatic.paths.ts * array with paths used by server.ts for Server Side Rendering
ββtsconfig.app.json * typescript's config file for the application (browser-side)
ββtsconfig.json * generasl typescript's config file
ββtsconfig.server.json * typescript's config file for the application (server-side)
ββtsconfig.spec.json * typescript's config file for unit testing
ββtslit.json * TSLint config file
ββwebpack.server.conf.js * webpack config file to build server-side (angular-universal)
- Nodejs >= 12.0.0 (please use always the latest version)
- npm >= 6.9.0 (please use always the latest version)
- build and run the front-end of this project with angular-cli, but authentication won't work (obviously, because It needs a server)
- build this project and run it with one of the two servers in
./servers(authentication is working!!!) - build and run this project with angular-universal (authentication not supported yet - COMING SOON)
This is a 'work in progress' project, so if you need other info, please open an issue. At the moment, documentation and README are minimalistic.
npm install -g http-server
npm install(from the folder of this project)cd servers/node-express-js && npm installcd servers/node-express-ts && npm installcd servers/node-koa-js && npm install
Useful commands to build the front-end without to run the server-side
npm run deploy is the recommended command
npm run build:dev
npm run build:prod
Build both client and server apps in 'dist' folder (prod + AOT + build-optimizer + angular-universal) without i18n
npm run build:ssr
At the moment I didn't add authentication to the SSR server
Deploy client app with i18n support in all servers public folders (prod + AOT + build-optimizer + i18n) [recommended]
npm run deploy
npm start
cd dist/clienthttp-server- access to
localhost:8080
cd disthttp-server- access to
localhost:8080/enorlocalhost:8080/it
npm run serve:ssr
npm run deploycd servers/node-express-js && npm start
npm run deploycd servers/node-express-ts && npm start
npm run deploycd servers/node-koa-js && npm start
npm test
npm run webdriver:update(if you have problems, try again removing./node_modulesand executingnpm installagain)npm run e2e
To generate documentation with typedocs and compodoc (check docs folder index.html files for the result)
npm run docs
npm run clean
- Run either
npm run build:dev:statsornpm run build:prod:stats - Open analyzer with
npm run analyzeto see the result
To get more help on the Angular CLI use ng help or go check out the Angular CLI README.
To deploy with a custom path, please check here: https://angular.io/guide/deployment
For other questions, please feel free to open an issue.
I'm open to contributions and pull requests.
MIT License
Copyright (c) 2017-2019 Stefano Cappa
This license is valid to all my files in this repo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If you like my projects you can do a free donation here
Created by Stefano Cappa