npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mustafa-alhasanat/raven-nest

v0.0.41-development

Published

Build Nest.js common blocks and files insanely faster!

Downloads

80

Readme

Raven Nest

Build Nest.js common blocks and files insanely faster!

Ho does it work?

General working principle

We use pre-built (.txt) templates and components to be copied from our library, get some modifications based on your answers to the CLI prompt, and finally pasted as (.ts) files into your project

Cloning and Injection

We have 2 processes to complete the previously mentioned action, cloning and injection. The tool clones the (.txt) files and replaces the placeholders with the given processed answers before the're placed in the given location. Then it injects some blocks of code in different files so you don't need to modify ANYTHING.

Before starting

Comments

You'll notice some comments in the generated files. We use those to locate the place in the code where the new blocks should be injected. Therefore, you can only remove them after you finish using the tool to build the blocks.

Placeholders

You might also notice some placeholder variables or values written in an uppercase format (e.g: FIELD_NAME). TypeScript will notify you about them (since they're not defined). You can change those whenever you want since their purpose is just to let you know about the options without causing runtime errors.

Getting started

Installation

  • Install nest-cli globally:
    npm install -g @nestjs/cli

  • Install ravennest globally:
    npm install -g @mustafa-alhasanat/raven-nest

  • Create a new project:
    nest new project-name
    cd project-name

  • Install the recommended dependencies and get the initial dev-kit:
    ravennest init

Now you're ready to go!

Initializing your nest app

  • Create the starting files:

    • ravennest create main
    • ravennest create --auth --format --aws --mailer app
    • ravennest create landing-page
    • ravennest create database
  • Create the special pre-built Users-table (recommended):

    • ravennest create --special user table
  • Create your first table:

    • ravennest create table
    • ravennest create column

Commands API

The init command

Install the recommended dependencies in your project if they're not yet installed. These are different from the ones installed using nest new command by default.

Usage: ravennest init

The list of dependencies:

"@nestjs/config"
"@nestjs/typeorm"
"@nestjs/platform-express"
"@nestjs/serve-static"
"@nestjs/swagger"
"class-validator"
"class-transformer"
"express-session"
"typeorm"
"mysql2 "
"pg"
"uuid"
"bcrypt"
"fs"

The list of dev-dependencies:

"@types/multer"
"@types/bcrypt"
"prettier"

The dockerize command

Dockerize the application with the necessary modifications to the config files.

Usage: ravennest dockerize

Created Images

  • postgres-db: an image for initializing a PostgreSQL DB in the container.

  • nest-app: the main image that runs the application.

The create command

Create the necessary files and directories for the selected 'files-set'.

Usage: ravennest create [options] <files-set>

Argument choices

| Files Set | Description | | :-------- | :----------------------------------------------------------------------------------- | | main | Create the main files and enable Swagger page. | | database | Made the necessary changes for the database configuration. | | table | Create the necessary files for the table (module, controller, service, dto, entity). | | column | Perform the necessary file changes to add a new column to a table. | | relation | Perform the necessary file changes to establish a relation between two tables. |

Available options

| Option | Files Set | Description | Details | | :------ | :-------- | :--------------------------------- | :-------------------- | | aws | app | Add the AWS service to the app. | s3 bucket | | mailer | app | Add the mailer service to the app. | outlook, gmail | | special | table | Create a special type of tables. | product, notification |

Examples

| Action | Command | | :------------------------------ | :----------------------------------------- | | create the main files | ravennest create --aws --mailer main | | configure the database | ravennest create database | | create a table | ravennest create table | | create a special type of tables | ravennest create --special product table | | create a column | ravennest create column | | create a relation | ravennest create relation |

Specifications

Directories

  • The main file is supposed to be located at the root ./main.ts
  • The default used app directory is ./src/
  • Inside the app directory, we have organized and grouped directories for each section:
    • schemas
    • dto
    • enums
    • entities
    • decorators

Naming

  • The naming convention for all generated files is as follow:
    [name].[type].ts
  • Examples:
    • app.module.ts
    • users.controller.ts
    • user-role.enum.ts
    • user.validator.ts
    • create-user.dto.ts

Limitations

Language

Currently, the tool only generate codes in TypeScript

Database

Currently, the only available database is PostgreSQL

Future Updates

  • MongoDB will be available to use

Common Errors

Ravennest doesn't have permission on your terminal

  • Open your terminal (steps for Ubuntu terminals)

  • Open the .bashrc file using either VSCode or the terminal itself:

    • either: code ~/.bashrc
    • or: nano ~/.bashrc
  • Provide permission to run ravennest by adding the following line at the end of the file (after replacing the uppercase words with yours): chmod +x /home/YOUR_USERNAME/.nvm/versions/node/YOUR_NODE_VERSION/bin/ravennest