juandavidgamboasaenz / NextJSNestJsBackend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Donate us Support us Follow us on Twitter

Description

Nest framework TypeScript starter repository.

Project setup

$ npm install

Compile and run the project

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Run tests

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Resources

Check out a few resources that may come in handy when working with NestJS:

  • Visit the NestJS Documentation to learn more about the framework.
  • For questions and support, please visit our Discord channel.
  • To dive deeper and get more hands-on experience, check out our official video courses.
  • Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.
  • Need help with your project (part-time to full-time)? Check out our official enterprise support.
  • To stay in the loop and get updates, follow us on X and LinkedIn.
  • Looking for a job, or have a job to offer? Check out our official Jobs board.

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

Project configurations

To create a new resource use

This command create a folder with the resource and dto

nest g res resourcename

Install the Prisma tool will enhance the communication with the databases creating queries in a easier way

npm i prisma -D

or use

npm install prisma --save-dev

Now to add some models for the Domain we are using we will use this bash command to execute the inner prisma configurator and create a folder for the provided database, for further info on compatibility checkout the recipe in NestJS recipes prisma

npx prisma init --datasource-provider {database}

Initial migrations will be done using this command. For further review and version check the documentation related for the prisma migrations documentation in NestJS Migrations Prisma

An initial run of this command can generate the needed files for further use or starting with a clean database. Obviously use it wisely, a wrong command could or usage can freak the usage of it

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

npx prisma migrate dev --name init

To visualize the database schemas use the next command to enhance the visibility without us

npx prisma studio

If needed some of this schemas it can use multiple schemas for further configurations don't forget to read How to use Prisma ORM with multiple database schemas

NestJs NextJs Backend Project Folder Structure

Backend
. 
├── dist
├── node_modules
├── src
│   ├── sample  (resources)
│   ├── products (resources)
├── internal
│   ├── adapters  (Bridges to external systems, e.g., database, message queue)
│   ├── domain   (Core business logic, entities, value objects)
│   ├── events   (Event definitions and handling logic)
│   ├── handlers (Functions that process events)
│   ├── auth     (This directory will houyse all the ocmponents related to access control and authorization)
│   ├── pkg
│   │   └── eventbus (Implementation of your event bus)
│   └── services (Business logic coordinating domain and adapters)

About


Languages

Language:TypeScript 96.0%Language:JavaScript 4.0%