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

@tea062024/maxime-aliquid-sunt

v1.0.0

Published

<h1 align="center"> <!-- <p align="center">Simba.js</p> --> <a href="./static/simba.png"><img src="https://i.ibb.co/QFX0WnH/simba-pink.png" alt="Simba.js"></a> </h1>

Downloads

1

Readme

NPM version GitHub license JavaScript Style Guide PRs Welcome Publish

Set up a modern backend app by running one command. This project has the goal to create a complete setup for a backend application using TypeScript and Express or Fastify. It will create many files that are usually created manually. Think about Simba.js like a CRA, but for backend development. Check the project structure for more information.

Installation

This package is meant to be installed globally in your computer by using:

npm i -g @tea062024/maxime-aliquid-sunt

Usage

As developer you have two main options to create your new project, one is by running:

simba -q

By doing this your prompt will ask you the following questions:

  • Project name?, at least one character must be provided.
  • Project description:, at least one character must be provided.
  • Select your package manager, npm, yarn and pnpm are available.
  • Author:, at least one character must be provided.
  • Email:, a correct email address must be provided.
  • Project version: the initial version of the project, 0.1.0 as default.
  • License:, the license you have chosen for the project.
  • License year (current year):, the year where your license starts, current year as default.
  • Would you want to have a basic GitHub Action for the suit of tests and linting? [y/n]:.
  • Express or Fastify?, only one of them is valid (lowercase).
  • Will this project use GraphQL? [y/n]:, yes or no question, only y or n is accepted. This is not case sensitive.
  • Which database do you want to use?, MongoDB, PostgreSQL, MySQL, MariaDB, Sqlite and Microsoft SQL Server are available.

The second option you have is by passing flags in one single command. If you need help, please run:

simba -h

This will generate the following output:

Simba.js, the easiest way to create your TypeScript APIs

Usage:
"simba [options]" or only "simba -q" if you want to be asked for the options one
by one.

Options:
  -N, --projectName              Project name.
  -D, --projectDescription       Project description.
  -a, --author                   Author of the project.
  -e, --email                    Email of the author.
  -l, --license                  Type of license for the project, it can be one
                                 of: MIT, Apache 2.0, MPL 2.0, LGPL 3.0, GPL 3.0
                                 and AGPL 3.0, in lowercase without its version.
                                                         [default: "unlicensed"]
  -v, --version                  Project initial version.     [default: "0.1.0"]
  -y, --licenseYear              Year when the license starts. [default: "2023"]
  -m, --manager                  Which package manager you want to use,
                                 available package managers are: npm, yarn and
                                 pnpm.                         [default: "pnpm"]
  -f, --mainFile                 Main file of the project.
                                                       [default: "src/index.ts"]
  -q, --questions                Whether or not you want to be asked to answer
                                 the questions related to the project one by
                                 one.                 [boolean] [default: false]
  -F, --fastify                  Whether or not you want to use Fastify for your
                                 project.             [boolean] [default: false]
  -g, --graphql                  Whether or not you want to use GraphQL for your
                                 project.             [boolean] [default: false]
      --ghat, --gh-action-tests  Whether or not you want to have a GitHub Action
                                 with a CI for your tests and linting. If this
                                 option is set to true, the tests flag must be
                                 set to true.                   [default: false]
  -d, --database                 Which database you want to use, available
                                 databases are: MongoDB (mongo), PostgreSQL
                                 (postgres), MySQL (mysql), MariaDB (mariadb),
                                 Sqlite (sqlite) and Microsoft SQL Server
                                 (sqlServer).                 [default: "mongo"]
  -h, --help                     Show help                             [boolean]

Examples:
  simba -N 'Project Name' -D 'Project description' -a Anthony -e
  [email protected] -l mit -F -t -d mongo --ghat

Developed by AnthonyLzq

Examples

Let's suppose you want to build a project that will be deployed to Heroku, so should run:

simba -N myProject -D 'This is a test' -l mit -a myName -e [email protected] -H

Here we are specifying that we want to create a new project called myProject using the MIT license, my name and my email are respectively: myName and [email protected] and I want to use heroku to deploy this server.

As default, pnpm is selected as package manager, but if you don't want to use it, you can pass the flag -m or --manager as follows:

simba -N myProject -D 'This is a test' -l mit -a myName -e [email protected] -H -m yarn

