ZiWound — Overview
This is a complete, step-by-step case study of ZiWound — a real, production-grade war crimes documentation platform built entirely on Lesan. It is the largest real-world Lesan application you can study outside this repo: 13 models, 98 acts, JWT authentication with role-based access control, GeoJSON geospatial search, full-text search, 9-language internationalization, file uploads, and a Next.js frontend.
ZiWound is open source. The entire codebase lives at github.com/hemedani/ziwound, so every page in this series links to the real source file instead of reproducing it here.
Not a beginner tutorial
You should already know the basics from Getting Started and the country/city/user tutorials. This series is an advanced case study — it assumes you know newModel, setAct, insertOne, findOneAndUpdate, relations, and projections.
What the app does
ZiWound documents war crimes. Users submit reports (with geolocation, file attachments, tags, categories, and references to accused war criminals), explore documented incidents through interactive maps, read blog articles, and admins manage everything from a dashboard.
user ── submits ──> report ──┬── reporter (User)
├── documents (Document[] ── documentFiles)
├── tags (Tag[]) / category (Category)
├── hostileCountries / attackedCountries (Country[])
├── attackedProvinces / attackedCities (Province[]/City[])
└── warCriminals (WarCriminal[])
│
├── country ── province ── city (geographic hierarchy)
├── blogPost (author, coverImage, tags)
├── heroSlide (landing page slider)
└── confirmation (email/account verification)
The 13 models
| Model | Purpose | Page |
|---|---|---|
user | authentication, roles, profile | The User Model |
file | uploads (images, videos, documents) | The File Model |
country | countries with localized war history | Location Models |
province | provinces with war history | Location Models |
city | cities with war history + capital relations | Location Models |
category | categorization (shared pattern) | Catalog Models |
tag | metadata tagging (shared pattern) | Catalog Models |
report | the core war crime report | The Report Model |
document | supporting documents for reports | The Document Model |
blogPost | articles with publish workflow | Content Models |
heroSlide | landing-page slider | Content Models |
warCriminal | accused individuals/entities | The War Criminal Model |
confirmation | email/account confirmation | The Confirmation Model |
What makes ZiWound a great Lesan case study
- 13 real models with deep relation graphs — reports link to reporters, documents, tags, categories, countries, provinces, cities, and war criminals, all with Lesan's automatic reverse-relation syncing.
- 98 production acts — the full CRUD surface plus login/register/getMe, publish/unpublish, getBySlug, getRelated, statistics, CSV/PDF export, uploads, and dashboard statistics.
- Auth as a
preActchain —setTokens → setUser → grantAccess(...)on protected acts, proving how Lesan's request hooks handle real authorization. - Localization done two ways —
localizedWarInfo(nested{fa,en,ar,...}objects) vsselected_language(per-record language filter). ZiWound shows exactly when to use each. - Search & geospatial — MongoDB text indexes and
2dsphereGeoJSON queries power real search and map exploration. - Generated types —
typeGeneration: truewritesdeclarations/selectInp.ts, which the Next.js frontend consumes directly.
Chapter guide
- Project Layout — the repo structure (
back/Deno + Lesan,front/Next.js) and howmod.tswires everything together. - The Models — one page per model (or logical group): pure fields, relations, back-references, and indexes, with links to the real source.
- Lesan Patterns — the reusable lessons ZiWound teaches: the auth chain, localization, search & indexes, geospatial queries, file uploads, and act structure.
Every page links to the exact file in github.com/hemedani/ziwound — open it side by side as you read.
Run it
ZiWound is a real production app. To run it locally, clone the repo and follow its README:
git clone https://github.com/hemedani/ziwound.git
cd ziwound
# Backend (Deno + Lesan)
cd back
deno task bc-dev # starts the Lesan server (MongoDB required)
# Frontend (Next.js)
cd front
pnpm install
pnpm dev
- Playground:
http://localhost:1406/playground(development mode) - Static uploads: served under
/uploads - Generated types:
declarations/selectInp.tswritten on boot (typeGeneration: true)
Next: Project Layout.