@daniel-cmorales/pozoljs v0.5.5
Pozol CLI
Pozoljs is a package to initialize your node-express project with typescript or javascript and create full components to develop your backend apps faster.
Pozoljs will helps you to get a node-express project more escalable with a good estructure for folders and files.
Pozoljs is not a framework.
Getting start
Installing the CLI
Global installation.
npm install -g @daniel-cmorales/pozoljs
Local installation.
npm install @daniel-cmorales/pozoljs
When the package is installed, you will can use pozoljs
command.
The CLI :book:
Some concepts
- Component is a small folder that contains the principal modules of an endpoint. For example, you will make endpoints about users, so in the users folder you have controller, service, routes files (and interface if it is a typescript project).
- Service connect with the database or return data that you need. In other words, the service provides data to the controller. In the start, the service file implements find, save, update and delete methods.
- Controller manipualte the data that obtains of the service or of the route. The controller call service methods through dependencie injection.
- Routes about your component like GET, POST, PUT or DELETE.
- Interface is using in typescript like a data type.
Build your project using pozoljs
Create a new node-express projects with an initial structure.
pozoljs <name> [options]
Options available
Files Structure
Pozoljs builds a node-express project with an initial structure. This one helps you to develop faster and escalable code. The initial structure is:
├────src
│ ├───api
│ │ └───component
│ │ │ ├───component.controller.ts/js
│ │ │ ├───component.interface.ts/js
│ │ │ ├───component.routes.ts/js
│ │ │ └───component.service.ts/js
│ │ └───index.ts/js
│ ├───config
│ │ └────environments
│ │ ├───development.ts/js
│ │ ├───index.ts/js
│ │ └───production.ts/js
│ ├───global
│ │ ├───helpers
│ │ │ └───abstract.service.ts/js
│ │ ├───interfaces.ts/js
│ │ └───variables.ts/js
│ ├───middlewares
│ ├───database.ts/js
│ ├───index.ts/js
│ └───server.ts/js
├───.editorconfig
├───.env
├───.gitignore
├───package.json
├───pozoljs.config.json
├───package-lock.json
└───tsconfig.json
- pozol config: pozoljs needs this file configuration to generate files.
- src: development code is here.
- api: all your components will be created here.
- config: the configuration like variables. Pozoljs create the enviroments folder with the development and production files.
- global: your project maybe using external services like others REST API or maybe you have variables that you will use in much components.
- middlewares: here you create all the middlewares that you will use in others components.
- main files (index, database and server): this files you can code the server and database configuration, and you can initialize your project using index file. Pozoljs code the initial server configuration for you.
Commands
All commands have the full type and abreviation type.
pozoljs g <schematic> [name]
Schematics available
About the project created
The project created using pozoljs is to get an initial and generic structure of all your node projects.
In the package.json there are 3 commands:
- Run
npm run dev
to execute the project in development mode. - Run
npm run build
to create the production project (just for typescript). - Run
npm run start
to execute the project in the production mode.
For more information, you can execute: pozoljs --help