DEV Community

Cover image for Meet RayQL - A Schema and Query Language for Your SQLite Side Projects
Harsh Singh
Harsh Singh

Posted on

Meet RayQL - A Schema and Query Language for Your SQLite Side Projects

Let's be real, as developers, we've all spent way too much time setting up backends, writing validation schemas, and reinventing the wheel for common tasks when working on side projects. It's a massive time sink that takes away from the actual fun of building something new.

That's why I created RayQL, a schema definition and query language for SQLite, built with Rust. The core goal is to provide a compact and familiar syntax that eliminates the need to reinvent the wheel for data validation, allowing you to quickly prototype and build backends without juggling multiple components. With RayQL, everything you need lives in a single executable, which makes it super-easy to get started on your side projects.

RayQL gives superpowers to SQLite by providing built-in validation functions (more on that in future releases) and everything you need for building SQLite-based backends. It's designed specifically for side projects, where you want to focus on your core idea rather than getting bogged down by redundant tasks.

One of the main pain points when working with databases is defining models and setting up relationships. RayQL makes this process a walk in the park:

# Enum for user types
enum user_type {
  admin
  developer
  normal
}

# Model for 'user'
model user {
  id: int primary_key auto_increment,
  username: str unique,
  email: str unique,
  phone_number: str?,
  user_type: user_type default(user_type.normal)
}
Enter fullscreen mode Exit fullscreen mode

No more dealing with string literals for enums or forgetting to set default values. It just works.

Let's say you want to create a post model with a foreign key relationship to the user model. With RayQL, it's as simple as:

model post {
  id: int primary_key auto_increment,
  title: str default('New Post'),
  content: str,
  author_id: int foreign_key(user.id),
  created_at: timestamp default(now()),
}
Enter fullscreen mode Exit fullscreen mode

Yup, that's it. No more jumping through hoops to set up foreign keys or default values.

You can try out RayQL right now using the online editor – RayQL Studio, or install it locally using this simple command:

curl -s https://raw.githubusercontent.com/harshdoesdev/rayql/main/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

RayQL is an open-source project, so feel free to contribute, report issues, or propose new features on the GitHub repository.

The team has some exciting plans for the future, including automatic TypeScript type generation (coming in the 0.2 release) and support for writing database queries using the RayQL syntax.

So, if you're tired of spending more time on the backend than the actual project, give RayQL a try. It might just be the superpower you need to focus on what really matters – bringing your ideas to life.

Top comments (0)