GithubHelp home page GithubHelp logo

borjapazr / angular-skeleton Goto Github PK

View Code? Open in Web Editor NEW
32.0 3.0 6.0 2.59 MB

๐Ÿ…ฐ๏ธ๐Ÿฆธ Template to start developing a Progressive Web Application with Angular, Transloco, Angular Universal, SSR/ISR, TailwindCSS, Jest, Cypress, ESLint, Prettier, Husky, etc.

Home Page: https://angular-skeleton.bpaz.dev

License: MIT License

JavaScript 12.23% TypeScript 70.46% HTML 7.26% SCSS 6.02% Shell 0.76% Makefile 1.63% Dockerfile 1.64%
angular ssr angular14 isr pwa seo transloco cypress eslint husky jest prerender prettier angular-universal tailwindcss hacktoberfest

angular-skeleton's Introduction

Node.js, Typescript and Express template
Node.js, Typescript and Express template

GitHub package.json version GitHub CI Workflow Status GitHub CD Workflow Status GitHub LICENSE Demo Documentation

๐Ÿ…ฐ๏ธ๐Ÿฆธ Production-ready template for Progressive Web Applications implemented with Angular, TailwindCSS, Transloco, ngx-isr, etc.

โ„น๏ธ About โ€ข ๐Ÿ“‹ Features โ€ข ๐Ÿค Contributing โ€ข ๐Ÿ›ฃ๏ธ Roadmap โ€ข ๐ŸŽฏ Credits โ€ข ๐Ÿšฉ License


โ„น๏ธ About

The main goal of this project is to provide a base template for the generation of a production-ready web application made with Angular. The idea is to avoid having to configure all the tools involved in a project every time it is started and thus be able to focus on the definition and implementation of the business logic.

๐Ÿ“ฃ This is an opinionated template. The architecture of the code base and the configuration of the different tools used has been based on best practices and personal preferences.

๐Ÿš€ Quick start

  • Start project in development mode:

    npm run start:dev
  • Start project in production mode:

    npm run start:prod

๐Ÿ“‹ Features

  • Angular: Angular is a platform for building mobile and desktop web applications.
  • Angular Universal: Server-side rendering (SSR) with Angular Universal.
  • TailwindCSS: A utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.
  • ng-lazyload-image: A super small libary for lazy loading images for Angular apps with zero dependencies
  • ngx-isr: Incremental Static Regeneration (ISR) enables developers and content editors to use static-generation on a per-page basis, without needing to rebuild the entire site. With ISR, you can retain the benefits of static while scaling to millions of pages.
  • i18n using Transloco
  • Unit tests using Jest
  • e2e tests using Cypress
  • Spell check
  • Linting with ESLint
  • Formatting with Prettier
  • Stylelint: A mighty, modern linter that helps you avoid errors and enforce conventions in your styles.
  • HTMLHint: A linter for HTML that helps you avoid errors and enforce conventions in your HTML.
  • Commit messages must meet conventional commits format
  • Git hooks with Husky and lint-staged
  • Containerised using Docker and Docker Compose
  • GitHub Actions
  • Makefile as project entrypoint
  • A lot of emojis ๐Ÿ›ธ

๐Ÿ—‚ Codebase structure

