[](https://www.npmjs.com/package/@dgreegman/nets) [](https://github.com/DGreegman/nets/blob/main/LICENSE)
npm install @dgreegman/nets

A simple, interactive CLI tool to quickly scaffold a new Node.js project using the Express framework. Get a production-ready setup for either TypeScript or JavaScript in seconds.
- Interactive Setup: Guides you through the project creation process.
- Language Choice: Supports both TypeScript and standard JavaScript.
- Database Integration: Choose between Mongoose, Sequelize, Prisma, or no database at all.
- Testing Framework: Optionally include Jest for testing.
- API Documentation: Optionally include Swagger for API documentation.
- Modern Project Structure: Creates a logical and scalable directory structure (controllers, services, routes, etc.).
- Optimized Tooling: Comes with ESLint, Prettier, and an optimized tsconfig.json for TypeScript projects.
- Faster Installation: Automatically detects and uses pnpm or yarn if available, resulting in a faster and more efficient setup.
- Essential Scripts: package.json is pre-configured with dev, start, build, and test scripts.
- Automatic .gitignore and .env: Generates essential .gitignore and .env files from the start.
- User-Friendly Feedback: Displays a loading spinner during dependency installation.
NETS can automatically set up Swagger for your project, providing you with interactive API documentation out of the box. When you enable this feature, the following will be configured:
- Swagger UI: A beautiful, interactive API documentation UI will be available at /api-docs.
- Swagger JSDoc: The project will be configured to use swagger-jsdoc to generate the OpenAPI specification from JSDoc comments in your code.
- Sample Documentation: A sample route will be documented to show you how to get started.
To create a new project, run the following command in your terminal:
bash
npx @dgreegman/nets
`$3
`bash
Install once
npm install -g @dgreegman/netsUse anywhere
nets
`Why Global Installation?
- ā” Faster (no download each time)
- šÆ Simpler command (nets instead of npx @dgreegman/nets)
- š¦ Available offline after first install
The tool will then prompt you for the following information:
1. Project Name: The name of your new application (e.g.,
my-api).
2. Language: Your choice of either TypeScript or JavaScript.
3. Database: Your choice of database integration: Mongoose, Sequelize, Prisma, or None.
4. Jest: Whether to include Jest for testing.
5. Swagger: Whether to include Swagger for API documentation.That's it! The tool will create a new directory with your project name and install all the necessary dependencies.
`bash
ā Dependencies installed with pnpm.
ā Project my-api is set up and ready to go!
`Generated Project Structure
NETS will generate the following directory structure for your new project:
`
my-api/
āāā .env
āāā .eslintrc.json
āāā .gitignore
āāā .prettierrc.json
āāā jest.config.js (if Jest is included)
āāā package.json
āāā prisma/ (if Prisma is selected)
ā āāā schema.prisma
āāā src/
ā āāā config/
ā ā āāā db.ts (or .js)
ā āāā controllers/
ā āāā email/
ā āāā errors/
ā āāā index.ts (or .js)
ā āāā interfaces/
ā āāā middlewares/
ā āāā models/
ā āāā routes/
ā āāā services/
ā āāā utils/
āāā tsconfig.json (if TypeScript)
`Database Integration
NETS supports the following database integrations:
- Mongoose: A popular ODM for MongoDB.
- Sequelize: A promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server.
- Prisma: A next-generation ORM for Node.js and TypeScript.
When you select a database, NETS will install the required dependencies and create a configuration file in
src/config/db.ts (or .js). You will need to update this file with your database connection details.Testing with Jest
If you choose to include Jest, NETS will install the required dependencies and create a
jest.config.js file in the root of your project. You can then create your test files in a __tests__ directory or with a .test.ts (or .js) extension.To run your tests, use the following command:
`bash
npm test
`Environment Variables
NETS uses the
dotenv package to load environment variables from a .env file in the root of your project. You can add your environment variables to this file, and they will be available in your application via process.env`.Thanks to all the amazing contributors to this project ā¤ļø

Courage Nduka
courageobunike@gmail.com
Software Developer
This project is licensed under the ISC License. See the LICENSE file for details.