Registry / database / userito

userito

JSON →
library5.0.0jsnpmunverified

Userito is a Node.js library designed for managing user data, offering persistence options via either a local JSON file or a MongoDB database. The current stable version is 5.0.0, released in 2022, which introduced support for Node.js 16 and dropped compatibility with older Node.js versions. While there isn't a strict release cadence, new major versions typically align with Node.js End-of-Life (EOL) cycles, dropping support for older runtimes, and incorporating dependency updates like Mongoose. Its primary differentiator is the flexibility to switch between simple file-based storage, suitable for development or small applications, and a robust MongoDB backend for more scalable solutions, all through a unified, function-based API. It provides core CRUD operations for user management.

npm install userito
INSTALL
IMPORT
SIG · USERITO
U
userito
databasejavascriptv5.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

userito (factory function)
const useritoFactory = require('userito'); const useritoInstance = useritoFactory({ type: 'file' });
const useritoInstance = require('userito'); // Missing immediate invocation
The 'userito' package exports a factory function as its default. You must invoke it immediately with options to get an operational instance.
userito (chained initialization)
const useritoFile = require('userito')({ type: 'file' });
const { useritoFile } = require('userito'); // Not a named export
This is the idiomatic CommonJS way to initialize Userito directly at the point of import.
userito (ESM import)
import useritoFactory from 'userito'; const useritoFile = useritoFactory({ type: 'file' });
import { useritoFile } from 'userito'; // Not a named export, default export is a function
For ESM environments, import the default factory function and then call it with your configuration options. Requires Node.js 16+.

This quickstart demonstrates how to initialize Userito with file-based storage and perform basic CRUD operations (create, get all, get one, remove) for users.

import useritoFactory from 'userito'; import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); async function main() { const useritoFile = useritoFactory({ type: 'file', path: path.join(__dirname, 'users.json') // Use a specific path for the quickstart }); // Create a new user await new Promise(resolve => { useritoFile.create({ username: 'testuser', password: 'securepassword' }, (error, msg) => { if (error) console.error('Error creating user:', error); else console.log('User created:', msg); resolve(); }); }); // Get all users await new Promise(resolve => { useritoFile.all((error, users) => { if (error) console.error('Error getting all users:', error); else console.log('All users:', users); resolve(); }); }); // Get a specific user await new Promise(resolve => { useritoFile.get('testuser', (error, user) => { if (error) console.error('Error getting user:', error); else console.log('Specific user:', user); resolve(); }); }); // Remove the user await new Promise(resolve => { useritoFile.remove('testuser', (error, info) => { if (error) console.error('Error removing user:', error); else console.log('User removed:', info); resolve(); }); }); } main().catch(console.error);
Debug
Known issues
breakingUserito v5.0.0 drops support for Node.js versions older than 16. Applications running on Node.js 14 or earlier will break upon upgrade.
fix
Upgrade your Node.js runtime to version 16 or newer before upgrading to Userito v5.0.0.
affects: >=5.0.0
breakingUserito v4.0.0 dropped support for Node.js versions older than 14. This was a significant breaking change for users on older runtimes.
fix
Upgrade your Node.js runtime to version 14 or newer. For v5.x, Node.js 16+ is required.
affects: >=4.0.0 <5.0.0
breakingUserito v3.0.0 dropped support for Node.js versions 8 and older, requiring Node.js 10 or newer. This introduced potential breaking changes for legacy applications.
fix
Ensure your Node.js runtime is version 10 or newer. For v4.x, Node.js 14+ is needed, and for v5.x, Node.js 16+ is required.
affects: >=3.0.0 <4.0.0
gotchaThe `db` option for MongoDB initialization requires a Mongoose-compatible connection string and optionally a schema definition. Incorrect connection strings or missing schema fields can lead to database connection errors or unexpected data behavior.
fix
Verify your MongoDB connection string is correctly formatted. Ensure any provided `schema` object matches the structure of your user data in MongoDB. Consult Mongoose documentation for connection string options compatible with `mongoose` v6.5.0 (used in userito v5.0.0).
affects: >=1.0.0
breakingVersion 5.0.0 updated the underlying Mongoose dependency to `v6.5.0`. This could introduce breaking changes or require adjustments to Mongoose-specific options if your application directly interacted with Mongoose instances or relied on deprecated features from older Mongoose versions.
fix
Review the Mongoose v6.x migration guide if you encounter issues, especially regarding connection options (like `useNewUrlParser`, `useUnifiedTopology`, etc.) which are now default or removed. Ensure your MongoDB instance is compatible.
affects: >=5.0.0
Errors
Common errors & fixes
TypeError: userito.all is not a function
The 'userito' package exports a factory function that must be invoked with options to return an operational instance, not an object with methods directly.
fix
Initialize Userito by calling the imported function with configuration: `const useritoInstance = require('userito')({ type: 'file' });` or `import useritoFactory from 'userito'; const useritoInstance = useritoFactory({ type: 'file' });`
MongoParseError: option useUnifiedTopology is not supported
This error typically occurs when using Mongoose v6.x (or newer) with old connection options that are no longer supported or are defaults.
fix
Userito v5.0.0 uses Mongoose v6.5.0. Remove deprecated options like `useNewUrlParser`, `useUnifiedTopology`, `useFindAndModify`, and `useCreateIndex` from your MongoDB connection string or `db` options, as they are no longer necessary or supported in Mongoose 6+.
Error: Cannot find module 'userito'
The 'userito' package was likely installed globally (`npm i userito -g`) but not locally in your project, or the module resolution path is incorrect.
fix
Install 'userito' locally in your project: `npm i userito`. If it's already installed, check your `node_modules` and module resolution paths.
ERR_REQUIRE_ESM: require() of ES Module .../node_modules/userito/index.mjs not supported.
Attempting to `require()` an ESM-only package in a CommonJS context, or `userito` is incorrectly configured as ESM-only for your environment.
fix
If 'userito' is indeed an ESM-only package (check its `package.json` `type` field or main entry point), ensure your project is configured for ESM (e.g., `"type": "module"` in your `package.json`) and use `import useritoFactory from 'userito';` instead of `require()`.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
mongooserequiredRequired for MongoDB database storage ('type: db' option).
Agent activity
29 hits · last 30 days
node
22
Meta
2
Google (search)
1
OpenAI (training)
1
Resources