A lightweight in-memory document database with TypeScript-first design and atomic writes.
npm install goldfishdb
import DB from 'goldfishdb';
// Define your schema
const schema = {
v: 1,
stores: {
users: {
type: "collection",
schema: {
name: { type: "string", required: true },
email: { type: "string", required: true },
age: { type: "number", required: false }
}
}
}
};
// Initialize database with default encryption
const db = new DB<typeof schema>().init({
schemaHistory: [{ v: 1, schema, migrationSteps: false }],
db_folder: './data'
});
// Or with custom passphrase for production
const prodDb = new DB<typeof schema>().init({
schemaHistory: [{ v: 1, schema, migrationSteps: false }],
db_folder: './data',
passphrase: 'your-production-secret'
});
// Use the database
const user = db.collection('users').insert({
name: "John Doe",
email: "john@example.com",
age: 30
});
const allUsers = db.collection('users').query();
const userById = db.collection('users').queryById(user.id);
MIT
$ claude mcp add goldfishdb \
-- python -m otcore.mcp_server <graph>