A boiler template for node.js using express.js for quick development. Comes with user system, dashboard and settings, including 2FA and password management. Further comes with a few small middleware scripts for RabbitMQ, user/input validation and recapcha and 2FA verification. It uses knex.js for sql query building and supports mysql, postgres, sqlite, and oracle. knex.js also builds your database schema for your, see the schema.js file in /utils/db.
- node.js 8+
- knex.js compatible database
- RabbitMQ (optional)
- Recaptcha v2 Keys
- MVC framework - express.js
- User system - registration, login, 2FA, password manager - passport.js
- SQL query/schema builder - knex.js
- Template system - pug.js
- Public frontend page
- App dashboard page
- User settings page
- Welcome + ToS page
- Input validation middleware
- RabbitMQ lib - amqplib
- Google Recaptcha middleware
- Bulma
- Swanson Assets
Clone the repository:
git clone https://github.com/fexra/turtle-express-starter myproject
cd myproject
Install dependencies:
- MariaDB installation instructions
- MariaDB configuration instructions
- NodeJS installation instructions
Create the database in the MariaDB command line:
CREATE DATABASE mydatabase;
Sign up for and generate recaptcha keys here. Only recaptcha v2 is supported, do not select v3.
Copy the example .env file to .env and fill it out. All fields are required except the RABBITMQ fields.
cp .env-example .env
Here's an example of a completed .env file:
APP_PORT=8015
APP_SECRET=appsecret
APP_COOKIE_SECRET=appcookiesecret
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASS=yourdbpassword
DB_NAME=mydatabase
RABBITMQ_USER=
RABBITMQ_PASS=
RECAPTCHA_SITE_KEY=recaptchaapikeyhere
RECAPTCHA_SECRET_KEY=recaptchasecretkeyhere
Install the nodejs modules:
npm i
Start the application:
npm start
The application will be served on whatever port you configured in .env for APP_PORT
.
- Node.js documentation: https://nodejs.org/en/docs/
- Knex.js documentation: https://knexjs.org/
- Turtlecoin-rpc documentation: https://api-docs.turtlecoin.lol/