EmofyEmofy Developers
Getting Started

Repository Tour

Every app and shared package in the Emofy monorepo, and what each one is for.

Emofy is a single Turborepo monorepo managed with pnpm workspaces. There are two top-level folders that matter: apps/ (things you deploy) and packages/ (shared code the apps depend on).

emofyplatform/
├── apps/            deployable applications (web, mobile, backend, docs)
├── packages/        shared libraries (auth, db, design system, SDKs, env)
├── docs/            written documentation, ADRs, runbooks, AI agent context
├── infra/           OpenTofu (IaC) for Railway + Vercel + Infisical sync
└── scripts/         repo automation (codegen, state, guards)

Apps

Each app is independently deployable. Ports below are the local dev ports.

AppPortStackWhat it is
backend3006NestJS 11The single API surface. All business logic, the database, queues, search, webhooks. Deployed to Railway.
account3002Next.js 16 + Better AuthThe identity provider: sign-in, sign-up, 2FA, password reset, magic link, org switching, and credential management.
consumer3007Next.js 16The main org-scoped web app — feed, messaging, tasks, the EMA launcher. Routed as /w/{orgId}/*.
admin3003Next.js 16The super-admin console (Emofy staff): org and user management, feature flags, moderation.
nativeExpo 54 / React NativeThe mobile app, mirroring consumer. Currently demo-stage, not production.
docs3004Next.js / FumadocsThis developer portal.
marketing3008Next.js 16Public marketing site (emofy.com.tr).
landing3000Next.js 16Legacy marketing site (emofy.net).
template3005Next.js 16Shared scaffold/template for apps and EMAs.

Every user authenticates through the account app, which issues a JWT. The other web apps consume that JWT and call the backend for data. See Authentication.

Shared packages

Packages are consumed via the @emofy/* workspace alias.

Foundation

PackagePurpose
@emofy/authBetter Auth (v1.6.x) server + client config: sessions, RS256 JWT, 2FA, magic link, and the organization plugin that models multi-tenancy.
@emofy/dbDrizzle ORM schemas. Two databases: emofyplatform_auth (identity, sessions, orgs) and emofyplatform_core (business data). Home of the OrgScopedRepository pattern.
@emofy/typesThe SSOT for RBAC: the 9 roles, the resource/action permission matrix, and branded ID types.
@emofy/envFolder-based, Zod-validated environment SSOT — one schema per deploy target (server, backend, consumer, native, docs…).
@emofy/configShared Next.js / TypeScript presets, including EMA iframe CSP headers.

Design system

PackagePurpose
@emofy/tokensThe token SSOT: raw + semantic color, spacing, radius, typography, motion.
@emofy/rdsRamarkable Design System primitives (~137 side-effect-free components).
@emofy/ramarkableHigher-level UI built on RDS: the EMA shell, permission-gated components, page templates.
@emofy/iconsShared SVG icon set.
@emofy/storybookComponent documentation (Chromatic CI).

Ecosystem & integration

PackagePurpose
@emofy/sdkThe in-app EMA SDK: a Penpal-based iframe bridge giving EMAs scoped RPC access to the host.
@emofy/dev-sdkThe partner SDK: a typed TypeScript client for the public v1 API, with zero workspace coupling.
@emofy/cliThe emofy binary — scaffold, validate (ema:doctor), and publish EMAs.
@emofy/api-clientThe shared low-level API client the frontends use to call the backend.
@emofy/convexThe real-time backend (Convex): schema, hooks, provider for messaging/presence/live updates.
@emofy/emailReact Email + Resend templates (i18n: EN/TR).
@emofy/e2eThe Playwright suite (also the source of the committed OpenAPI snapshot).

Where the docs live in the repo

Beyond this portal, the repo carries its own written knowledge base:

  • docs/ai-context/AGENT_BOOTSTRAP.md — the canonical entry point.
  • docs/ai-context/ — architecture, best practices, workflow, and runbooks.
  • docs/ numbered files (e.g. 001_SYSTEM_ARCHITECTURE_DEFINITION.md, 004_MODULES.md) — the long-form system definition and module map.
  • Architecture Decision Records — summarized in the ADR index.

Next

On this page