Skip to content

Rana718/Graft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

275 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Flash ORM

Go Version License: MIT Release npm version PyPI version

πŸ“— Go Guide β€’ πŸ“˜ TypeScript Guide β€’ πŸ“™ Python Guide β€’ πŸ“‹ Release Notes

image


A powerful, database-agnostic ORM built in Go with multi-database support and type-safe code generation for Go, JavaScript/TypeScript, and Python.

✨ Features

  • πŸ—ƒοΈ Multi-Database Support: PostgreSQL, MySQL, SQLite (full ORM)
  • πŸ”„ Migration Management: Create, apply, and track migrations with transaction safety
  • πŸ“€ Smart Export System: JSON, CSV, SQLite formats
  • πŸ”§ Code Generation: Type-safe code for Go, JavaScript/TypeScript, and Python
  • 🌱 Database Seeding: Generate realistic fake data for development
  • ⚑ Blazing Fast: Outperforms Drizzle and Prisma in benchmarks
  • πŸ“Š FlashORM Studio: Visual database management for SQL, MongoDB, and Redis

πŸ“Š Performance

Operation FlashORM Drizzle Prisma
Insert 1000 Users 149ms 224ms 230ms
Complex Query x500 3156ms 12500ms 56322ms
Mixed Workload x1000 186ms 1174ms 10863ms
TOTAL 5980ms 17149ms 71510ms

2.8x faster than Drizzle, 11.9x faster than Prisma

πŸš€ Installation

# NPM (Node.js/TypeScript)
npm install -g flashorm

# Python
pip install flashorm

# Go
go install github.com/Lumos-Labs-HQ/flash@latest

🏁 Quick Start

# 1. Initialize project
flash init --postgresql  # or --mysql, --sqlite

# 2. Set database URL
export DATABASE_URL="postgres://user:pass@localhost:5432/mydb"

# 3. Create and apply migrations
flash migrate "create users table"
flash apply

# 4. Generate type-safe code
flash gen

πŸ“‹ Commands

Command Description
flash init Initialize project
flash migrate <name> Create migration
flash apply Apply migrations
flash down Rollback migration
flash status Show status
flash pull Extract schema from database
flash studio Launch visual editor
flash export Export database
flash seed Seed with fake data
flash gen Generate type-safe code

πŸ—„οΈ Database Support

Database ORM Support Studio
PostgreSQL βœ… Full βœ… SQL Studio
MySQL βœ… Full βœ… SQL Studio
SQLite βœ… Full βœ… SQL Studio
MongoDB ❌ βœ… Visual Management
Redis ❌ βœ… Visual Management

πŸ“Š FlashORM Studio

SQL Studio (PostgreSQL, MySQL, SQLite)

flash studio
flash studio --db "postgres://user:pass@localhost:5432/mydb"

Features: Schema designer, data browser, relationship visualization, auto-migration creation

MongoDB Studio

Visual management interface for MongoDB (no ORM features).

flash studio --db "mongodb://localhost:27017/mydb"
flash studio --db "mongodb+srv://user:[email protected]/mydb"

Features: Collection browser, document editor, query interface, bulk operations

Redis Studio

Visual management interface for Redis (no ORM features).

flash studio --redis "redis://localhost:6379"
flash studio --redis "redis://:password@localhost:6379"

Features: Key browser, CLI terminal, memory analysis, Lua scripting, Pub/Sub, ACL management

🌱 Database Seeding

# Seed all tables
flash seed

# Custom count
flash seed --count 100

# Multiple tables with different counts
flash seed users:100 posts:500 comments:1000

# Truncate and reseed
flash seed --truncate --force

Smart data generation based on column names (email, name, phone, etc.)

πŸ”§ Configuration

{
  "version": "2",
  "schema_dir": "db/schema",
  "queries": "db/queries/",
  "migrations_path": "db/migrations",
  "database": {
    "provider": "postgresql",
    "url_env": "DATABASE_URL"
  },
  "gen": {
    "go": { "enabled": true },
    "js": { "enabled": true },
    "python": { "enabled": true }
  }
}

πŸ“€ Export System

flash export           # JSON (default)
flash export --csv     # CSV files per table
flash export --sqlite  # Portable SQLite file

πŸ› οΈ Advanced Usage

# Production deployment
flash apply --force

# Reset database (development)
flash reset --force

# Extract schema from existing database
flash pull

# Execute raw SQL
flash raw "SELECT COUNT(*) FROM users;"

πŸ“š Documentation

🀝 Contributing

git clone https://github.com/Lumos-Labs-HQ/flash.git
cd flash
make dev-setup
make build-all

πŸ“„ License

MIT License - see LICENSE file for details.


Built with ❀️ by Lumos Labs

About

Graft is a production-ready database migration CLI tool built with Go. It offers Prisma-like functionality with support for PostgreSQL, MySQL, and SQLite. πŸ”„ Smart migrations, πŸ’Ύ automatic backups, and the ability to run raw SQL code.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors