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.
- Node.JS >= 20
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.
- Express - this is used for the application server
- Helmet - when NODE_ENV is set to production helmet is used
- Nodemon - used for automatically reloading when JavaScript files are changed
- Casl - used for authorization rules
- Pug - used for server side rending of pages
- Jest - used for unit tests
- Playwright - used for e2e tests
- Iron-session - used for stateless auth using cookies
- Bootstrap - used for client styling and components
- Standard.JS - linting rules
- Prettier - for formatting files
- Config - for providing configuration system
- Sequelize - ORM
- Sqlite3 - Embedded database
- Umzug - Migration and seed runner
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 |
Name | Default | Description |
---|---|---|
PORT | 3000 | The Listening port of the server |
COOKIE_PASSWORD | The 32 byte key used to encrypt the cookie |
services/
- services that support pages, routes and other activities of the serverroutes/
- express route controllerspublic/
- static files served by the web servermiddleware/
- middleware functions that can be applied to many routesconfig/
- config files and environment variable mappingtests/
- E2E Testsviews/
- PUG templatesdb/
- Database models, migrations and seeds
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
.
You can create a new migration by running npx sequelize-cli migration:create --name your-migration-name
You can create a new seed by running npx sequelize-cli seed:generate --name seed-name
You can manually run migrations by running npx sequelize-cli db:migrate
- 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