
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
@ahmedabdalla_85/schemakit
Advanced tools
Dynamic entity management system with runtime schema creation, validation, and CRUD operations. Zero dependencies, works in Node.js and browsers.
⚠️ BETA VERSION - This is a beta version and is not recommended for production use. Please use with caution and expect potential breaking changes.
🚧 ACTIVE DEVELOPMENT - This library is actively under development. Functionality may change and features are under testing. Expect bugs and incomplete features.
SchemaKit lets you create, validate, and manage entities and data at runtime, with built-in permissions and support for SQLite and PostgreSQL. Written in TypeScript.
npm install @ahmedabdalla_85/schemakit
import { SchemaKit } from '@ahmedabdalla_85/schemakit';
// Initialize SchemaKit
const schemaKit = new SchemaKit({
adapter: {
type: 'sqlite',
config: { filename: 'database.db' }
}
});
// Initialize (automatically installs SchemaKit if not already installed)
await schemaKit.initialize();
const user = await schemaKit.entity('users','system');
// Create a user entity
await user.create({
name: 'John Doe',
email: 'john@example.com'
});
// Update user
const updatedUser = await user.update(1,{
name: 'John Smith'
});
// Find All users
const Entities = await user.read();
// Find user by name
const fieldRecord = await user.read({user_name:"John Doe"});
// Delete user
await user.delete(1);
Automatic validation based on field types and custom rules:
// This will validate field types automatically
const user = await schemaKit.create('user', {
name: 'John', // string
age: 25, // number
isActive: true, // boolean
createdAt: new Date(), // date
tags: ['admin', 'user'], // array
metadata: { role: 'admin' } // object
});
Role-based access control with fine-grained permissions:
const context = {
user: {
id: 'user123',
roles: ['admin']
}
};
// Check permissions
const canCreate = await schemaKit.checkPermission('user', 'create', context);
// Get all permissions
const permissions = await schemaKit.getEntityPermissions('user', context);
sql/schema.sql
- Defines system tables structuresql/seed.sql
- Initial data and default entitiesWhen SchemaKit is installed, it creates the following system tables in your database:
Table Name | Purpose | Description |
---|---|---|
system_entities | Entity Definitions | Stores metadata for all dynamic entities including name, table name, and configuration |
system_fields | Field Definitions | Defines fields for each entity with validation rules, types, and constraints |
system_permissions | Access Control | Role-based permissions for entities and field-level access control |
system_views | Query Views | Predefined query configurations for entities with sorting and filtering |
system_workflows | Automation | Workflow definitions for automated actions on entity lifecycle events |
system_rls | Row-Level Security | Security rules that control which records users can access |
system_installation | Version Management | Tracks SchemaKit installation version and metadata |
const schemaKit = new SchemaKit({
adapter: {
type: 'sqlite',
config: {
filename: 'database.db' // or ':memory:' for in-memory
}
}
});
Note: SQLite adapter requires better-sqlite3
to be installed separately:
npm install better-sqlite3
const schemaKit = new SchemaKit({
adapter: {
type: 'postgres',
config: {
host: 'localhost',
port: 5432,
database: 'mydb',
user: 'username',
password: 'password'
}
}
});
const schemaKit = new SchemaKit({
adapter: {
type: 'sqlite',
config: { filename: 'database.db' }
},
cache: {
enabled: true,
ttl: 3600000 // 1 hour
}
});
Supported field types:
string
- Text datanumber
- Numeric databoolean
- True/false valuesdate
- Date/time valuesarray
- Array datajson
- JSON objectsreference
- References to other entities// String validation
{
type: 'string',
validation_rules: {
minLength: 2,
maxLength: 50,
pattern: '^[a-zA-Z]+$'
}
}
// Number validation
{
type: 'number',
validation_rules: {
min: 0,
max: 120
}
}
// Array validation
{
type: 'array',
validation_rules: {
minItems: 1,
maxItems: 10
}
}
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch
# Build for production
npm run build:all
# Build CommonJS
npm run build
# Build ES modules
npm run build:esm
# Build UMD
npm run build:umd
MIT © Ahmed Abdalla
Contributions are welcome! Please feel free to submit a Pull Request.
Made with ❤️ by Ahmed Abdalla
FAQs
Dynamic entity management system with runtime schema creation, validation, and CRUD operations. Zero dependencies, works in Node.js and browsers.
We found that @ahmedabdalla_85/schemakit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.