Write SQL queries as composable, typed functions. Generate production-ready database modules for your language.
// Define a relation — auto-generates JOINs relation author for posts returning users { users.id == posts.author_id } query findPostsByAuthor($authorName: string) { from(posts) .where(posts.author.name == $authorName) .select(posts.title, posts.author.email) }
NextSQL bridges the gap between raw SQL and type-safe application code, giving you expressiveness without sacrificing safety.
Catch SQL errors before runtime. Schema-aware validation ensures your queries match your database at build time.
Generate idiomatic, production-ready modules for your target language. Currently supports Rust with more languages planned.
VSCode extension with LSP support provides real-time error detection, context-aware autocompletion, and syntax highlighting.
Declare relationships once, then navigate them with dot notation. NextSQL resolves JOINs automatically from your definitions.
Install the CLI, initialize your project, write a query, and generate code.
Create a next-sql.toml config and directory
structure.
Create a .nsql file with type-safe query
definitions.
query findUserById($id: uuid) { from(users) .where(users.id == $id) .select(users.*) }
Run the generator and get type-safe Rust modules ready for use.
Install the VSCode extension for syntax highlighting, real-time error detection, and context-aware autocompletion.
.nsql files.