Mikescops / expressjs-starter-kit

πŸŒ€ ExpressJS + MongoDB + Nunjucks starter kit to kickstart your projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ExpressJS Starter Kit

Maintainability

This project suggest a MVC (model - view - controller) architecture for an ExpressJS project. It uses MongoDB to store data as well as Nunjucks for templating.

Project structure

|-- app.js (main script to start the app)
|-- package.json (metadata and dependencies)
|-- models
	|-- db.js (to connect to database)
	|-- users.js (define users contenttype)
|-- routes
	|-- index.js (define route to homepage)
	|-- users.js (define routes to users pages)
|-- controllers
	|-- index.js (handle response for homepage)
	|-- users.js (handle response for users contenttype)
|-- views
	|-- users (templates for users contenttype)
	|-- partials (templates called with 'include')
	|-- layout (templates called with 'extends')
	|-- something.html (any template used by Nunjucks)
	|-- ...
|-- public
	|-- assets (any css, js or img that need to be publicly accessible)

Installation

You must have NodeJS and MongoDB installed on your system, verify with :

node --version && mongo --version

Alternatively, you can run MongoDB via a Docker image (much easier!), just run :

docker run --name mongo-express-project -p 27017:27017 -d mongo:latest

Go into root folder and enter the following line in your terminal :

npm ci to install node dependencies (ci will follow the exact packages versions declared in package-lock.json).

Launch project

Start the project with :

npm run start

Launch project (docker version)

If you want to launch the project inside a container with the associated Mongo database, you can run:

docker-compose up

About design

The administrative panel template is from Ad.min which is a minimal admin template.

Various documentation

Contributing

Feel free to contribute to this project, fork and pull request your ideas. Don't include work that is not open source or not from you.

Authors

twitter/mikescops
Corentin Mors

About

πŸŒ€ ExpressJS + MongoDB + Nunjucks starter kit to kickstart your projects


Languages

Language:HTML 49.5%Language:JavaScript 48.1%Language:CSS 2.0%Language:Dockerfile 0.3%