{"id":29189435,"url":"https://github.com/maybeizen/nubodb","last_synced_at":"2025-07-01T23:07:49.222Z","repository":{"id":302123652,"uuid":"1010425660","full_name":"maybeizen/NuboDB","owner":"maybeizen","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-30T17:03:31.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-30T18:23:03.172Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maybeizen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-29T03:33:27.000Z","updated_at":"2025-06-30T17:03:34.000Z","dependencies_parsed_at":"2025-06-30T18:23:12.121Z","dependency_job_id":null,"html_url":"https://github.com/maybeizen/NuboDB","commit_stats":null,"previous_names":["maybeizen/nubodb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maybeizen/NuboDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maybeizen%2FNuboDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maybeizen%2FNuboDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maybeizen%2FNuboDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maybeizen%2FNuboDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maybeizen","download_url":"https://codeload.github.com/maybeizen/NuboDB/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maybeizen%2FNuboDB/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262842871,"owners_count":23373159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-01T23:07:47.206Z","updated_at":"2025-07-01T23:07:49.208Z","avatar_url":"https://github.com/maybeizen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NuboDB\n\nA modern, fast, and feature-rich NoSQL database for Node.js with TypeScript support, encryption, schema validation, and a modular architecture.\n\n## 🚀 Features\n\n- **🔐 Built-in Encryption** - AES-256 encryption for sensitive data\n- **📋 Schema Validation** - Comprehensive validation with custom rules\n- **🔍 Advanced Querying** - MongoDB-like query syntax with QueryBuilder\n- **⚡ High Performance** - Caching, indexing, and newly optimized storage \u0026 query engine\n- **🏗️ Modular Architecture** - Extensible and maintainable codebase\n- **📊 Real-time Statistics** - Monitor database and collection performance\n- **🛡️ Type Safety** - Full TypeScript support with type definitions\n- **🔄 Event System** - Listen to database events\n- **📦 Zero Dependencies** - Lightweight and self-contained\n\n## 📦 Installation\n\n```bash\nnpm install nubodb\n```\n\n## 🎯 Quick Start\n\n```javascript\nimport { createDatabase } from 'nubodb';\n\n// Create and open database\nconst db = await createDatabase({\n  path: './my-database',\n  debug: true,\n});\n\nawait db.open();\n\n// Get a collection\nconst users = db.collection('users');\n\n// Insert a document\nconst result = await users.insert({\n  name: 'John Doe',\n  email: 'john@example.com',\n  age: 30,\n});\n\nconsole.log('Inserted:', result.document);\n\n// Find documents\nconst allUsers = await users.find();\nconsole.log('All users:', allUsers.documents);\n\nawait db.close();\n```\n\n## 📚 Examples\n\nCheck out the comprehensive examples in the `/examples` folder:\n\n- **[Basic Usage](./examples/basic-usage.js)** - Fundamental operations\n- **[Query Builder](./examples/query-builder.js)** - Advanced querying\n- **[Schema Validation](./examples/schema-validation.js)** - Data validation\n- **[Modular Architecture](./examples/modular-architecture.js)** - Custom collections\n- **[Encryption](./examples/encryption.js)** - Data encryption\n- **[Performance](./examples/performance.js)** - Optimization features\n\nRun any example:\n\n```bash\nnode examples/basic-usage.js\n```\n\n## 🔧 Configuration\n\n### Database Options\n\n```javascript\nconst db = await createDatabase({\n  // Storage\n  path: './database', // Database directory\n  inMemory: false, // Use in-memory storage\n\n  // Encryption\n  encrypt: true, // Enable encryption\n  encryptionKey: 'your-secret-key', // Encryption key\n  encryptionMethod: 'aes-256-cbc', // Encryption algorithm\n\n  // Performance\n  cacheDocuments: true, // Enable caching\n  maxCacheSize: 1000, // Max cache size\n  enableIndexing: true, // Enable auto-indexing\n\n  // Validation\n  schemaValidation: 'strict', // 'strict' | 'warn' | 'ignore'\n\n  // Logging\n  debug: true, // Enable debug logging\n  logLevel: 'info', // 'error' | 'warn' | 'info' | 'debug'\n});\n```\n\n### Schema Definition\n\n```javascript\nconst userSchema = {\n  name: {\n    type: 'string',\n    required: true,\n    min: 2,\n    max: 50,\n  },\n  email: {\n    type: 'string',\n    required: true,\n    unique: true,\n    index: true,\n    pattern: /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/,\n  },\n  age: {\n    type: 'number',\n    min: 0,\n    max: 150,\n    default: 18,\n  },\n  isActive: {\n    type: 'boolean',\n    default: true,\n  },\n  tags: {\n    type: 'array',\n    default: [],\n  },\n  category: {\n    type: 'string',\n    enum: ['admin', 'user', 'moderator'],\n    default: 'user',\n  },\n};\n\nconst users = await db.createCollection('users', userSchema);\n```\n\n## 🔍 Querying\n\n### Basic Queries\n\n```javascript\n// Find all documents\nconst allUsers = await users.find();\n\n// Find with filter\nconst activeUsers = await users.find({ isActive: true });\n\n// Find one document\nconst user = await users.findOne({ email: 'john@example.com' });\n\n// Find by ID\nconst userById = await users.findById('document-id');\n\n// Count documents\nconst count = await users.count({ age: { $gte: 18 } });\n```\n\n### Advanced Queries with QueryBuilder\n\n```javascript\n// Fluent query builder\nconst results = await users\n  .query()\n  .where('age', '$gte', 18)\n  .and('isActive', '$eq', true)\n  .or('category', '$eq', 'admin')\n  .sort('age', -1)\n  .limit(10)\n  .select(['name', 'email', 'age'])\n  .execute();\n\n// Find one with query builder\nconst user = await users\n  .query()\n  .where('email', '$eq', 'john@example.com')\n  .findOne();\n\n// Count with query builder\nconst count = await users.query().where('isActive', '$eq', true).count();\n```\n\n### Query Operators\n\n- **Comparison**: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`\n- **Array**: `$in`, `$nin`\n- **Logical**: `$and`, `$or`, `$nor`, `$not`\n- **Existence**: `$exists`\n- **Pattern**: `$regex`\n\n## 🏗️ Modular Architecture\n\nNuboDB uses a modular architecture for better maintainability and extensibility:\n\n### Core Classes\n\n- **`BaseCollection`** - Foundation class with core functionality\n- **`DocumentOperations`** - Handles insert, update, delete operations\n- **`QueryOperations`** - Handles find, filter, sort operations\n- **`Collection`** - Main facade class that combines all operations\n\n### Custom Collections\n\n```javascript\nimport { QueryOperations, DocumentOperations, Collection } from 'nubodb';\n\n// Read-only collection\nclass ReadOnlyCollection extends QueryOperations {\n  async insert() {\n    throw new Error('Read-only collection: insert not allowed');\n  }\n}\n\n// Write-only collection\nclass WriteOnlyCollection extends DocumentOperations {\n  async find() {\n    throw new Error('Write-only collection: find not allowed');\n  }\n}\n\n// Custom collection with validation\nclass ValidatedCollection extends Collection {\n  addValidator(field, validator) {\n    this.validators.set(field, validator);\n  }\n\n  async insert(data) {\n    // Run custom validators\n    for (const [field, validator] of this.validators) {\n      if (!validator(data[field])) {\n        throw new Error(`Validation failed for field: ${field}`);\n      }\n    }\n    return super.insert(data);\n  }\n}\n```\n\n## 🔐 Encryption\n\n```javascript\n// Create encrypted database\nconst db = await createDatabase({\n  path: './encrypted-db',\n  encrypt: true,\n  encryptionKey: 'your-secret-key',\n  encryptionMethod: 'aes-256-cbc',\n});\n\n// All data is automatically encrypted/decrypted\nawait users.insert({\n  name: 'John Doe',\n  creditCard: '4111-1111-1111-1111',\n  ssn: '123-45-6789',\n});\n```\n\n## 📊 Performance \u0026 Monitoring\n\n```javascript\n// Get collection statistics\nconst stats = await users.stats();\nconsole.log('Collection stats:', stats);\n\n// Get database statistics\nconst dbStats = await db.getStats();\nconsole.log('Database stats:', dbStats);\n\n// Create indexes for better performance\nawait users.createIndex({\n  fields: { email: 1 },\n  unique: true,\n});\n\n// Clear cache\nusers.clearCache();\n\n// Compact database\nawait db.compact();\n```\n\n## 🎧 Event System\n\n```javascript\n// Listen to database events\ndb.on('document:inserted', (collection, document) =\u003e {\n  console.log(`Document inserted in ${collection}:`, document._id);\n});\n\ndb.on('document:updated', (collection, document) =\u003e {\n  console.log(`Document updated in ${collection}:`, document._id);\n});\n\ndb.on('document:deleted', (collection, documentId) =\u003e {\n  console.log(`Document deleted in ${collection}:`, documentId);\n});\n\ndb.on('error', error =\u003e {\n  console.error('Database error:', error.message);\n});\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.\n\n## 📄 License\n\nMIT License - see [LICENSE](./LICENSE) file for details.\n\n## 🆘 Support\n\n- **Documentation**: [Full API Reference](./docs/API.md)\n- **Examples**: [Code Examples](./examples/)\n- **Issues**: [GitHub Issues](https://github.com/your-repo/nubodb/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/your-repo/nubodb/discussions)\n\n## 🔄 Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md) for version history and updates.\n\n---\n\n**Made with ❤️ by maybeizen**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaybeizen%2Fnubodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaybeizen%2Fnubodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaybeizen%2Fnubodb/lists"}