angular-skeleton/
โ”œโ”€โ”€ .github/
โ”œโ”€โ”€ .husky/
โ”œโ”€โ”€ .vscode/
โ”œโ”€โ”€ cypress/
โ”‚   โ”œโ”€โ”€ e2e/
โ”‚   โ”œโ”€โ”€ fixtures/
โ”‚   โ”œโ”€โ”€ support/
โ”‚   โ”œโ”€โ”€ coverage.webpack.js
โ”‚   โ””โ”€โ”€ tsconfig.json
โ”œโ”€โ”€ docker/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ constants/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ enums/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ guards/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ handlers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ interceptors/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ loaders/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ resolvers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ strategies/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ tokens/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ...
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ core.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ features
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ feature-a
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ pages/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ...
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ home-routing.module.ts
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ home.module.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ feature-b
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”‚   โ”œโ”€โ”€ shared/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ directives/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ modules/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ pipes/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ shared.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app-routing.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app.browser.module.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app.component.html
โ”‚   โ”‚   โ”œโ”€โ”€ app.component.scss
โ”‚   โ”‚   โ”œโ”€โ”€ app.component.ts
โ”‚   โ”‚   โ”œโ”€โ”€ app.module.ts
โ”‚   โ”‚   โ””โ”€โ”€ app.server.module.ts
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ”œโ”€โ”€ i18n/
โ”‚   โ”‚   โ”œโ”€โ”€ icons/
โ”‚   โ”‚   โ””โ”€โ”€ images/
โ”‚   โ”œโ”€โ”€ environments/
โ”‚   โ”œโ”€โ”€ styles/
โ”‚   โ”‚   โ”œโ”€โ”€ abstracts/
โ”‚   โ”‚   โ”œโ”€โ”€ base/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ layout/
โ”‚   โ”‚   โ”œโ”€โ”€ vendors/
โ”‚   โ”‚   โ””โ”€โ”€ main.scss
โ”‚   โ”œโ”€โ”€ types/
โ”‚   โ”œโ”€โ”€ favicon.ico
โ”‚   โ”œโ”€โ”€ favicon.png
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ jest.mocks.ts
โ”‚   โ”œโ”€โ”€ jest.setup.ts
โ”‚   โ”œโ”€โ”€ main.browser.ts
โ”‚   โ”œโ”€โ”€ main.server.ts
โ”‚   โ”œโ”€โ”€ manifest.webmanifest
โ”‚   โ”œโ”€โ”€ polyfills.ts
โ”‚   โ”œโ”€โ”€ robots.txt
โ”‚   โ””โ”€โ”€ styles.scss
โ”œโ”€โ”€ .browserslistrc
โ”œโ”€โ”€ .commitlintrc.js
โ”œโ”€โ”€ .cspell.json
โ”œโ”€โ”€ .czrc
โ”œโ”€โ”€ .dockerignore
โ”œโ”€โ”€ .editorconfig
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ .eslintcache
โ”œโ”€โ”€ .eslintignore
โ”œโ”€โ”€ .eslintrc.js
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ .htmlhintrc
โ”œโ”€โ”€ .lintstagedrc.js
โ”œโ”€โ”€ .ncurc.js
โ”œโ”€โ”€ .npmignore
โ”œโ”€โ”€ .prettierignore
โ”œโ”€โ”€ .prettierrc.js
โ”œโ”€โ”€ .stylelintcache
โ”œโ”€โ”€ .stylelintignore
โ”œโ”€โ”€ .tool-versions
โ”œโ”€โ”€ .versionrc.js
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ Makefile
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ TODO.md
โ”œโ”€โ”€ angular.json
โ”œโ”€โ”€ cypress.config.ts
โ”œโ”€โ”€ jest.config.js
โ”œโ”€โ”€ ngsw-config.json
โ”œโ”€โ”€ nyc.config.js
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ routes.txt
โ”œโ”€โ”€ server.ts
โ”œโ”€โ”€ stylelint.config.js
โ”œโ”€โ”€ tailwind.config.js
โ”œโ”€โ”€ transloco.config.js
โ”œโ”€โ”€ tsconfig.app.json
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ tsconfig.server.json
โ””โ”€โ”€ tsconfig.spec.json

๐ŸŽ›๏ธ Code style and best practices

โš ๏ธ This section has yet to be fully documented.

  • Prettier
  • ESLint
  • Stylelint
  • HTMLHint
  • commitlint

๐Ÿ›ข Barrel files

Barrel files are used to organize exports. This significantly reduces the size of the import blocks.

๐Ÿž Application layout

โš ๏ธ This section has yet to be fully documented.

  • Flexbox layout
  • TailwindCSS
  • Dark theme
  • Styles (SCSS) folder structure

๐ŸŒ Internationalization (i18n)

โš ๏ธ This section has yet to be fully documented.

  • Transloco
  • Route language prefixing

๐ŸŽ Server Side Rendering (SSR) and Incremental Static Rendering (ISR)

โš ๏ธ This section has yet to be fully documented.

  • Angular Universal
  • Domino
  • ngx-isr

๐Ÿ“‡ Prerendering

โš ๏ธ This section has yet to be fully documented.

  • Angular Universal

๐Ÿ“ˆ SEO

โš ๏ธ This section has yet to be fully documented.

  • CustomPageTitleStrategy

๐Ÿ”ฐ Progressive Web Application (PWA)

โš ๏ธ This section has yet to be fully documented.

  • Service Worker configuration
  • Stale while revalidate strategy
  • Offline support

๐ŸŒ  Image lazy-loading

โš ๏ธ This section has yet to be fully documented.

  • ng-lazyload-image

๐Ÿ’จ Module preloading strategies

โš ๏ธ This section has yet to be fully documented.

๐Ÿ›ฃ Route reusability

  • RouteReuseStrategy

๐Ÿ’ Pipes

โš ๏ธ This section has yet to be fully documented.

๐Ÿงช Testing

โš ๏ธ This section has yet to be fully documented.

Unit and integration tests

  • Jest
  • jest-extended

e2e tests

  • Cypress

๐Ÿ Makefile rules

