Getting Started
From zero to a working data layer in 5 minutes. No database, no Docker, no existential crisis.
Step 1: Install SeedORM
$ npm install seedormStep 2: Initialize a project
Create a new directory for your project and initialize it:
$ mkdir my-app && cd my-app$ seedorm init✓ Created seedorm.config.json✓ Created data/ directory✓ Created migrations/ directoryThat's it. No database connection strings, no environment variables, no crying. Your data will be stored in data/seedorm.json, which is just a plain JSON file you can open and read like a normal human being.
Step 3: Define a model
Create a file for your application logic. Models define the shape and constraints of your data. Think of them as the contract between "what you think your data looks like" and "what it actually looks like."
1import { SeedORM, FieldType } from "seedorm";23async function main() {4 // Create a SeedORM instance (defaults to JSON adapter)5 const db = new SeedORM();6 await db.connect();78 // Define a User model9 const User = db.model({10 name: "User",11 collection: "users",12 schema: {13 name: { type: FieldType.String, required: true, minLength: 1, maxLength: 100 },14 email: { type: FieldType.String, required: true, unique: true },15 age: { type: FieldType.Number, min: 0, max: 150 },16 role: { type: FieldType.String, enum: ["admin", "user", "moderator"], default: "user" },17 active:{ type: FieldType.Boolean, default: true },18 },19 prefix: "usr", // IDs will look like usr_V1StGXR8_Z5j20 });2122 // Initialize the collection (creates it if it doesn't exist)23 await User.init();2425 // ... your app logic goes here (see below) ...2627 await db.disconnect();28}2930main();Step 4: Create and query data
Create documents
// Create a single documentconst alice = await User.create({ name: "Alice Johnson", email: "alice@example.com", age: 30, role: "admin",});console.log(alice);// {// id: "usr_7pplmrxTXJxu",// name: "Alice Johnson",// email: "alice@example.com",// age: 30,// role: "admin",// active: true, // default applied// createdAt: "2025-...",// updatedAt: "2025-..."// }// Create multiple documents at onceconst users = await User.createMany([ { name: "Bob Smith", email: "bob@example.com", age: 25 }, { name: "Charlie Brown", email: "charlie@example.com", age: 35 },]);Query with filters
// Find all users older than 25, sorted by nameconst results = await User.find({ filter: { age: { $gt: 25 } }, sort: { name: 1 },});// Find one user by emailconst user = await User.findOne({ email: "alice@example.com" });// Find by IDconst found = await User.findById("usr_7pplmrxTXJxu");// Count documentsconst total = await User.count();const adminCount = await User.count({ role: "admin" });Update and delete
// Update a document (partial update)const updated = await User.update(alice.id, { age: 31, role: "moderator",});// Delete a documentawait User.delete(alice.id);// Delete multiple with a filterconst deletedCount = await User.deleteMany({ active: false });Define relations between models
SeedORM also supports relations like hasOne, hasMany, belongsTo, and manyToMany, so you can populate related documents with a single query. See the Relations page for details and examples.
Step 5: Use the dev server
SeedORM ships with a built-in REST API server so you can test your data with curl, Postman, or whatever your frontend framework is this week:
$ npx seedorm start✓ Connected to databaseseedorm dev serverinfo Listening on http://localhost:4100REST API: GET/POST/PUT/DELETE /api/:collection/:idNow you can interact with your data via HTTP:
# Register a model$ curl -X POST http://localhost:4100/api/models \ -H 'Content-Type: application/json' \ -d '{"name":"Todo","collection":"todos","schema":{"title":"string","done":"boolean"}}'# Create a document$ curl -X POST http://localhost:4100/api/todos \ -H 'Content-Type: application/json' \ -d '{"title":"Learn seedorm","done":false}'# List all documents$ curl http://localhost:4100/api/todos# Update a document$ curl -X PATCH http://localhost:4100/api/todos/doc_abc123 \ -H 'Content-Type: application/json' \ -d '{"done":true}'Step 6: Browse with Studio
If you're more of a visual person (no judgment), launch Studio to browse and edit your data in a real UI:
$ npx seedorm studio✓ Connected to databaseseedorm studioinfo Open http://localhost:4200 in your browserNext steps
- Read the API Reference for the complete list of methods and options
- Explore the CLI Reference for all available commands
- When you're ready for production, check the Switching Adapters section