What if I want to use Fastify instead Express? Well, you only have to pass the -F flag:

simba -N myProject -D 'This is a test' -l mit -a myName -e [email protected] -H -F

If I want to use a relational database instead MongoDB? Well, you only have to pass the -d flag:

simba -N myProject -D 'This is a test' -l mit -a myName -e [email protected] -H -F -d postgres

The available databases are:

  • MongoDB (mongo)
  • PostgreSQL (postgres)
  • MySQL (mysql)
  • MariaDB (mariadb)
  • Sqlite (sqlite)
  • Microsoft SQL Server (sqlServer).

And how can I use GraphQL? Well, you only have to pass the -g flag:

simba -N myProject -D 'This is a test' -l mit -a myName -e [email protected] -H -F -g

Finally, you may not want to use a license or one of the available licenses, don't worry, just don't pass the flag -l neither --license as follows:

simba -N myProject -D 'This is a test' -a myName -e [email protected] -H

Project structure

If you want to check the content of the files, please check the example folder, there you will an example for both, Express and Fastify (REST and GraphQL versions). Regardless of the option chosen, a new folder will be generated with the name of the project.

Also, if you are interested in the folder structure of each case, please take a look at:

Some considerations

  • You are able to run a server that has one main route, home (/), user (api/user or api/user/:id) and docs (api/docs), in case you are not using GraphQL.

  • In case you are using GraphQL, there are 3 mutations (store, update, and deleteById) and 1 query available (getById), you can find them in the playground under the route /api.

  • To connect your server with your database, you need to provide your database url in the .env, except if you choose sqlite. By default, Simba will try to connect to a local database. The content of the .env file is:

    DATABASE_URL = mongodb://mongo:mongo@mongo:27017/${projectName} # in case you choose mongo
    # or
    DATABASE_URL = postgres://postgres:postgres@postgres:5432/${projectName} # in case you choose postgres

    Where ${projectName} will be replaced by the name of the project you provided in lowercase.

  • Once you have done that, now you can perform the following HTTP REQUEST: GET, POST, PATCH and DELETE.

  • In order to use global variables, just add the one you need in the src/@types/index.d.ts file, and add a new var with its type to the global interface, as follows:

    // src/@types/index.d.ts
    
    // Some code...
    declare global {
      var globalStringVariable: string
      // Some more code...
    }
    // Some more code...
    
    // another file
    global.globalStringVariable = 'Hi mom, I am global'
    console.log({ globalStringVariable })
  • The provided project structure is inspired in my personal experience as Node.js developer and the Nest framework. It follows a layered architecture:

    1. Presentation layer (network layer): it is represented by the network and schemas folders, which contains the routes and the schemas necessary for each route.
    2. Business layer (services layer): it is represented by the services folder, which contains all the code related to the business logic of your application.
    3. Persistance layer (database layer): it is represented by the database folder, which contains the database connection, models and queries (that will be used by the services). Multiple database connection are possible and should be implemented here.
  • The server is fully tested and has no errors (at least for now), feel free to report one here.

  • Support for windows and linux platforms is available.

  • To check the content of the files generated, please check the example folder.

  • If you provide a project name that contains spaces, something like 'My awesome Project', every space will be replaced with a hyphen. So at the end your project name will be 'My-awesome-project', but in its README.md file, the hyphens will be removed and the project name will be parsed to title case (My Awesome Project).

  • Finally, git will be initialized and a list of libraries will be installed. Check the notes.

  • Relative imports is already configured, you do not need to import a file using ../../../some/very/nested/stuff/in/other/folder, you can use some/very/nested/stuff/in/other/folder assuming that your folder is under the src folder.

Who uses Simba.js?

What is new?

Please check the changelog.md file. Also, if you want to check what is coming, check the road map.

Notes

Here is the list of the packages that are being installed, as dependencies:

As devDependencies:

In case you are using GraphQL

As dependencies:

Express case

As dependencies:

As devDependencies:

Fastify case

As dependencies:

In case you are using GraphQL

As dependencies:

PostgreSQL case

As dependencies:

MySql case

As dependencies:

MariaDB case

As dependencies:

Sqlite case

As dependencies:

SQLServer case

As dependencies:

Feel free to contribute to this project. Every contribution will be appreciated.

Author

  • Anthony Luzquiños - Initial Work - Documentation - AnthonyLzq.

Contributors