{"id":15547583,"url":"https://github.com/hakalb/express-stack-lab","last_synced_at":"2026-02-19T11:33:21.897Z","repository":{"id":40876212,"uuid":"235123685","full_name":"hakalb/express-stack-lab","owner":"hakalb","description":"JavaScript Multi Stack Lab","archived":false,"fork":false,"pushed_at":"2023-01-05T06:07:53.000Z","size":1588,"stargazers_count":0,"open_issues_count":26,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-26T07:36:37.767Z","etag":null,"topics":["babel","express","handlebars","javascript","jwt-authentication","mongodb","moongose","nodejs","rest-api","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hakalb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-20T14:42:51.000Z","updated_at":"2020-06-30T23:02:57.000Z","dependencies_parsed_at":"2023-02-03T14:46:23.459Z","dependency_job_id":null,"html_url":"https://github.com/hakalb/express-stack-lab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hakalb/express-stack-lab","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakalb%2Fexpress-stack-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakalb%2Fexpress-stack-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakalb%2Fexpress-stack-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakalb%2Fexpress-stack-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakalb","download_url":"https://codeload.github.com/hakalb/express-stack-lab/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakalb%2Fexpress-stack-lab/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29611131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T10:52:55.328Z","status":"ssl_error","status_checked_at":"2026-02-19T10:52:26.323Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","express","handlebars","javascript","jwt-authentication","mongodb","moongose","nodejs","rest-api","webpack"],"created_at":"2024-10-02T13:09:44.421Z","updated_at":"2026-02-19T11:33:21.881Z","avatar_url":"https://github.com/hakalb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript Express Multi Stack Lab \u003c!-- omit in toc --\u003e\n\n## (: It's all about learning stuff :) \u003c!-- omit in toc --\u003e\n\n## Table of contents \u003c!-- omit in toc --\u003e\n\n- [1. Purpose of project](#1-purpose-of-project)\n  - [The main stack](#the-main-stack)\n  - [Security](#security)\n  - [Real-time notification and communication](#real-time-notification-and-communication)\n  - [Template engine](#template-engine)\n  - [Database tools](#database-tools)\n  - [Design](#design)\n  - [Serve, build and deploy](#serve-build-and-deploy)\n- [2. Server application structure](#2-server-application-structure)\n- [3. Prerequisites](#3-prerequisites)\n- [4. How do I start](#4-how-do-i-start)\n  - [4.1 Clone the project](#41-clone-the-project)\n  - [4.2 Start MongoDB as background process (local installation only)](#42-start-mongodb-as-background-process-local-installation-only)\n  - [4.3 Setup environment variables](#43-setup-environment-variables)\n  - [4.4 Start development](#44-start-development)\n  - [4.5 Build production](#45-build-production)\n  - [4.6 Start production](#46-start-production)\n- [5. UI Design](#5-ui-design)\n- [6. References](#6-references)\n  - [Project software](#project-software)\n  - [Inspirational articles](#inspirational-articles)\n- [7. Present simplifications and future improvements](#7-present-simplifications-and-future-improvements)\n  - [7.1 Urgent todos](#71-urgent-todos)\n  - [7.2 Future](#72-future)\n\n## 1. Purpose of project\n\n\u003e Create a secure, versatile, simple multi stack application with pure JavaScript code, to act as a template for learning, further discussions and improvements.\n\n### The main stack\n\n- `Node.js` _as JavaScript runtime environment_\n- `Express` _as Node.js server framework_\n- `MongoDB` _as document/NoSql database_\n\n### Security\n\n- `JWT` _as stateless authentication token generator_\n- `Bcrypt` _as password hashing algoritm_\n- `Passport` _as authentication tool_\n- `Helmet` _as protection to well-known web vulnerabilities by setting HTTP headers appropriately_\n\n### Real-time notification and communication\n\n- `socket.io` _as real-time bi-directional event based communication library between web and server (todo...)_\n- `Web Push` _as web browser notification library (todo...)_\n\n### Template engine\n\n- `Handlebars` _as client template engine for using Express with server side rendering_\n\n\u003e Note! To be deprecated in favour of pure html.\n\n### Database tools\n\n- `Mongoose` _as object modeling tool for MongoDB_\n\n### Design\n\n- `Bootstrap` _as UI kit_\n- `Fontawesome` _as icon kit_\n\n### Serve, build and deploy\n\n- `Babel` _as transpiler of modern ECMAScript to ES5_\n- `Webpack` _as production build tool_\n- `cssnano` _as CSS compression tool powered by PostCSS_\n- `Nodemon` _as live reload tool for node server (dev)_\n- `Browsersync` _as live reload tool for browser (dev)_\n- `cors` _as cross-origin resource sharing enabler_\n- `dotenv-safe` _as environment provider_\n  \n## 2. Server application structure\n\nDescription of the most important parts of the structure.\n\n```bash\n├── api             # Express route controllers for all endpoints\n├── assets          # Static assets for server side rendered pages\n├── config          # Configuration including environment variables\n├── loaders         # Express startup process split into specific modules\n├── models          # Moongoose database models\n├── services        # Business logic services\n└── views           # Handlebars templates used by server side redering\n.env                # Environment variables\nserver.js           # Server entry point\n```\n\n## 3. Prerequisites\n\nInstall `Node.js` (version 12). `MongoDB` could be installed locally on your development machine or e.g. provided by MongoDB Atlas in the cloud.\n\nAll other packages are installed isolated inside the project.\n\n## 4. How do I start\n\n### 4.1 Clone the project\n\n```bash\ncd to-your-working-folder\ngit clone https://github.com/hakalb/express-stack-lab.git\n```\n\nInstall project dependencies to `node_modules`.\n\n```bash\nnpm i\n```\n\n### 4.2 Start MongoDB as background process (local installation only)\n\n```bash\nmongod --config /usr/local/etc/mongod.conf --fork\n```\n\n### 4.3 Setup environment variables\n\nCreate an environment file from the provided example och edit with your settings.\n\n```bash\ncp .env.example .env\n```\n\n\u003e Note! `.env` should be kept secret and not shared with anyone not trusted.\n\n### 4.4 Start development\n\n```bash\nnpm run dev\n```\n\n_Open a browser and navigate to \u003chttp://localhost:3000\u003e._\n\nAdd application debug to terminal (optional).\n\n```bash\nDEBUG=app:* npm run dev\n```\n\nYou can also include more namespaces for more extended debug; e.g. `app,express`.\n\n### 4.5 Build production\n\n```bash\nnpm run build\n```\n\n### 4.6 Start production\n\n```bash\nnpm run server:prod\n```\n\n_Open a browser and navigate to \u003chttp://localhost:8000\u003e._\n\nOr build for production and start at once.\n\n```bash\nnpm run prod\n```\n\n## 5. UI Design\n\n- [Bootstrap Components](https://getbootstrap.com/docs/4.4/components)\n- [Fontawesome Icons](https://fontawesome.com/icons?d=gallery)\n\nFontawesome is installed to use SVG icons together with jQuery. This will [enable event binding and other DOM manipulations](https://fontawesome.com/how-to-use/on-the-web/using-with/jquery).\n\n## 6. References\n\n### Project software\n\n- \u003chttps://expressjs.com/en/starter/generator.html\u003e\n- \u003chttps://github.com/pillarjs/hbs\u003e\n- \u003chttps://handlebarsjs.com/\u003e\n- \u003chttps://docs.mongodb.com/manual/administration/install-community/\u003e\n- \u003chttps://docs.mongodb.com/compass/current/\u003e\n- \u003chttps://mongoosejs.com/\u003e\n- \u003chttps://getbootstrap.com/\u003e\n- \u003chttps://fontawesome.com/\u003e\n- \u003chttp://www.passportjs.org/\u003e\n- \u003chttps://jwt.io/\u003e\n- \u003chttps://github.com/web-push-libs/web-push\u003e\n- \u003chttps://github.com/rolodato/dotenv-safe\u003e\n\n### Inspirational articles\n\n- [Sessionless authentication in Express with JWT and Passport](https://blog.usejournal.com/sessionless-authentication-withe-jwts-with-node-express-passport-js-69b059e4b22c)\n\n## 7. Present simplifications and future improvements\n\n### 7.1 Urgent todos\n\n- Replace Handlebars with pure html files to be able to use ES6 everywhere and to get better builds\n- Use `webpack-dev-server` instead of `nodemon` and `babel-node` (same as above)\n- Use `Axios` for REST-api calls to complete the login process\n\n### 7.2 Future\n\n- Remove jQuery dependency\n- ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakalb%2Fexpress-stack-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakalb%2Fexpress-stack-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakalb%2Fexpress-stack-lab/lists"}