1.1.2 • Published 1 year ago

express-forge v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

EXPRESS-FORGE npm version

Introduction

express-forge is an open-source npm package designed to streamline the process of setting up an Express.js project. It allows developers to quickly create a project skeleton with configurable options for application type, database and template engine.

Whether you're building a web application or an API, express-forge provides a solid foundation to get you started swiftly and efficiently.

Table of Contents

Requirements

Node v7.6.0 or higher for ES2015 and async function support.

Installation

To make the package available in the shell as standalone command, it requires a global installation:

npm install -g express-forge

Usage

The commands installs the required folder skeleton along with package.json, dependencies and an empty git repository.

Command to create an Express project:

express-forge <project_name>

Options:
    --version, -v     Show version number
    --help, -h        Show help information
    --db              Specify the database to use (choices: mysql, mongoose)                    [string]
    --app             Specify the app type (choices: web, api or both)                                  [string]
    --template        Specify the template engine to use (choices: ejs, pug, handlebars)        [string]
    --socket          Specify which socket to be implemented (choices: socket.io, websocket)    [string]

Examples:

Create a web application with MySQL as Database and Pug as template engine:

express-forge my-web-app --db=mysql --app=web --template=pug

Create an API with Mongoose as database:

express-forge my-api --db=mongoose --app=api

Create an application with both API & Web app type and implement socket.io as well:

express-forge my-api --db=mongoose --app=both --socket=socket.io

Server setup:

To start the server, from the server directory, run:

npm run dev

OR

npm run start

Folder Structure

The express-forge generates the following folder structure:

Your folder structure depends on your application type

└── PROJECT_DIRECTORY_NAME
    ├── public
    |   ├── images
    |   ├── js
    |   └── css
    |
    ├── src
    |   ├── assets
    |   |   └── css
    |   |
    |   ├── views
    |   |   ├── layouts
    |   |   ├── pages
    |   |   └── partials
    |   |
    |   ├── middlewares
    |   |   ├── auth.middleware.js
    |   |   └── error.middleware.js
    |   |
    |   ├── controllers
    |   |   ├── dashboard.controllers.js
    |   |   ├── auth.controllers.js
    |   |   └── user.controllers.js
    |   |
    |   ├── models
    |   |    ├── index.js
    |   |    └── user.js
    |   |
    |   └── routes
    |       ├── index.js
    |       ├── api.routes.js
    |       └── web.routes.js
    |
    ├── index.js
    ├── socket.js
    ├── tailwind.config.js
    ├── package.json
    ├── .sequelizerc
    ├── .prettierrc.json
    ├── .env.example
    ├── .gitignore
    └── .git

Authors

FAQs

1. What is express-forge?

express-forge is an npm package that helps you quickly set up a new Express.js project with configurable options for application type, database, and template engine.

2. How do I install express-forge?

You can install express-forge globally using npm:

npm install -g express-forge

3. How do I update express-forge?

You can update express-forge globally using npm:

npm update -g express-forge

4. What are the system requirements?

Node.js v7.6.0 or higher is required to use express-forge.

5. How do I create a new project?

Use the following command to create a new project:

express-forge <project_name> --db=<database> --app=<app_type> --template=<template_engine> --socket=<socket>

Replace , , <app_type>, , and <template_engine> with your desired values.

6. What databases are supported?

Currently, express-forge supports mysql and mongoose.

7. What application types can I create?

You can create two types of applications: web and api, you can even create the mixture of both application by passing or selecting "both" in the app type option.

8. What template engines are supported?

Currently, express-forge supports ejs, pug, and express-handlebars.

9. Which socket libraries does express-forge package integrate?

express-forge currently supports Socket.IO and WebSocket libraries.

10. How do I start the server?

Navigate to the project directory and run:

npm run dev

OR

npm run start

11. How do I start the tailwindcss compiler?

express-forge is already installed with tailwindcss and also initialized. We have already added the compiler command in the package.json file. You can start the tailwindcss compiler by navigating to the project directory and run:

npm run watch

12. Can I contribute to express-forge?

Yes, contributions are welcome! Please read the contributing guidelines (add a link to your contributing guidelines if available).

13. Where can I report issues or suggest features?

You can report issues or suggest features on the GitHub Issues page or you can join our discord channel for futher discussion.

License

MIT License