Coder Social home page Coder Social logo

bryopsida / express-pug-bootstrap-starter-template Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 763 KB

A starter template for an app using express, pug, and bootstrap, mostly an experiment in simplicity for a full stack app.

JavaScript 76.69% Pug 23.31%
bootstrap bootstrap5 express nodejs pug-template-engine pugjs starter-template

express-pug-bootstrap-starter-template's Introduction

What is this?

This is a basic starter template for a web app. It's intended use case is for simple things that do not warrant using a SPA or other heavier client side frameworks. It opts for a very simple dev loop, no building/compiling, simply edit the files and the changes are live.

Pre-Requisites

  • Node.JS >= 20

Getting Started

To launch the app, install the dependencies npm install, and then run npm start, and navigate here, to login check the ./logs/audit.log for the generated admin password, you can change this afterwards.

If you wish to make a change, follow the above directions, expect instead of running npm start, run npm run dev. On save of your JavaScript files the server will automatically reload with the new changes.

What opinions have been added

  1. Express - this is used for the application server
  2. Helmet - when NODE_ENV is set to production helmet is used
  3. Nodemon - used for automatically reloading when JavaScript files are changed
  4. Casl - used for authorization rules
  5. Pug - used for server side rending of pages
  6. Jest - used for unit tests
  7. Playwright - used for e2e tests
  8. Iron-session - used for stateless auth using cookies
  9. Bootstrap - used for client styling and components
  10. Standard.JS - linting rules
  11. Prettier - for formatting files
  12. Config - for providing configuration system
  13. Sequelize - ORM
  14. Sqlite3 - Embedded database
  15. Umzug - Migration and seed runner

NPM Scripts

Script Description
dev Uses nodemon to automatically restart server when javascript changes
test Runs unit tests using Jest
test:e2e Runs e2e tests using Playwright
lint Checks code/files using Standard.JS and Prettier
lint:fix Automatically fix style and linting violations
start Runs the application server

Environment Variables

Name Default Description
PORT 3000 The Listening port of the server
COOKIE_PASSWORD The 32 byte key used to encrypt the cookie

Structure

  • services/ - services that support pages, routes and other activities of the server
  • routes/ - express route controllers
  • public/ - static files served by the web server
  • middleware/ - middleware functions that can be applied to many routes
  • config/ - config files and environment variable mapping
  • tests/ - E2E Tests
  • views/ - PUG templates
  • db/ - Database models, migrations and seeds

Managing DB Models and Migrations

Create a new model

You can create a new model/table by running npx sequelize-cli model:generate --name TableName --attributes prop1:string,prop2:string, this will create a basic migration for you under ./db/migrations and a new model under ./db/models.

Create a new migration

You can create a new migration by running npx sequelize-cli migration:create --name your-migration-name

Create a new seed

You can create a new seed by running npx sequelize-cli seed:generate --name seed-name

Manually running migrations

You can manually run migrations by running npx sequelize-cli db:migrate

Post template checklist

  • Change footer copyright to match your needs
  • Change header to add logo/branding to match your needs
  • Change global.css to match your styling needs
  • Change/remove renovate.json to match your needs
  • Update package name in package.json to your project name
  • Update services/users.js to use your user store
  • Update COOKIE_PASSWORD for production instances

express-pug-bootstrap-starter-template's People

Contributors

bryopsida avatar renovate[bot] avatar dependabot[bot] avatar

Stargazers

Matthew avatar

Watchers

 avatar

express-pug-bootstrap-starter-template's Issues

Add readme

Add readme with instructions on how to use the included things in the template and post templating checklist.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/ci.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/upload-artifact v4
npm
package.json
  • @casl/ability ^6.5.0
  • argon2 ^0.40.0
  • body-parser ^1.20.2
  • bootstrap ^5.3.2
  • bootstrap-icons ^1.11.2
  • config ^3.3.9
  • express ^4.18.2
  • express-joi-validation ^5.0.1
  • express-rate-limit ^7.1.4
  • express-winston ^4.2.0
  • helmet ^7.1.0
  • iron-session ^8.0.1
  • joi ^17.11.0
  • joi-password-complexity ^5.2.0
  • pug ^3.0.2
  • sequelize ^6.35.1
  • sqlite3 ^5.1.6
  • umzug ^3.4.0
  • winston ^3.11.0
  • @jest-mock/express ^2.0.2
  • @playwright/test ^1.40.0
  • jest ^29.7.0
  • nodemon ^3.0.1
  • prettier 3.2.5
  • sequelize-cli ^6.6.2
  • standard ^17.1.0
  • supertest ^7.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Add auth and login page

Add authentication to the template, use http basic to keep it simple, add a login page and automatic redirection for unauthenticated users.

Tune break points

Tune usage of breakpoints to clean up card grid and navbar. Need to clean up in in medium sizes and navbar for small sizes.

Add user management page

Add a page(s) to allow adding users, removing users, and updating users passwords. This will need a new role, 'admin', an admin can add/remove users, and change passwords for all users, a non admin can only change their own password.

Admins cannot remove themselves.

Add unit testing

Add unit test capability in addition to the E2E playwright tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.