semini

raw JSON →
1.5.125 verified Sat May 09 auth: no javascript

Semini (v1.5.125) is a Node.js package for database and website initialization using MongoDB, Express.js, and Handlebars.js. It provides tools for setting up database schemas, seeding data, and configuring SEO-friendly site structures. Compared to alternatives, it offers a bundled initialization workflow with minimal configuration. Released infrequently, this version is stable but lacks detailed documentation.

error SyntaxError: Cannot use import statement outside a module
cause Package is ESM-only, but project is not configured for ESM.
fix
Add "type": "module" to package.json or use .mjs extension.
error TypeError: init is not a function
cause Using default import for named export.
fix
Use import { init } from 'semini' instead of import semini from 'semini'.
error Error: MongoDB connection error: MongoError: bad auth Authentication failed.
cause Missing or incorrect database credentials in config.
fix
Check MONGO_URI env var or config.database.uri includes username and password.
error Error: Cannot find module 'handlebars'
cause Handlebars peer dependency not installed.
fix
Run npm install handlebars.
breaking In v1.0.0, the package switched from CommonJS to ESM. require() will fail.
fix Use import syntax or downgrade to v0.x.
gotcha The init function mutates the global Express app object if not isolated.
fix Pass a fresh Express instance via config or use a scoped initialization.
deprecated The default import semini() is deprecated since v1.5.0.
fix Use named import { init } instead.
gotcha Handlebars templates must be placed in a 'views' directory by default, else initialization fails silently.
fix Set 'site.viewsDir' in config to the correct path.
breaking MongoDB driver v4+ is required as of v1.4.0; v3 is not supported.
fix Update mongodb dependency to v4 or later.
npm install semini
yarn add semini
pnpm add semini

Shows how to import and use the init function with MongoDB connection string from environment variable.

import { init } from 'semini';

const config = {
  database: {
    uri: process.env.MONGO_URI ?? 'mongodb://localhost:27017/myapp',
    name: 'myapp'
  },
  site: {
    title: 'My Site',
    description: 'A site initialized with semini'
  }
};

init(config)
  .then(() => console.log('Database and site initialized successfully'))
  .catch(err => console.error('Initialization failed:', err));