npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@greenlock/store-sequelize

v3.0.3

Published

A Sequelize-based certificate store for greenlock that supports wildcards.

Downloads

51

Readme

greenlock-store-sequelize | A Root project

A database-driven Greenlock storage plugin with wildcard support.

Features

  • Many Supported SQL Databases
    • [x] PostgreSQL (best)
    • [x] SQLite3 (easiest)
    • [x] Microsoft SQL Server (mssql)
    • [x] MySQL, MariaDB
  • Works on all platforms
    • [x] Mac, Linux, VPS
    • [x] AWS, Heroku, Akkeris, Docker
    • [x] Windows

Usage

To use, provide this Greenlock storage plugin as the store option when you invoke create:

Greenlock.create({
  store: require('greenlock-store-sequelize')
  ...
});

Configuration

SQLite3 is the default database, however, since it has a large number of dependencies and may require a native module to be built, you must explicitly install sqlite3:

npm install --save sqlite3

The default db file will be written wherever Greenlock's configDir is set to, which is probably ~/acme or ~/letsencrypt.

~/acme/db.sqlite3

If you wish to set special options you may do so by passing a pre-configured Sequelize instance:

var Sequelize = require('sequelize');
var db = new Sequelize({ dialect: 'sqlite', storage: '/Users/me/acme/db.sqlite3' });

Greenlock.create({
  store: require('greenlock-store-sequelize').create({ db: db })
  ...
});

The general format of a DATABASE_URL is something like this:

schema://user:pass@server:port/service?option=foo

For example:

postgres://aj:[email protected]:5432/greenlock

For each database the exact format may be slightly different:

  • postgres://user:pass@hostname:port/database?option=foo
  • sqlserver://user:pass@datasource:port/instance/catalog?database=dbname (mssql)
  • mysql://user:pass@hostname:port/database?option=foo
  • mariadb://user:pass@hostname:port/database?option=foo

There's also a way to specify objects instead of using the standard connection strings.

See the next section for more information.

var dbUrl = 'postgres://user:pass@hostname:port/database';

Greenlock.create({
  store: require('greenlock-store-sequelize').create({ storeDatabaseUrl: dbUrl })
  ...
});

If you need to use custom options, just instantiate sequelize directly:

var Sequelize = require('sequelize');
var db = new Sequelize('postgres://user:pass@hostname:port/database');

Greenlock.create({
  store: require('greenlock-store-sequelize').create({ db: db })
  ...
});

See the Sequelize Getting Started docs for more info on database options for sequelize.

For example, if you're using Heroku, Akkeris, or Docker you're database connection string is probably DATABASE_URL, so you'd do something like this:

var Sequelize = require('sequelize');
var databaseUrl = process.env['DATABASE_URL'];
var db = new Sequelize(databaseUrl);

Greenlock.create({
  store: require('greenlock-store-sequelize').create({ db: db })
  ...
});
  • Keypair
  • Domain
  • Certificate
  • Chain

If you'd like to add a table name prefix or define a specific schema within the database (PostgreSQL, SQL Server), you can do so like this:

var Sequelize = require('sequelize');
var databaseUrl = process.env['DATABASE_URL'];
var db = new Sequelize(databaseUrl, {
    hooks: {
        beforeDefine: function (columns, model) {
          model.tableName = 'MyPrefix' + model.name.plural;
          //model.schema = 'public';
        }
    }
});

Greenlock.create({
  store: require('greenlock-store-sequelize').create({ db: db })
  ...
});

Table Structure

This is the table structure that's created.

CREATE TABLE `Keypairs` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
  `xid` VARCHAR(255) UNIQUE,
  `content` TEXT,
  `createdAt` DATETIME NOT NULL,
  `updatedAt` DATETIME NOT NULL);

CREATE TABLE `Domains` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
  `subject` VARCHAR(255) UNIQUE,
  `altnames` TEXT,
  `createdAt` DATETIME NOT NULL,
  `updatedAt` DATETIME NOT NULL);

CREATE TABLE `Certificates` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
  `subject` VARCHAR(255) UNIQUE,
  `cert` TEXT,
  `issuedAt` DATETIME,
  `expiresAt` DATETIME,
  `altnames` TEXT,
  `chain` TEXT,
  `createdAt` DATETIME NOT NULL,
  `updatedAt` DATETIME NOT NULL);

CREATE TABLE `Chains` (
  `id` INTEGER PRIMARY KEY AUTOINCREMENT,
  `xid` VARCHAR(255) UNIQUE,
  `content` TEXT,
  `createdAt` DATETIME NOT NULL,
  `updatedAt` DATETIME NOT NULL,
  `CertificateId` INTEGER REFERENCES
  `Certificates` (`id`) ON DELETE SET NULL ON UPDATE CASCADE);