nx-ng-nest-universal
nx-ng-nest-universal copied to clipboard
Nx Workspace with a seperated Nest App for Angular Universal SSR.
Nx Workspace with Angular Universal via Nest
This project was generated using Nx. It currently includes an Angular App with server side rendering (SSR) via Nest.
master branch -> nx workspace with two apps (angular + nest) -> Step 1. - 6.
single-app branch -> nx workspace with single app (angular) -> Step 1. - 4.
Steps to Reproduce
1. Create Nx Workspace
npx create-nx-workspace nx-ng-nest-universal --npm-scope=ss --style=scss
2. Generate Angular App
ng g app ng-test-app --prefix=ss-test --routing=true --style=scss
3. Add Angular Universal module for Nest
ng add @nestjs/ng-universal --clientProject=ng-test-app --project=ng-test-app
4. Adjustments to make everything work. (s. Commit)
1. rimraf yarn.lock && npm i (to avoid packages conflicts)
2. Fix fileReplacements for ng-test-app:server:production in angular.json
3. Edit webpack.server.config.js
✔️ Nx App + SSR working. Move on if you want to have nest as a seperated app in your workspace.
5. Generate Nest App
ng g node-app nest-test-app --framework=nestjs
6. Adjustments to use the freshly generated Nest App for SSR (s. Commit)
1. Mainly move and edit generated files from Step 3
2. Add @nestjs/ng-universal to nest app in workspace
✔️ Nx Workspace with seperated Nest App for SSR working.
Getting Started (Build and Serve)
> git clone https://github.com/servrox/nx-ng-nest-universal.git
> cd nx-ng-nest-universal\
> npm i
npm run build:ssr && npm run serve:ssr
> npm run go
or for development
> npm run serve
UI at http://localhost:4000/
API at http://localhost:4000/api
Built With
- Angular CLI - version 7.3.9
- Angular Universal - version 7.1.1
- nest - version 6.2.4
- Nx - version 7.8.6
Authors
- Marcel Mayer - servrox.solutions