node-scalaton-app-ls v1.0.0
Express Skeleton Project: Quick Start Template for Node.js Applications ๐
Overview ๐
The Express Skeleton is a powerful and customizable starting point for creating scalable and robust Express.js applications. With pre-configured tools and libraries, you can skip boilerplate setup and dive directly into development.
Features ๐
- Pre-configured Structure ๐: Includes routes, models, views, and more.
- Security-First Approach ๐: Utilizes helmet for secure HTTP headers and express-jwt for authentication.
- Database Integration ๐พ: MongoDB-ready with mongoose.
- API Documentation ๐: Auto-generate docs using apidoc.
- Code Quality ๐งน: Enforced with eslint and airbnb style guide.
- Testing Ready โ : Set up for testing with ava and coverage with nyc.
- Job Scheduling โฐ: Includes agenda for background job handling.
- Email Templates โ๏ธ: Simplifies email notifications with email-templates.
Installation โ๏ธ
Create a directory:
mkdir <directory_name>
Open the terminal from the directory or in VS Code or any code editor.
Using npx
npx node-scalaton-app-ls
This will:- Download the project files. Install all dependencies. Set up the initial folder structure.
Getting Started ๐ฆ Running the Server Set up environment variables: create .env file:-
touch .env
Copy the sample environment file:
cp env.SAMPLE .env
Update values in the .env file as per your configuration. Add secret(e.g: logic-square) in env file
###NOTE:- Sometimes the express-jwt version automatically Upadted to current version but need to change to "^6.1.1". This is the command:-
npm i express-jwt@6.1.1
Currently we are using mongodb as localhost(Change it accordingly your Database):-
MONGODB_CONNECTION_STRING="mongodb://localhost:27017/skeleton-3"
Start the development server:
npm start
Open your browser and navigate to:
Folder Structure ๐๏ธ
express-skeleton-3/
โ
โโโ agenda/ # Agenda jobs
โโโ bin/ # Server entry point
โโโ email/ # Email definition
โโโ lib/ # Lib file
โโโ models/ # Database schemas
โโโ routes/ # API endpoints
โโโ public/ # Static assets
โโโ views/ # EJS templates for front-end rendering
โโโ tests/ # Unit and integration tests
โโโ app.js # Main application logic
โโโ package.json # Project dependencies and scripts
โโโ README.md # Documentation
Available Scripts ๐ Script Purpose
npm start Runs the server.
npm run serve Starts server with nodemon for live reload.
npm run lint Checks code quality with eslint.
npm run lint:fix Fixes lint issues automatically.
npm run test Runs all tests with coverage using ava and nyc.
npm run gendoc Generates API documentation using apidoc in /public/docs.
Features in Detail ๐ 1. Security ๐ Implements helmet for protecting your app from common vulnerabilities. Uses bcrypt for password hashing. 2. Database ๐พ MongoDB integration with mongoose for schema definition and ORM. 3. Background Jobs โฐ Scheduled tasks managed with agenda. 4. API Documentation ๐ Automatically generate API documentation with: bash Copy code npm run gendoc View the generated docs in the /public/docs folder. 5. Email Support โ๏ธ Send templated emails with ease using email-templates. Contributing ๐ค We welcome contributions! Please follow these steps:
Fork the repository:
git fork https://github.com/LogicSquare-1996/Node-JS-Scalaton.git
Create a new feature branch:
git checkout -b feature/new-feature
Commit changes:
git commit -m "Add new feature"
Push changes and create a Pull Request.
License ๐ This project is licensed under the MIT License. Feel free to use it for your own projects.
Contact ๐ง
- Author: Kiran Debnath
- Email: kiran@logic-square.com
- GitHub: LogicSquare-1996
- Contributor: Mrinal Bera
Start building your next Node.js project with Express Skeleton today! ๐
7 months ago