{"id":18163,"library":"bfast-database","title":"bfast-database","description":"Node.js database runtime instance for Bfast::Cloud::Database, currently in beta v4.0.0-beta.2. It acts as a database-as-a-service engine that wraps MongoDB (or optionally S3 for storage) and provides a REST API for client-side operations. Key differentiators: integrates with bfast-tools CLI, supports multiple databases (MongoDB, GridFS, S3), provides JWT authentication, and offers both restart and non-restart modes. The package is part of the Bfast ecosystem and is intended for use with bfast-tools. Development appears active with recent beta releases.","status":"active","version":"4.0.0-beta.2","language":"javascript","source_language":"en","source_url":"https://github.com/fahamutech/bfast-database","tags":["javascript"],"install":[{"cmd":"npm install bfast-database","lang":"bash","label":"npm"},{"cmd":"yarn add bfast-database","lang":"bash","label":"yarn"},{"cmd":"pnpm add bfast-database","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to run the database instance in server mode","package":"bfast-tools","optional":false},{"reason":"Primary database driver, though can be used with S3 for storage","package":"mongodb","optional":true}],"imports":[{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const BfastDatabase = require('bfast-database');","symbol":"BfastDatabase","correct":"import BfastDatabase from 'bfast-database';"},{"note":"Named export, not a default export.","wrong":"import initialize from 'bfast-database';","symbol":"initialize","correct":"import { initialize } from 'bfast-database';"},{"note":"TypeScript usage for type imports.","symbol":"BfastDatabase (type)","correct":"import type { BfastDatabase } from 'bfast-database';"}],"quickstart":{"code":"import BfastDatabase from 'bfast-database';\n\nconst db = new BfastDatabase({\n  applicationId: process.env.APPLICATION_ID || 'bfast',\n  masterKey: process.env.MASTER_KEY || 'bfast',\n  projectId: process.env.PROJECT_ID || 'bfast',\n  databaseURI: process.env.DATABASE_URI || 'mongodb://localhost/bfast',\n  port: parseInt(process.env.PORT || '3000'),\n  production: process.env.PRODUCTION === '1',\n  rsaKey: process.env.RSA_KEY ? JSON.parse(process.env.RSA_KEY) : undefined,\n  rsaPublicKey: process.env.RSA_PUBLIC_KEY ? JSON.parse(process.env.RSA_PUBLIC_KEY) : undefined\n});\n\nawait db.start();\nconsole.log('bfast-database running on port', db.port);","lang":"typescript","description":"Initialize and start bfast-database with required environment variables."},"warnings":[{"fix":"Refer to v4 documentation or migrate from v3.","message":"bfast-database v4 is a complete rewrite; APIs from v3 are not compatible.","severity":"breaking","affected_versions":">=4.0.0-beta.0"},{"fix":"Install bfast-tools globally: npm install -g bfast-tools","message":"bfast-tools CLI is required for server mode; standalone usage may not be fully supported.","severity":"deprecated","affected_versions":">=4.0.0-beta.0"},{"fix":"Set APPLICATION_ID, MASTER_KEY, PROJECT_ID, DATABASE_URI in production.","message":"Environment variables must be set before starting; defaults only apply in development mode (PRODUCTION='0').","severity":"gotcha","affected_versions":">=4.0.0-beta.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run: npm install -g bfast-tools","cause":"bfast-tools is not installed globally.","error":"Error: Cannot find module 'bfast-tools'"},{"fix":"Check DATABASE_URI env variable; ensure user/password are correct.","cause":"Invalid MongoDB credentials or database URI.","error":"MongoError: Authentication failed"},{"fix":"Use import BfastDatabase from 'bfast-database';","cause":"Using CommonJS require instead of ESM import.","error":"TypeError: BfastDatabase is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}