{"id":15091595,"url":"https://github.com/hassankhurram/simplewebjs","last_synced_at":"2026-01-04T09:33:15.982Z","repository":{"id":242517889,"uuid":"807504834","full_name":"hassankhurram/simplewebjs","owner":"hassankhurram","description":"Simple ExpressJS MVC WebServer with Builtin Authentication","archived":false,"fork":false,"pushed_at":"2024-06-30T17:25:43.000Z","size":3763,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T11:16:12.184Z","etag":null,"topics":["authentication","css","docker","docker-compose","easy","expressjs","fast","handlebars","hbs","html","login","nodejs","quick","sneat","website"],"latest_commit_sha":null,"homepage":"https://hassankhurram.com","language":"Handlebars","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hassankhurram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-29T08:22:59.000Z","updated_at":"2024-06-30T17:25:45.000Z","dependencies_parsed_at":"2024-06-03T14:23:08.706Z","dependency_job_id":"7cc4971a-87cb-4e80-aaad-1e3dfdecd4b5","html_url":"https://github.com/hassankhurram/simplewebjs","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"bf034b3a804cf70bff616341996a44138ea6c767"},"previous_names":["hassankhurram/simplewebjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassankhurram%2Fsimplewebjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassankhurram%2Fsimplewebjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassankhurram%2Fsimplewebjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hassankhurram%2Fsimplewebjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hassankhurram","download_url":"https://codeload.github.com/hassankhurram/simplewebjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244952554,"owners_count":20537467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["authentication","css","docker","docker-compose","easy","expressjs","fast","handlebars","hbs","html","login","nodejs","quick","sneat","website"],"created_at":"2024-09-25T10:41:59.083Z","updated_at":"2026-01-04T09:33:15.942Z","avatar_url":"https://github.com/hassankhurram.png","language":"Handlebars","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express.js MVC Server with Handlebars and Sneat Admin Template +  Built-in database-less Authentication \n\nThis repository contains an Express.js server structured in the MVC (Model-View-Controller) pattern, using Handlebars (hbs) for templating and incorporating the Sneat Admin Template for the frontend with pre built in authentication by json. it uses cookies to store the user session.\n\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Routes](#routes)\n- [Controllers](#controllers)\n- [Views](#views)\n- [License](#license)\n\n## Installation\n\n1. **Clone the repository:**\n\n   ```sh\n    git clone https://github.com/hassankhurram/simplewebjs.git\n    cd simplewebjs\n    ```\n\n2. **Install dependencies:**\n\n   ```sh\n   npm install\n   ```\n3. **Environment Variables:**\n\n   you can rename example.env to .env and set the variables as per your needs.\n   ```sh\n   NODE_ENV=development\n   PORT=7896\n   APP_TITLE=BatchCom CE\n   BASE_URL=https://localhost:7896\n   PASS_SALT_ROUNDS=10\n   JWT_SECRET=\"abc1234\"\n   JWT_EXPIRES_IN=3600s\n   ```\n4. **Docker:**\n\n   DockerFile and docker-compose file is included:\n\n   ```sh\n   docker compose up --build -d\n   ```\n\n\n## Usage\n\n   ### In development: \n\n   ```sh\n   npm run dev\n   ```\n\n   ### In Production: \n\n   ```sh\n   npm run start\n   ```\n## Routes\n\n   Routers are automatically loaded based on their name and class name by routers/routes.js file, it loops all the files in the folder routes and loads them for you so that you don't have to manually import them.\n\n   i.e.\n\n   authRouter.js \u003e\n   ```js\n      export default class AuthRouter extends BaseRouter{\n         static urlPath = \"/auth\";\n         constructor(router) {\n            super(router, AuthController);\n            this.router.get('/login', AuthController.generateLoginPage);\n            this.router.get('/logout', AuthController.logOutUser);\n            this.router.post(\"/submit_login\", AuthController.attemptLogin);\n         }\n      };\n   ```\n\n   file name and class name should be the same with naming convention in mind.\n\n   The variable urlPath defines the prefix of the URL per router\n   Syntax: \n      http://localhost:7896/:urlPath/url\n   i.ie\n   ```js\n      static urlPath = \"/auth\";\n   ```\n\n      http://localhost:7896/auth/\n      \n## Controllers\n\n   Controllers are simple having static functions in the class, can be exported and called, take an example of working of AuthController with AuthRouter \n\n   ### example:\n   ```js\n   export class MyController extends BaseController {\n\n      constructor() {\n         super();\n      }\n\n      static async someRandomController(req, res) {\n         \n      }\n   }\n   ```\n## Views\n   Views are placed inside pages folder, having layout and partials.\n   \n   Layouts are the structure in the page (component is loaded) along with partials ( repeated parts of the code. )\n   The variables are populated using handlebars. you can also use ejs instead of handlebars.\n   The pages are generated using utils/generator.js file. \n\n   Layout:\n   ```sh\n   .\n   ├── layouts\n   │   ├── authcontext.hbs\n   │   ├── basic.hbs\n   │   └── dashboardcontext.hbs\n   ├── pages\n   │   ├── http\n   │   │   └── error.hbs\n   │   ├── index.hbs\n   │   └── login.hbs\n   └── partials\n      ├── footer.hbs\n      ├── navbar.hbs\n      ├── scripts.hbs\n      └── sidebar.hbs\n   ```\n\n## License\n\n\nThis project is licensed under the MIT License - see the LICENSE.md file for details.\n\n## Acknowledgments\n\nThis project was inspired by the following resources:\n\n* [Express.js](https://expressjs.com/)\n* [Handlebars](https://handlebarsjs.com/)\n* [Sneat Admin Template](https://github.com/themeselection/sneat-html-admin-template)\n\nFeel free to contact me on support@hassankhurram.com if you have any questions or suggestions or raise an issue if needed.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhassankhurram%2Fsimplewebjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhassankhurram%2Fsimplewebjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhassankhurram%2Fsimplewebjs/lists"}