The main actions on this project are managed using a Makefile as an entrypoint.

Usage: make TARGET [ARGUMENTS]

Targets:
  build/csr                 Build csr image
  build/ssr                 Build ssr image
  clean/csr                 Clean CSR application
  clean/ssr                 Clean SSR application
  help                      Show this help
  start/csr                 Start application in Client Side Rendering mode
  start/ssr                 Start application in Server Side Rendering mode
  stop/csr                  Stop application in Client Side Rendering mode
  stop/ssr                  Stop application in Server Side Rendering mode

โšก Scripts

package.json scripts:

  ...
  "scripts": {
    "start:dev": "ng serve --configuration development --port 4200 --open",
    "start:prod": "ng serve --configuration production --port 4300 --open",
    "start:ssr:dev": "ng run angular-skeleton:serve-ssr:development --port 4201 --open",
    "start:ssr:prod": "ng run angular-skeleton:serve-ssr:production --port 4301 --open",
    "build:dev": "rimraf dist && ng build --configuration development",
    "build:prod": "rimraf dist && ng build --configuration production && npm run build:optimize",
    "build:ssr:dev": "rimraf dist && ng build --configuration development && ng run angular-skeleton:server:development",
    "build:ssr:prod": "rimraf dist && ng build --configuration production && ng run angular-skeleton:server:production && npm run build:optimize",
    "build:prerender:dev": "rimraf dist && ng run angular-skeleton:prerender:development",
    "build:prerender:prod": "rimraf dist && ng run angular-skeleton:prerender:production && npm run build:optimize",
    "build:optimize": "run-s optimize:* && ngsw-config dist/browser ./ngsw-config.json",
    "optimize:i18n": "transloco-optimize dist/browser/assets/i18n",
    "serve:pwa": "http-server -p 4400 -P http://localhost:4400? dist/browser -o",
    "serve:ssr": "node dist/server/main.js",
    "i18n:extract": "transloco-keys-manager extract",
    "i18n:find": "transloco-keys-manager find",
    "check:types": "tsc --pretty --noEmit && tsc --project cypress/tsconfig.json --pretty --noEmit",
    "check:format": "prettier --check .",
    "check:lint": "eslint . --ext .js,.ts --color",
    "check:html": "htmlhint .",
    "check:scss": "stylelint 'src/**/*.{css,scss}' --color",
    "check:spelling": "cspell --config=.cspell.json \"{README.md,TODO.md,.github/*.md,src/**/*.ts,src/**/*.json}\"",
    "check:i18n": "transloco-validator src/assets/i18n/*.json src/assets/i18n/**/*.json",
    "check:staged": "lint-staged",
    "fix:format": "prettier --check --write --ignore-unknown .",
    "fix:lint": "npm run check:lint -- --fix",
    "fix:scss": "npm run check:scss -- --fix",
    "test": "cross-env NODE_ENV=test jest --verbose --colors --runInBand",
    "test:spec": "npm run test -- --testPathPattern=spec",
    "test:unit": "npm run test -- --testPathPattern=unit",
    "test:int": "npm run test -- --testPathPattern=integration",
    "e2e": "ng e2e",
    "e2e:run": "ng run angular-skeleton:cypress-run",
    "e2e:open": "ng run angular-skeleton:cypress-open",
    "e2e:coverage:view": "http-server -p 9004 ./coverage-e2e/lcov-report -o",
    "test:watch": "npm run test -- --watch",
    "test:coverage": "npm run test -- --coverage --silent",
    "test:coverage:view": "http-server -p 9003 ./coverage/lcov-report -o",
    "reset-hard": "git clean -dfx && git reset --hard && npm install",
    "version": "standard-version -t",
    "prepare-release": "run-s reset-hard version",
    "commit": "cz",
    "update-deps": "npm-check-updates -u",
    "prepare": "husky install"
  },
  ...

๐Ÿค Contributing

Just fork and open a pull request. All contributions are welcome ๐Ÿค—

๐Ÿ›ฃ๏ธ Roadmap

Please, check TODO for the current roadmap.

๐ŸŽฏ Credits

To implement this project I have based myself on many similar projects. There were countless of them and I gave them all a star.

๐Ÿ™ Thank you very much for these wonderful creations.

โญ Stargazers

Stargazers repo roster for @borjapazr/angular-skeleton

๐Ÿšฉ License

MIT @ borjapazr. Please see License for more information.

angular-skeleton's People

Contributors

borjapazr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

angular-skeleton's Issues

Does it support ssr?

I tried to run the project using, npm run build:ssr:prod, and when I checked the source of the page I couldn't find the content in the source, so does this project support srr, and how to run it?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.