an5 ORM

A modern, type-safe ORM for Swift with Sqlite

Build data-driven applications with an intuitive API, type-safe queries, and powerful features like vector search and AI agent integration across TypeScript, Python, .NET, Golang, Rust, Java, Kotlin, and Swift.

Why an5 ORM?

Install the published package with npm install @an5/orm, then use the CLI tools for schema generation and database commands.

🎯

Type-Safe

Full typing with autocompletion and compile-time checking for all queries across 5 client languages.

📝

Intuitive API

Syntax that's easy to learn and powerful enough for complex nested relations and joins.

🔗

6 Providers

Native adapters for PostgreSQL, SQL Server, MySQL, SQLite, Google Sheets, and NBase vector database.

🔍

Vector Search

Built-in semantic vector search with pgvector, SQL Server 2025, and NBase integration.

🤖

AI Agent & MCP

7 intelligent tools for natural language database queries and VS Code MCP server.

🔄

Multi-Language

One unified .an5 schema generates native clients for TypeScript, Python, C#, Go, and Rust.

Quick Example

model User {
  id        NVARCHAR(1000) @id @default(uuid())
  email     NVARCHAR(255)  @unique
  name      NVARCHAR(255)?
  createdAt DATETIME2      @default(now())
  orders    Order[]

  @@map("users")
}

model Order {
  id     NVARCHAR(1000) @id @default(uuid())
  total  INT            @default(0)
  user   User           @relation(fields: [userId], references: [id])
  userId NVARCHAR(1000)

  @@map("orders")
}
const users = await db.user.findMany({
  where: { email: { contains: '@example.com' } },
  include: {
    orders: {
      select: { total: true },
      orderBy: { total: 'desc' }
    }
  },
  take: 10
});
users = db.user.find_many(
    where={"email": {"contains": "@example.com"}},
    include={"orders": {"order_by": {"total": "desc"}}},
    take=10
)
var users = await db.Users.FindManyAsync(new UserFindManyArgs
{
    Where = new UserWhereInput { Email = new StringFilter { Contains = "@example.com" } },
    Take = 10
});
users, err := db.User.FindMany(ctx, &an5client.UserFindManyArgs{
    Where: &an5client.UserWhereInput{
        Email: &an5client.StringFilter{Contains: "@example.com"},
    },
    Take: 10,
})
let users = db.user().find_many(UserFindManyArgs {
    where_clause: Some(UserWhereInput {
        email: Some(StringFilter { contains: Some("@example.com".into()), ..Default::default() }),
        ..Default::default()
    }),
    take: Some(10),
    ..Default::default()
}).await?;
[
  {
    "id": "uuid-1",
    "email": "john@example.com",
    "name": "John",
    "createdAt": "2026-01-15T10:30:00Z",
    "orders": [
      { "total": 500 },
      { "total": 150 }
    ]
  }
]

Ready to get started?

Get up and running with an5 ORM in under 5 minutes.

Start Building →