Code Monkey home page Code Monkey logo

express-passport-knex-lit's Introduction

express-passport-knex-lit

A fullstack starter for little projects requiring authentication and user management. Based on express, passport, knex and lit, automatically packed into a docker container using a github action.

The frontend was generated using npm init @open-wc.

The backend was generated using npx express-generator.

During the docker build, the frontend build is copied from frontend/dist to backend/public, from where express serves static files. The backend is then wrapped up into the official lts-slim node image from dockerhub. Knex is configured to use better-sqlite3 in knexfile.js. If used in a docker container, the following environmental parameters are available:

  • ADMIN_USERNAME (only changed if no admin exists in the database yet, defaults to "admin")
  • ADMIN_PASSWORD (only changed if no admin exists in the database yet, defaults to "admin")
  • SESSION_SECRET (Using a secret that cannot be guessed will reduce the ability to hijack a session, see here)

For development, execute

npm run init

in order to create a database for development purposes and create one admin (password "admin") and one user (password "user").

npm start

This will serve the frontend using @web/dev-server on port 8000 and the backend using nodemon on port 3000, both watching for file changes and restarting the backend or reloading the web page on every file change. The frontend dev-server is configured to forward all calls to /api/ to the backend port.

All this is configured on Linux, I am sure you need several changes in the package.json files for development on Windows.

express-passport-knex-lit's People

Contributors

rednil avatar

Watchers

 avatar

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.