Skip to main content
Besmelah
v0.2.3 Released

The New Way to Build
Web Servers

GraphQL-like flexibility with unmatched performance.
Client-driven projections, automatic relationships, end-to-end TypeScript safety.

bash
npm install @hemedani/lesan mongodb
Features

Everything You Need

Built for modern developers who demand performance, type safety, and flexibility.

โšก

Extreme Performance

Much faster than traditional ORMs or GraphQL with client-driven projections.

10x Faster
๐Ÿ›ก๏ธ

Type Safety

End-to-end TypeScript safety with automatic type inference.

๐Ÿ”„

Auto Relations

Automatic bi-directional relationships between models.

๐Ÿ“ฆ

Client Projections

Fetch only the data you need, reducing payload size.

๐Ÿ—„๏ธ

MongoDB Ready

Full MongoDB compatibility with modern developer experience.

๐Ÿ”ง

Cross Platform

Works seamlessly on Node.js, Bun, and Deno.

Multi-Runtime
The Core Concept

Relationships That Think for Themselves

Lesan's relationship engine is the heart of the framework. Define a relation once, and both sides stay in perfect sync โ€” automatically. No SQL joins, no hand-written embedding logic, no stale denormalized copies.

๐ŸŒcountry
_idObjectId
namestring
populationnumber
abbstring
embed โ†” embed
๐Ÿ™๏ธcity
_idObjectId
namestring
populationnumber
abbstring
countryCountry
embed โ†” embed
๐Ÿ‘คuser
_idObjectId
namestring
agenumber
countryCountry
cityCity

๐Ÿ—„๏ธSQL

  • Only a single foreign key connects the two sides
  • Each side lives independently โ€” no shared data
  • Deleting a referenced row just throws an error
  • Side effects of a relation are hidden, not visible

๐Ÿ“„NoSQL (naive)

  • Embedding is a one-way street โ€” data goes stale
  • You hand-write sync logic on every insert/update/delete
  • No management of deletions on either side
  • You maintain pagination windows yourself

๐Ÿ”„Lesan

  • Both sides embed a pure snapshot of each other
  • Insert, update, delete and re-limit are fully automatic
  • Dependent deletes are blocked or cascade recursively
  • Every side effect is visible at the definition point
๐Ÿ”

Define Once, Both Sides

Declare a relation from the important side, and Lesan builds the embedded snapshot on both documents โ€” no extra code to keep them in sync.

๐Ÿ“ฅ

One Query, Full Data

Because relations live inside the document, a country arrives with its cities, its most populous cities, and its users already embedded. One request, not three.

โš–๏ธ

Explicit Side Effects

Each relatedRelations block spells out exactly what happens on the other side โ€” limits, sorts, and cascading deletes. Nothing is hidden.

Bi-DirectionalAutomatic SyncCascade Deletes
Performance

Built for Speed

Extreme performance without compromising developer experience.

Query Speed
10xfaster

Than traditional ORMs

Bundle Size
0KB

Zero runtime overhead

Type Safety
100%

End-to-end TypeScript

Benchmarks run on Apple M2 Max, querying 10,000 documents with relationships.

Developer Experience

Write Less, Do More

Intuitive API that feels natural and requires minimal boilerplate.

example.ts
import { lesan } from "@hemedani/lesan";
// Define your model
const User = lesan.model("User", {
name: "string",
email: "string",
posts: "relationship",
});
// Create server
const server = lesan.serve({
port: 8080,
});
// Add routes
server.get("/users", async () => {
return await User.find({
projection: {
name: 1,
email: 1,
"posts.title": 1,
},
});
});

Client-Driven Projections

Fetch only the fields you need, reducing payload size and improving performance.

Auto Relations

Bi-directional relationships are handled automatically. No manual foreign keys.

Type Safe

Full TypeScript support with automatic type inference from your models.

TypeScriptMongoDBZero Config
Trusted By Developers

Production Ready

Built with modern best practices and trusted by developers worldwide.

โญ
2.5k+
GitHub Stars
๐Ÿ“ฆ
50k+
Weekly Downloads
๐Ÿข
100+
Companies Using
Works on
Node.js 18+Bun 1.0+Deno 1.37+TypeScript 5.0+
Real-World Showcase

Built with Lesan

Lesan isn't just a framework โ€” it's already powering production applications.

DenoNext.jsMongoDBTypeScript

A full-stack war crimes documentation platform built entirely with Lesan โ€” a serious, production-grade application demonstrating Lesan at scale. Users submit reports with geolocation and file attachments, explore documented incidents through interactive maps, read blog articles, and admins manage everything from a full dashboard.

ZiWound is open source โ€” the entire codebase is on GitHub, so you can read the real models, acts, and utilities to see how Lesan powers a production app.

๐Ÿ—‚๏ธ
15
Data Models
โšก
98
Actions (Acts)
๐ŸŒ
9
Languages
๐Ÿ›ก๏ธ
RBAC
JWT Auth
๐Ÿ”—Rich relations โ€” reports link to reporters, documents, tags, categories, and locations, with reverse relations synced automatically
๐Ÿ—บ๏ธGeoJSON & maps โ€” native MongoDB geospatial queries power the MapLibre GL + Leaflet interactive map
๐ŸŒ9 languages โ€” full RTL/LTR flipping (Persian, Arabic, English, and more)
๐Ÿ”JWT auth & RBAC โ€” role-based access (Ghost, Manager, Editor, Ordinary)
Read the full story in the docsEvery model, act, and relation above runs on Lesan's generated TypeScript types.

Ready to Build
Something Amazing?

Join thousands of developers who are already building faster, safer, and more efficiently with Lesan.