Registry / database / follicle

follicle

JSON →
library3.1.0jsnpmunverified

Follicle is a class-based ES6 ODM (Object Document Mapper) for MongoDB and NeDB, forked from camo to support multiple concurrent database connections. Current version is 3.1.0 (stable, requires Node >=12). It provides a familiar OOP interface with ES6 classes, native Promises, and support for embedded documents, hooks, and counting. Unlike Mongoose, it offers a lighter-weight approach and supports NeDB as an alternative backend for development or in-memory usage. Release cadence is irregular; maintained by Seald.

npm install follicle
INSTALL
IMPORT
SIG · FOLLICLE
F
follicle
databasejavascriptv3.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connect
✓ import { connect } from 'follicle'
✗ const connect = require('follicle').connect
ESM-only; CommonJS require is not supported for named exports.
Document
✓ import { Document } from 'follicle'
✗ const { Document } = require('follicle')
ESM-only; Document is a named export.
EmbeddedDocument
✓ import { EmbeddedDocument } from 'follicle'
Named export for defining embedded schemas.

Shows connecting to MongoDB, defining a document class, creating and saving a document, and querying with a filter.

import { connect, Document } from 'follicle'; (async () => { const database = await connect('mongodb://localhost:27017/mydb'); class User extends Document { constructor() { super(); this.name = ''; this.email = ''; this.age = 0; } } const user = User.create({ name: 'Jane Doe', email: 'jane@example.com', age: 30 }); await user.save(); const users = await User.find({ age: { $gte: 18 } }); console.log(users); await database.close(); })().catch(console.error);
Debug
Known issues
gotchaThe package is ESM-only since v3.0.0. Importing with require() will fail.
fix
Use import statements and set type: 'module' in package.json, or use dynamic import().
affects: >=3.0.0
gotchaYou must install at least one backend driver (@seald-io/nedb or mongodb) or require it at runtime. Follicle will throw if no backend is available.
fix
Run 'npm install @seald-io/nedb' for development or 'npm install mongodb' for production.
affects: >=1.0.0
deprecatedUsing `connect()` with NeDB may have connection pool limitations compared to MongoDB; NeDB support is considered legacy.
fix
Migrate to MongoDB for production workloads.
affects: >=3.0.0
Errors
Common errors & fixes
Error: Cannot find module 'follicle'
Follicle is not installed or not resolved due to ESM configuration.
fix
Run 'npm install follicle --save' and ensure 'type': 'module' in package.json if using ESM.
TypeError: connect is not a function
Using require() on an ESM-only export.
fix
Replace require() with import { connect } from 'follicle'.
Error: No database backend found. Please install @seald-io/nedb or mongodb.
Missing backend dependency.
fix
Install npm install @seald-io/nedb (for development) or npm install mongodb (for production).
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
@seald-io/nedboptionalOptional NeDB backend for development or in-memory storage
mongodboptionalOptional MongoDB backend for production
Agent activity
4 hits · last 30 days
node
4
Resources
follicle — npm install follicle · libregistry