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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BfastDatabase
✓ import BfastDatabase from 'bfast-database';
✗ const BfastDatabase = require('bfast-database');
ESM-only package; CommonJS require is not supported.
initialize
✓ import { initialize } from 'bfast-database';
✗ import initialize from 'bfast-database';
Named export, not a default export.
BfastDatabase (type)
✓ import type { BfastDatabase } from 'bfast-database';
TypeScript usage for type imports.
Initialize and start bfast-database with required environment variables.
import BfastDatabase from 'bfast-database';
const db = new BfastDatabase({
applicationId: process.env.APPLICATION_ID || 'bfast',
masterKey: process.env.MASTER_KEY || 'bfast',
projectId: process.env.PROJECT_ID || 'bfast',
databaseURI: process.env.DATABASE_URI || 'mongodb://localhost/bfast',
port: parseInt(process.env.PORT || '3000'),
production: process.env.PRODUCTION === '1',
rsaKey: process.env.RSA_KEY ? JSON.parse(process.env.RSA_KEY) : undefined,
rsaPublicKey: process.env.RSA_PUBLIC_KEY ? JSON.parse(process.env.RSA_PUBLIC_KEY) : undefined
});
await db.start();
console.log('bfast-database running on port', db.port);
Errors
Common errors & fixes
Error: Cannot find module 'bfast-tools'
bfast-tools is not installed globally.
fixRun: npm install -g bfast-tools
MongoError: Authentication failed
Invalid MongoDB credentials or database URI.
fixCheck DATABASE_URI env variable; ensure user/password are correct.
TypeError: BfastDatabase is not a constructor
Using CommonJS require instead of ESM import.
fixUse import BfastDatabase from 'bfast-database';
Upgrade
Version history
4.0.0-beta.2latest on npm
Audit
Dependencies
bfast-toolsrequiredRequired to run the database instance in server mode
mongodboptionalPrimary database driver, though can be used with S3 for storage