Git Product home page Git Product logo

nestjs-prisma-template's Introduction

Naming Convetions

Database

-
database name lowercase with words separated by underscores
table name lowercase with words separated by underscores
(singular)
properties lowercase with words separated by underscores
foriegn keys tableName_propertyName

Description

This is a starter project that you can use as a NestJS template with Prisma

Installation

  • Clone the repo
$ git clone [email protected]:OsidAbu-alrub/nestjs-prisma-template.git
  • Change origin url to point to your own repo
$ git remote set-url origin <remote_url>
  • Install deps
$ yarn install

Running the app

# development
$ yarn dev

Resource directory structure

This structure must come under the src directory:

  • resource/
    • resource.contract.ts => interface that contains methods that should be implemented in the resource.service file
    • resource.controller.ts
    • resource.dto.ts
    • resource.module.ts
    • resource.service.ts => must implement resource.contract interface

P.S. You get models from prisma client after generating database

Resource generation

you can find how to generate nestjs resources here

Dealing with database

# Create migrations from your Prisma schema, apply them to the database, generate artifacts (e.g. Prisma Client)
$ npx prisma migrate dev --name init
# Pull the schema from an existing database, updating the Prisma schema
$ npx prisma db pull
# Push the Prisma schema state to the database
$ npx prisma db push

Generate prsima client

$ npx prisma generate

reload developer window if you are using vscode to access prisma client

For more info you could check prisma docs here

Testing

Coming Soon!

TODOS

  • Add global error filtering
  • Add ability to generate folder with contract, controller, dto, module, and service with package.json scripts (use blobs)
  • Add documentation for db generation commands

nestjs-prisma-template's People

Contributors

osidabu-alrub avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.