1.0.1 ā€¢ Published 4 years ago

@lykos94/nsgen v1.0.1

Weekly downloads
2
License
GPL-3.0-only
Repository
github
Last release
4 years ago

NSGen

A project structure generator for your NodeJS backend, based on your configurations and common best-practices

Check out the full documentation


You create a simple configuration file, NSGen takes care of creating an entire project based on express in NodeJS. Among other features, there are the following:

  • Creation of Data Models that define the structure of your database
  • Automatic generation of routes and APIs you need
  • Creation of the main services for your Data Model

You're off to a better start

An example can be more explanatory than a thousand words (or was it a picture...?). Below you can see the file from which you can start:

config:
  name: my-application
  description: Backend for my-application
  db:
    name: testdb
    username: john
    password: s3cr3t
    type: mysql
model:
  user:
    username:
      type: string
      null: false
    password:
      type: string
  article:
    title: string
    description:
      type: text
    published:
      type: date
api:
  users:
    crud: true
    model: user
  articles:
    model: article
    get:
    post:
    put:

...and that's it! Build directly with

$ nsgen --config config.yaml

and this will be the resulting structure of your project:

ā””ā”€ā”€ šŸ“ my-application
    ā”œā”€ā”€ šŸ“ api
    ā”‚Ā Ā  ā”œā”€ā”€ šŸ—’ index.ts
    ā”‚Ā Ā  ā”œā”€ā”€ šŸ—’ post.ts
    ā”‚Ā Ā  ā””ā”€ā”€ šŸ—’ users.ts
    ā”œā”€ā”€ šŸ“ config
    ā”‚Ā Ā  ā””ā”€ā”€ šŸ—’ index.ts
    ā”œā”€ā”€ šŸ“ models
    ā”‚Ā Ā  ā”œā”€ā”€ šŸ—’ article.ts
    ā”‚Ā Ā  ā””ā”€ā”€ šŸ—’ user.ts
    ā”œā”€ā”€ šŸ—’ index.ts
    ā”œā”€ā”€ šŸ—’ .env
    ā”œā”€ā”€ šŸ—’ .gitignore
    ā”œā”€ā”€ šŸ—’ package.json
    ā”œā”€ā”€ šŸ—’ README.md
    ā”œā”€ā”€ šŸ—’ sequelize.ts
    ā””ā”€ā”€ šŸ—’ tsconfig.json

Install all the required dependencies and compile:

$ yarn
$ tsc
$ npm install
$ tsc

That's right. You don't have to do anything else, just start your new server.

$ node dist/index.js
1.0.1

4 years ago

1.0.0

4 years ago