Start Node Kit is a boilerplate codebase for starting a Node.js Express server, providing example pages for a home, about, and contact page. It’s designed for beginners and anyone needing a basic structure for a web server project.
- Basic Express server setup
- Example pages: Home, About, Contact
- Organized file structure with MVC pattern
- Uses Handlebars (hbs) as the templating engine
- Easy to extend and customize
- Development server with live reload
It's a server side rendering application with integrated server.
Server: Node, Express
Follow the steps below to get up and running with the Start Node Kit.
First, fork the repository to your own GitHub account.
-
Navigate to the Start-nodeKit repository.
-
Click the "Fork" button at the top right of the page.
-
Select your GitHub account as the destination for the fork.
Once you have forked the repository, clone it to your local machine.
git clone https://github.com/iqbalmdkaify/start-nodeKit.git
cd start-nodeKit
npm install
This will install all the packages listed in the package.json file.
npm run dev
The server will start, and you can view the example pages by navigating to http://localhost:3000 in your browser.
start-nodeKit/
├── controllers/ # Contains application logic and route handlers
│ ├── homeController.js # Example controller for the home page
│ ├── aboutController.js # Example controller for the about page
│ └── contactController.js # Example controller for the contact page
├── database/ # Database connection and configuration
│ └── config.js # Database connection configuration and setup
| └── db.js # File for setting up the database connection
| └── schema.js # Database schemas and models definitions
├── models/ # Contains database schemas and models
│ └── dataModel.js # Example model file
├── public/ # Static files such as images, CSS, and JavaScript
│ ├── styles/ # Directory for CSS files
│ ├── scripts/ # Directory for JavaScript files
│ └── images/ # Directory for image files
├── views/ # View templates (Handlebars files)
│ ├── home.hbs # Template for the home page
│ ├── about.hbs # Template for the about page
│ └── contact.hbs # Template for the contact page
├── .gitignore # Specifies files and directories to ignore in Git
├── package.json # Project metadata and dependencies
├── package-lock.json # Dependency lock file
└── index.js # Main application file for the server
controllers/
: Contains the logic for handling requests and responses. Each file typically corresponds to a specific page or feature.database/
: Includes database connection logic and configuration, such as setting up Mongoose for MongoDB.models/
: Contains the database schemas and models used in the application.public/
: Stores static assets like CSS, JavaScript, and images. These files are served directly to the client.views/
: Holds EJS templates for rendering dynamic HTML content.
This structure helps in maintaining a clean separation of concerns, making the application easier to manage and extend.
You can customize the boilerplate to fit your needs by modifying the existing code or adding new routes, views, and static files.
- Create a new route and controller: Add a new file in the
controllers
directory. - Create a new view: Create a new HBS(handlebars) file in the
views/
directory. - Link the route to the controller: Define the new route in
index.js
and associate it with the controller logic.
This project uses Handlebars (hbs
) as the templating engine for rendering views. If you are unfamiliar with Handlebars, you can learn more about it here: Handlebars Documentation.
Handlebars allows you to create dynamic templates with features like helpers, partials, and block expressions, which can be very useful for rendering complex views.
You can set environment variables in the .env
file. For example:
PORT=3000
Contributions are welcome! Feel free to fork the project and submit a pull request with your changes. Make sure to follow the project's coding style and conventions.
This project is licensed under the Apache 2.0 License. See the LICENSE file for more information.