0.5.2 • Published 5 years ago

douze v0.5.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Douze

MIT License Travis CI Build Average issue resolution time Number of open issues

A Twelve Factor app framework for Node.js written in TypeScript.

Features

  • 🏗️ App scaffolding with Express
  • 🌲 Logging with Pino
  • 🚨 Error reporting with Sentry
  • 📦 Extensible with plugins (batteries included, but opt-in)
  • 🌍 Configuration via environment variables
  • 🛠️ Admin processes through Tasks

Plugins

  • douze-sequelize: Use Sequelize as an ORM for SQL databases
  • douze-mongo: MongoDB ODM (coming soon)
  • douze-redis: Redis cache & KV store (coming soon)
  • douze-graphql: GraphQL with Apollo Server 2.0 (coming soon)

Installation

$ yarn add douze
# or
$ npm install douze

Usage

// index.ts
import Douze, { Request, Response } from 'douze'

const douze = new Douze()

// Create an application with default configuration
const app = douze.createApp()

// Attach standard Express routes & middleware to your app:
app.use('/', (req: Request, res: Response) => {
  res.json({ hello: 'world' })
})

await douze.start(app)

This basic example shows sensible default configuration, overridable by environment variables where relevant.

Environment

Douze is configured by environment variables where relevant, rather than code.

Here is a list of configuration environment variables:

NameTypeDefaultDescription
APP_NAMEstring'douze-app'The name of your application
NODE_ENVstring'development'
LOG_LEVELstring'debug' in development, 'info' in production.Any of the levels defined in Pino
HOSTstring'0.0.0.0'Listening address
PORTnumber3000Listening port
SENTRY_DSNstringundefinedEnable Sentry error reporting by passing it the DSN to use
DOUZE_FINGERPRINT_SALTstringrandomA salt applied to the anonimisation function, rotate it to anonymise against previous logs
DOUZE_DATABASE_FORCE_SYNCbooleanundefinedSet to true in development to reset the database and sync the models. Existing data will be lost !
DOUZE_DATABASE_SEEDbooleanundefinedRun seeding functions in development to start with fresh data.
DOUZE_ENFORCE_PRIVACYbooleantrueRedact privacy-busting information from logs in production (headers, source IP)

Deployment variables (used to track deployed instances, those are set by default on Clever Cloud):

  • POSTGRESQL_ADDON_URI: URI to the PostgreSQL database
  • COMMIT_ID: Git commit ID of the deployment
  • INSTANCE_ID
  • INSTANCE_NUMBER