Meet Bob
A lightweight declarative transpiler that converts bob DSL into SQL code for SQLite, MariaDB, and PostgreSQL. Write less boilerplate, maintain better database logic.
$ bob -i users.bob -d sqlite -o ./sql/
✨ Successfully transpiled
🚀 Generated SQL for SQLite database!
Why Choose Bob?
Bob combines the simplicity of modern syntax with the power of SQL, giving you the best of both worlds.
-
Declarative Syntax
Define tables, fields, relationships, and queries in a clear and human-readable DSL format.
-
Multi-Database Support
Generate SQL for SQLite, MariaDB, and PostgreSQL with a single .bob file.
-
Easy to Learn
Bob's syntax is designed to be intuitive and easy to learn, making it accessible to developers of all skill levels.
-
Horizontal ORM
Use Bob as a syntax-driven ORM that integrates with any tech stack without imposing architectural constraints.
-
Built-in CLI
Transpile, manage, and automate database workflows right from your terminal with Bob's CLI.
-
Powerful Query Language
Create nested, grouped, and conditional queries without writing a single line of raw SQL.
See Bob in Action
Write expressive .bob code and let Bob handle the SQL generation for you.
Want to understand how to write it? Go to introductionPlayGround
.bob input
.bob output
If you use the CLI, you can specify an output path (folder) for generating the project.
Bob will analyze all your files and generate the SQL in the specified path,
separating tables and actions individually while preserving your original names.
input
output
actions
How to Write Bob Files
table {tableName} {
{columnName} {columnType}
}
get {tableName} {
{columnName} or * | ... to retrieve everything
# Using an alias
{aliasName}: {columnName}
# Filtering
if {columnName} {operator} {value}
# You can concatenate multiple filters with the same operator for a specific column using && or ||
if {columnName} {operator} {value} && {value}
# To add an alternative condition, you can use `or` above an `if`
or {columnName} {operator} {value} || {value}
# You can also use left joins with ->
-> {tableName} {unionColumnName, "id" by default} {
...
}
# You can also use subqueries
${aliasName}: get {tableName} {
...
}
}
set {tableName} {
{columnName} {newValue}
# or
{columnName}: {newValue}
# Filtering
if {columnName} {operator} {value}
# You can concatenate multiple filters with the same operator for a specific column using && or ||
if {columnName} {operator} {value} && {value}
# To add an alternative condition, you can use `or` above an `if`
or {columnName} {operator} {value} || {value}
}
new {tableName} {
{columnName} {newValue}
# or
{columnName}: {newValue}
}
# Bulk version
new {tableName} {columnName} {columnName} ... {
{value} {value} ...
}
delete {tableName} {
# Filtering
if {columnName} {operator} {value}
# You can concatenate multiple filters with the same operator for a specific column using && or ||
if {columnName} {operator} {value} && {value}
# To add an alternative condition, you can use `or` above an `if`
or {columnName} {operator} {value} || {value}
}
Types
Bob supports a variety of data types, including strings, numbers, booleans, and more.
INTEGERS
- int
- int8
- int16
- int32
- int64
- uint
- uint8
- uint16
- uint32
- uint64
FLOATS
- float32
- float64
STRINGS
- string
- string8
- string16
- string32
- string64
- text
- blob
DATES
- date
- time
- current
SPECIAL
- id
- boolean
ATTRIBUTES
- primary
- required
- index
- auto_increment
- unique
- optional
- isolated
- = (default value)
LITERALS
- @now
- @date
- @time
- @utc
- @sysdate