DEV Community

David (ダビッド ) for YggdrasilTS

Posted on

TypeScript Full Stack project (Part III) - NestJS, the server-side

The previous post showed the client-side part. Now, we are going to create the server-side using NestJS. That team has done a very great job with the framework but also has awesome documentation as well. If you still not knowing NestJS, I strongly recommend you to take a look.

Server-side

Let's go to create the NestJS application that we use it as server-side part using its CLI and the following options:

  • package-manager: npm. I prefer npm than yarn and I am using it inside the rest of the project.
odin@asgard:~/issues $ nest new server --package-manager npm
Enter fullscreen mode Exit fullscreen mode

The new folder structure will contain a new folder server, with the NestJS application.

issues
  ├── client
  ├── .git
  ├── .gitignore
  ├── package.json
  └── server
Enter fullscreen mode Exit fullscreen mode

To start the server from the parent folder, issues, we are going to modify the package.json adding a new start:server script.

{
  ...
  "scripts": {
    "start:server": "npm start --prefix ./server"
  },
  ...
}
Enter fullscreen mode Exit fullscreen mode

Now we are able to start the NestJS application:

odin@asgard:~/issues $ npm run start:server
Enter fullscreen mode Exit fullscreen mode

Because of the purpose of this post is not to build a NestJS application, you can get the server-side code from this repository.

If you want to know more about how to use the NestJS CLI, Kamil Mysliwiec has written a very interesting post.

In the next post, I am going to explain how to create the shared libraries part.

Top comments (0)