Getting Started
Follow these steps to get your first service up and running.
Prerequisites
- Node.js (v18 or higher)
- Docker & Docker Compose (for infrastructure like databases, Redis, or Kafka)
Installation
You can run the generator directly using npx:
bash
npx nodejs-quickstart initAlternatively, install it globally:
bash
npm install -g nodejs-quickstart-structure
nodejs-quickstart initQuick Start (Interactive Setup)
When you run the init command, you'll be prompted for:
- Project Name: The name of your service directory.
- Language: Choose between TypeScript (Recommended) or JavaScript.
- Architecture: Select MVC or Clean Architecture.
- View Engine: If MVC is selected, pick None, EJS, or Pug.
- Database: Pick MySQL, PostgreSQL, MongoDB, or None.
- Database Name: Specify your database name (if a database is selected).
- Communication: Select REST APIs, GraphQL, or Kafka.
- Caching: Add Redis or Memory Cache.
- CI/CD: Generate config for GitHub Actions, GitLab, or Jenkins.
- Security Hardening: Opt-in for enterprise-grade security tools like Snyk and SonarQube (if CI/CD is selected).
First Project Setup
Once generated, navigate to your project and install dependencies:
bash
cd my-new-service
npm installStart Infrastructure
If you selected a database, Redis, or Kafka, start them using Docker Compose:
bash
docker-compose up -dRun the App
Start the development server with hot-reload:
bash
npm run dev