Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/servrox/nx-ng-nest-universal

Nx Workspace with a seperated Nest App for Angular Universal SSR.
https://github.com/servrox/nx-ng-nest-universal

angular angular-univeral angular7 enterprise-angular-applications nest nestjs nodejs nx server-side-rendering servrox ssr typescript

Last synced: 10 days ago
JSON representation

Nx Workspace with a seperated Nest App for Angular Universal SSR.

Awesome Lists containing this project

README

        

# Nx Workspace with Angular Universal via Nest

This project was generated using [Nx](https://nx.dev).
It currently includes an [Angular](https://angular.io/guide/universal) App with server side rendering (SSR) via [Nest](https://nestjs.com/).

[master](https://github.com/servrox/nx-ng-nest-universal/tree/master) branch -> nx workspace with two apps (angular + nest) -> Step 1. - 6.

[single-app](https://github.com/servrox/nx-ng-nest-universal/tree/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](https://github.com/servrox/nx-ng-nest-universal/commit/211095e0cb5c722c7cb35ffaefa982bacd4aba9c))

```
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](https://github.com/servrox/nx-ng-nest-universal/commit/b448fd2cac9540448b046af37ff71dc9d991fbe9))

```
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](https://github.com/angular/angular-cli) - version 7.3.9
- [Angular Universal](https://github.com/angular/universal) - version 7.1.1
- [nest](https://github.com/nestjs/nest) - version 6.2.4
- [Nx](https://github.com/nrwl/nx) - version 7.8.6

## Authors

- **Marcel Mayer** -
[servrox.solutions](http://servrox.solutions)