Registry / database / startupdb

startupdb

JSON →
library3.0.19jsnpmunverified

A file-based database for Express.js applications. Its current stable version is 3.0.19. It stores data in JSON files on the filesystem, making it suitable for small projects or prototyping where a full database is unnecessary. Key differentiators include zero configuration, automatic file management, and tight integration with Express routing. It is released as needed on npm with no fixed cadence. Compared to alternatives like lowdb, startupDB offers simpler file handling and is specifically designed to work as middleware for Express.

npm install startupdb
INSTALL
IMPORT
SIG · STARTUPDB
S
startupdb
databasejavascriptv3.0.19
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

startupDB
✓ const startupDB = require('startupdb')
✗ import startupDB from 'startupdb'
CommonJS module; no ES module version available.
startupDB()
✓ app.use(startupDB())
✗ app.use(startupDB)
Call startupDB as a function to initialize the middleware.
req.db
✓ req.db.get('users')
✗ req.startupDB.get('users')
The database instance is attached to req.db by default.

Sets up Express with startupDB middleware, demonstrating GET and POST routes to interact with a file-based 'users' collection.

const express = require('express'); const startupDB = require('startupdb'); const app = express(); const PORT = process.env.PORT || 3000; app.use(startupDB()); app.get('/users', (req, res) => { const users = req.db.get('users') || []; res.json(users); }); app.post('/users', (req, res) => { const user = req.body; req.db.push('users', user); res.status(201).json(user); }); app.listen(PORT, () => { console.log(`Server running on port ${PORT}`); });
Debug
Known issues
gotchaThe database file operation is synchronous and blocking. Avoid using startupDB in production with high concurrency.
fix
Use a proper database like MongoDB or PostgreSQL for scalable applications.
affects: all
gotchaData is not automatically persisted after each write; you may need to call `req.db.save()` after modifications.
fix
Upgrade to version 3.0.0 or later, or call `req.db.save()` after pushes.
affects: <3.0.0
breakingIn v2, `req.startupDB` was used instead of `req.db`. This is a breaking change.
fix
Replace `req.startupDB` with `req.db` as of v3.
affects: >=2.0.0 <3.0.0
deprecatedThe `startupDB` function without arguments uses a default data directory './data'. This may be deprecated in future versions.
fix
Explicitly pass a configuration object with a `dataPath` property.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'startupdb'
Package not installed in node_modules.
fix
Run `npm install startupdb`.
TypeError: startupDB is not a function
Using ES module import syntax with CommonJS package.
fix
Use `const startupDB = require('startupdb')` instead of `import`.
TypeError: Cannot read properties of undefined (reading 'get')
StartupDB middleware not initialized or called incorrectly.
fix
Ensure `app.use(startupDB())` is called with parentheses.
Error: ENOENT: no such file or directory, open './data/startupdb.json'
The default data directory does not exist.
fix
Create the directory or configure a custom `dataPath` in startupDB options.
Upgrade
Version history
3.0.19latest on npm
Audit
Dependencies
expressrequiredstartupDB is designed as middleware for Express.js applications
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
startupdb — npm install startupdb · libregistry