Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(examples): add with-nestjs example #8162

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Neosoulink
Copy link
Contributor

@Neosoulink Neosoulink commented May 16, 2024

Description

Related issue: #8131

I recently created an issue where I explained why it's useful to use Nestjs with Turborepo.
This PR adds a new example integration with nestjs!

I recorded a short video showing how it's working:

turborepo_with-nestjs_commands-test.mov

Testing Instructions

This new example is located at ./examples/with-nestjs/.

It uses a basic turborepo nextjs for apps/web and a customized nestjs app located at apps/api.

To launch all the apps and packages in dev mode, run pnpm run dev.

The apps/api server includes a basic resource (CRUD) example where the apps/web use the apps/api links.findAll API methods to retrieve the displayed links.
They use the same package @repo/api to retrieve the shared entity and dtos.
Even if the @repo/api mainly uses the nestjs configuration, it can be used for Nextjs and/or any other kind of apps.

For more information, I documented it in the root/README

That's it for now. I tried not to put too many things in this example and follow the flow of other examples...
Please let me know if I missed anything. I'll be glad to have your feedback.

cc: @anthonyshew

Will close #8131

@Neosoulink Neosoulink requested review from anthonyshew and a team as code owners May 16, 2024 19:22
@Neosoulink Neosoulink requested a review from paulogdm May 16, 2024 19:22
@turbo-orchestrator turbo-orchestrator bot added area: examples Improvements or additions to examples needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels May 16, 2024
Copy link

vercel bot commented May 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

7 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jun 16, 2024 3:04pm

Copy link

vercel bot commented May 16, 2024

@Neosoulink is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@ijjk
Copy link
Member

ijjk commented May 16, 2024

Allow CI Workflow Run

  • approve CI run for commit: b2fada3

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

### Description

- Add the `with-nestjs` example
- Init a basic `web nextjs` app
- Init a basic `api nestjs` app
- use the basic turborepo config
### Description

- Set general `eslint` & `perttier` config into `@repo/eslint-config`
  - Add a base `eslint` config file
- Move common `eslint` & `prettier` support into `@repo/eslint-repo`
- Add a base `prettier` file
- Remove format script from `apps/api` and use root `format` script
### Description

- Mix the root `,gitignore` with the `nestjs` generated `.gitignore`
### Description

- Add a new tsconfig file for `nestjs` into `@repo/typescript-config`.
- Add `@repo/typescript-config` as `apps/api` dev-dependency.
  - Extends `@repo/typescript-config/nestjs.json`
### Description

- Add `@repo/jest-config`  package
  - Configure a base common jest config file
  - Add a `nestjs` config file
  - Add a `nextjs` config file
- Use `playwright` for `NextJs` e2e testing
  - Add a base unit & e2e Nextjs testes
- Sync testes command with turborepo
### Description

- Add a `@repo/api` package
  - Use `nestjs` environment setup
  - Add links `entity` and `dto` examples
- Sync/Use `@repo/api` into `apps/api`
  - Add `Link` resource (CRUD) example
- Sync/Use `@repo/api` into `apps/web`
  - Retrieve links frorm `apps/api`
  - Refactor root page unit-test for async component
### Description

- Update the root `README` documentation
- Update the `apps/api` `README` documentation
- Update the `apps/web` `README` documentation
@Neosoulink Neosoulink requested a review from a team as a code owner June 14, 2024 08:59
@turbo-orchestrator turbo-orchestrator bot added area: ci area: docs Improvements or additions to documentation owned-by: turbopack labels Jun 14, 2024
Copy link
Contributor

@anthonyshew anthonyshew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, nice to see you again!

A couple things before I go too deep:

  • I'm seeing turbo build and turbo test:e2e fail out of the box. Can this be fixed?
  • We've released Turborepo 2 since this was made. Would you be able to use npx @turbo/codemod upgrade to get upgraded? Thanks!

@Neosoulink
Copy link
Contributor Author

Neosoulink commented Jun 16, 2024

Hey @anthonyshew, Sure

let me upgrade things

Neosoulink and others added 2 commits June 16, 2024 14:49
### Description

- Use `npx @turbo/codemod upgrade` to migrate to `turbo` v2

Co-Authored-By: Anthony Shew <35677084+anthonyshew@users.noreply.github.com>
### Description

- Fix `turbo eslint` configs
  - Unified `prettier` & `turbo` config at `base.js` eslint config file
- Use improved `build` script for `@repo/api`
  - Merge use only one `tsconfig` file
  - Correctly export files from output folder (`dist`)
  - remove unusued `tsup` & `swc/core`
- Format codes with `turbo format`

Co-Authored-By: Anthony Shew <35677084+anthonyshew@users.noreply.github.com>
@Neosoulink
Copy link
Contributor Author

Neosoulink commented Jun 16, 2024

Hey @anthonyshew, just updated it

here's the updated video:

Screen.Recording.2024-06-16.at.4.59.33.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Improvements or additions to examples needs: triage New issues get this label. Remove it after triage owned-by: turborepo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Examples: with-nestjs example implementation
3 participants