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 in content/docs and content/blogs.

The stack at a glance

LayerChoiceWhere it is configured
FrameworkNext.js 16 (App Router)next.config.ts
UIReact 19, shadcn/ui, Base UI, Tailwind CSS 4components/, app/globals.css
Authbetter-auth + pluginslib/auth.ts
DatabasePostgreSQL + Drizzle ORMdb/, drizzle.config.ts
Mutationsnext-safe-actionlib/safe-action.ts, features/*/actions.ts
Client dataSWRfeatures/*/queries.ts
URL statenuqsfeatures/*/search-params.ts
ValidationZod 4features/*/validation.ts
i18nnext-intli18n/, messages/, proxy.ts
Emailnodemailer (Mailpit in dev)lib/email.ts
StorageAWS SDK S3 (MinIO in dev)lib/storage.ts
CacheRedis via ioredislib/redis.ts

How to read these docs

The pages are ordered as a path:

  1. Getting Started — run the project locally.
  2. Architecture — how the codebase is laid out and why.
  3. Authentication and Database — the two subsystems everything else leans on.
  4. Internationalization — routing, typed messages, and RTL.
  5. 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.