DATABASE

PostgreSQL & persistence

RAIQL 0.4 turns DATABASE POSTGRESQL from architecture intent into an executable persistence target for WEB + NEXTJS applications.

Select PostgreSQL

USE STACK
  FRONTEND NEXTJS,
  BACKEND NEXTJS,
  DATABASE POSTGRESQL;

The compiler emits a database-aware Next.js project instead of the process-local memory store.

Generated Prisma schema

Each CREATE ENTITY becomes a Prisma model. PRIMARY, UNIQUE, required fields and supported scalar types are translated into database constraints and Prisma types.

prisma/schema.prisma
model Product {
  id    String  @id @default(uuid()) @db.Uuid
  sku   String  @unique
  name  String
  price Decimal
}

Generated relationships

RELATE Order.customerId TO Customer.id;

RAIQL validates that both fields exist and use compatible database types. The PostgreSQL generator then emits explicit Prisma relation fields backed by the declared foreign-key scalar.

Local database

The generated project contains compose.yaml with PostgreSQL 17 and an .env.example connection string.

terminal
cp .env.example .env
npm run db:start
npm run db:migrate
npm run dev

Migration workflow

npm run db:migrate creates and applies a development migration from the generated Prisma schema. Generated projects also expose db:deploy for applying committed migrations in deployment environments and db:studio for inspecting data.

Persistent CRUD

Entities declared with CREATE CRUD receive generated create, read, update and delete HTTP handlers and a generated workspace UI. Unlike DATABASE MEMORY, records survive application restarts because operations are backed by PostgreSQL.

Continue exploring RAIQLOpen the playground →