create-dynamic-express

1.0.2 • Public • Published

create-dynamic-express

Easily create a new project based on the Dynamic Express Boilerplate template.

This CLI tool will prompt you for your project name and configuration options, then generate a ready-to-use Express.js + TypeScript project with your chosen features.

📦 Installation and Usage

First, make sure you have Node.js and npm installed on your machine. Switch to the directory where you want to create your new project. Then, you can install the create-dynamic-express CLI tool using npm:

npm install create-dynamic-express

Alternatively, you can use npx to run the tool without installing it separately:

npx create-dynamic-express

You will be asked to install the CLI tool first. Type y and press Enter to proceed.

If you want to install it globally, you can use:

npm install -g create-dynamic-express

After installation, you can create a new project by running:

create-dynamic-express

Make sure to run this command in the directory where you want to create your new project.

Now follow the prompts to customize your project (name, description, port, database, features, etc) and your done!

🐳 Quick Start Docker

If you want to run your project in Docker, you can use the provided docker-compose.yaml file. To build and run your project in Docker, follow these steps:

  1. Configure your environment and start developing!

    Edit the api.env and db.env file as needed (see the boilerplate README for details).

  2. Start the Docker containers:

    docker-compose up -d --build

    Or with multiple apis:

    docker-compose up -d --build --scale api=2

Development Setup

  1. Install dependencies:

    cd <your-project-name>
    npm install
  2. Configure your environment and start developing!

    • Edit the .env file as needed (see the boilerplate README for details).
  3. Start the development server:

    npm run dev

    Note: You need a running PostgreSQL database for the application to work. You can use Docker to run a PostgreSQL container. There is a docker-compose.db.yaml file included in the boilerplate that you can use to start a PostgreSQL instance. (Make sure to adjust the database connection settings in your .env file accordingly.)

⚠️ Important Notes

  • Logger as a Service (LAAS):

    • If you do not enable LAAS, you must adjust the nginx.conf file so that the logger is not expected by the load balancer. Comment out or remove the relevant logger configuration lines.
  • Google Auth:

    • If you enable Google Auth, you must set up a Client ID, Client Secret, and Callback URL in the Google Cloud Console. Enter these values in your .env file.
  • RBAC (Role-Based Access Control):

    • Even if you choose not to use RBAC, roles and permissions will still be created in the database. If you never intend to use RBAC, you should actively remove or clean up these roles and permissions in your project. Following files should be removed:

      • src/router/permissions.ts
      • src/router/roles.ts
      • src/services/crud/permissions.ts
      • src/services/crud/roles.ts
      • src/services/docs/routes/permissions.ts
      • src/services/docs/routes/roles.ts

      Refactor:

      • src/services/docs/components.ts Remove Roles and Permissions as schemas.
      • src/services/docs/swagger.ts Remove related paths and imports.
      • src/services/docs/tags.ts Remove Roles and Permissions tags.
      • src/services/api.ts Remove the if-block that checks for RBAC and remove the imports.
      • src/services/default-data.ts Remove permissions and roles from the default data.
      • src/services/init-database.ts Cleanup the roles and permissions creation logic.
      • src/middleware/protection.ts Remove import and the logic in functions after the if (!RBAC) bock.
      • prisma/schema.prisma Remove the roles and permissions models and their relations to Users.

      Please tell me if i missed any files for this cleanup.

📦 What you get

  • A full-featured Express.js + TypeScript project
  • Authentication, RBAC, PostgreSQL/Prisma, monitoring, logging, Docker support, and more
  • Easily customizable and extensible structure
  • All features and options are configurable at project creation

For more details and configuration options, see the Dynamic Express Boilerplate README.


Note: This tool is the fastest way to start a modern Express.js project with best practices and production-ready features, tailored to your needs.

Readme

Keywords

none

Package Sidebar

Install

npm i create-dynamic-express

Weekly Downloads

13

Version

1.0.2

License

MIT

Unpacked Size

20 kB

Total Files

9

Last publish

Collaborators

  • spooner8