MiniORM Playground
Try MiniORM instantly with our public test database. No configuration needed!
What is the Playground?
The MiniORM Playground provides a ready-to-use test database connection that allows you to experiment with MiniORM features without setting up your own database. Perfect for learning, testing, and prototyping!
How to Use the Playground
import { example } from 'miniorm'
// Default type is Users interface with id, name, and role
// You can provide your own type as generic parameter
const {
ExampleQueryBuilder,
ExampleModel,
ExampleDeclarativeTableBuilder,
ExampleFluentTableBuilder
} = example()
// You can also specify a custom table name
const {
ExampleQueryBuilder: ProductsQuery
} = example<ProductType>('products')
// Now you can use these instances without any configuration!
import { example } from 'miniorm'
// The default type is already defined in the example function:
// interface Users {
// id: number
// name: string
// role: 'user' | 'moderator' | 'admin'
// }
// Get a pre-configured QueryBuilder for the users table
const { ExampleQueryBuilder } = example()
// Now you can run queries immediately!
async function testQueries() {
// Get all users
const allUsers = await ExampleQueryBuilder.select().run()
// Get users with conditions
const admins = await ExampleQueryBuilder
.select()
.where({ role: 'admin' })
.run()
// Complex query example
const filteredUsers = await ExampleQueryBuilder
.select(['id', 'name'])
.where({ 'id >': 5 })
.order(['name'], 'ASC')
.limit(10)
.run()
console.log({ allUsers, admins, filteredUsers })
}
import { example } from 'miniorm'
// Using the default Users interface from the example function
const { ExampleModel } = example()
// Now you can use the model immediately!
async function testModel() {
// Find a user by ID
const user = await ExampleModel.find({ id: 1 })
// Find users with conditions
const admins = await ExampleModel.find({ role: 'admin' })
// Create a new user (note: this is a test DB, so be considerate)
const newUser = await ExampleModel.create({
name: 'Test User',
role: 'user'
})
// Update a user
if (newUser) {
await ExampleModel.update({ name: 'Updated Name' }, { id: newUser.id })
// Delete the test user when done
await ExampleModel.delete({ id: newUser.id })
}
console.log({ user, admins, newUser })
}
import { example } from 'miniorm'
// Get a pre-configured TableBuilder for a new table
const { ExampleFluentTableBuilder: TableBuilder } = example('test_table')
// Define and create a table structure
async function createTestTable() {
try {
// Define table structure
TableBuilder
.id()
.string('name', 100).notNull()
.string('email', 100).unique()
.enum('status', ['active', 'inactive']).default('active')
.boolean('is_verified').default(false)
.timestamps()
// Create the table in the test database
// Note: Tables created in the test DB may be periodically cleaned up
await TableBuilder.build()
console.log('Test table created successfully!')
} catch (error) {
console.error('Error creating test table:', error)
}
}
Playground Features
Zero Configuration
Start using MiniORM immediately without database setup or connection configuration
Safe Testing
Experiment with all MiniORM features in a sandboxed environment
Learning Tool
Perfect for learning the API and understanding how MiniORM works
Quick Prototyping
Rapidly prototype your database models and queries before implementing them
Important Notes
- Public Database: The test database is shared and publicly accessible. Do not store sensitive information.
- Data Persistence: Data in the test database may be reset periodically. Don't rely on it for persistent storage.
- Usage Limits: The test database has usage limits to ensure fair access for all users.
- For Production: Always use your own database connection for production applications.