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

Examples: with-nestjs example implementation #8131

Closed
Neosoulink opened this issue May 13, 2024 · 9 comments · Fixed by #8162
Closed

Examples: with-nestjs example implementation #8131

Neosoulink opened this issue May 13, 2024 · 9 comments · Fixed by #8162

Comments

@Neosoulink
Copy link
Contributor

Neosoulink commented May 13, 2024

What is the improvement or update you wish to see?

It would be great to have a with-nestjs example integrated

Is there any context that might help us understand?

Starting a NestJs project managed within turbo-repo is just great and I recommend it!

However, the turbo repo doesn't include an official example to start a NestJS Turbo-repo project.

@Neosoulink
Copy link
Contributor Author

If it's possible, I'm volunteering to contribute to this one

@anthonyshew
Copy link
Contributor

No one on our team has experience with Nest.js so we'd appreciate a contribution for this!

@Cirilord
Copy link

Cirilord commented Jun 12, 2024

@Neosoulink what the config you use in launch.json for debug purpose in nestjs?

@Neosoulink
Copy link
Contributor Author

Hey @Cirilord,
I did not integrate a launch.json for this example

#8162

@Cirilord
Copy link

Do you have any idea what it would look like?

@Neosoulink
Copy link
Contributor Author

@Cirilord,
I'm not sure about the context... Could you share more details or needed behavior?

@Cirilord
Copy link

Sure, i'm trying to create a configuration inside launch file to debug my nextjs application

@Neosoulink
Copy link
Contributor Author

@Cirilord okay...
Note that you're free to configure your debugger as you prefer and it's beyond this issue's scope.

But, as an example, if you want to set a configuration that launches both apps in development mode (/api and web), you can use TurboRepo as follows:

{
  "version": "0.0.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch apps in dev mode (using turbo repo)",
      "runtimeExecutable": "pnpm",
      "runtimeArgs": ["run-script", "dev"],
        "env": {
          "NODE_ENV": "development"
      },
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]
}

This configuration will execute the script at the root of your project and will launch your apps/packages in the development mode.

@Cirilord
Copy link

Thanks @Neosoulink! It worked very well

anthonyshew added a commit that referenced this issue Jul 12, 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:


https://github.com/vercel/turbo/assets/44310540/8261e72d-6586-4a27-ae6e-e1ab943d2c3a

### 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 `dto`s.
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

---------

Co-authored-by: Anthony Shew <anthony.shew@vercel.com>
Co-authored-by: Anthony Shew <35677084+anthonyshew@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants