Introduction
Ayaven is an accessible, sovereign Quranic companion built with Next.js 16, React 19, and Flutter. It brings together a serene 9:16 verse feed, FSRS spaced-repetition Hifz memorization, real-time Tajweed coaching, 3D sign-language avatars, and Nūr AI — grounded in authentic Sunni scholarship and strict privacy.
What is included
- Authentication — email/password, magic links, email OTP, social sign-in, two-factor auth with backup codes, and session management, built on better-auth.
- Multi-tenancy — organizations with members, teams, invitations,
custom per-organization roles, and an organization-scoped workspace
under the
[org]route segment. - Authorization — three distinct permission systems: app-level roles (admin area), organization-level roles (workspaces), and scoped API keys (public API).
- Internationalization — English and Arabic (RTL) via next-intl, with fully typed message catalogs.
- Data layer — PostgreSQL through Drizzle ORM, with generated migrations and a repository/service/action layering.
- Public API — versioned REST endpoints authenticated by API keys,
documented with an OpenAPI schema and a Scalar reference UI at
/api/reference. - Infrastructure — Redis for session storage, S3-compatible object
storage for uploads, SMTP email, all runnable locally with one
docker-compose up. - Content — this documentation and the blog are MDX files compiled
by
@next/mdx, living incontent/docsandcontent/blogs.
The stack at a glance
| Layer | Choice | Where it is configured |
|---|---|---|
| Framework | Next.js 16 (App Router) | next.config.ts |
| UI | React 19, shadcn/ui, Base UI, Tailwind CSS 4 | components/, app/globals.css |
| Auth | better-auth + plugins | lib/auth.ts |
| Database | PostgreSQL + Drizzle ORM | db/, drizzle.config.ts |
| Mutations | next-safe-action | lib/safe-action.ts, features/*/actions.ts |
| Client data | SWR | features/*/queries.ts |
| URL state | nuqs | features/*/search-params.ts |
| Validation | Zod 4 | features/*/validation.ts |
| i18n | next-intl | i18n/, messages/, proxy.ts |
| nodemailer (Mailpit in dev) | lib/email.ts | |
| Storage | AWS SDK S3 (MinIO in dev) | lib/storage.ts |
| Cache | Redis via ioredis | lib/redis.ts |
How to read these docs
The pages are ordered as a path:
- Getting Started — run the project locally.
- Architecture — how the codebase is laid out and why.
- Authentication and Database — the two subsystems everything else leans on.
- Internationalization — routing, typed messages, and RTL.
- Conventions and Patterns — the rules and recipes to follow when adding your own features.
If you only read two pages, read the last two. They describe the shape every new piece of code in this repository is expected to take.