User opens Nous on mobile
Technical architecture
A mobile-first AI stack for realtime personal context.
Nous is built around one technical bet: the product needs realtime chat, durable memory, streaming AI, and permissioned partner context in one typed system.
Expo screen renders chat and reflection flows
TanStack Query reads typed Fern client methods
Cloudflare backend handles product and partner APIs
AI SDK streams assistant responses from agent endpoints
Mastra turns context into memory, tools, and workflows
Permission rules decide what can reach partners
01 / Stack
Six layers, each with a clear job.
The stack avoids a single monolith. Mobile owns the experience, Fern and tRPC own typed integration paths, Cloudflare owns backend and deploy surfaces, AI SDK owns streaming UX, and Mastra owns agent reasoning.
Client
Expo React Native mobile app
The core product is a polished mobile chat experience built with Expo Router, React Native, TypeScript, native haptics, media, notifications, secure storage patterns, and mobile-first interaction design. TanStack Query owns server state on top of typed client calls.
Backend API
Cloudflare Workers, Hono, and contract APIs
The backend should stay close to the edge: request routing, chat services, partner APIs, and product workflows run behind typed service boundaries. Fern keeps the API contract and generated clients in sync so mobile code does not hand-roll transport logic.
AI runtime
AI SDK plus Mastra toolchains
AI interactions use AI SDK patterns for streaming chat UX, while Mastra owns agents, memory, typed tools, workflow steps, observability, and evaluation outside the UI.
Identity
Clerk-compatible authentication boundary
Auth stays at the platform boundary. Mobile, web, and backend services share user-scoped authorization rules so private context is never treated as anonymous app data.
Web and docs
Next.js pitch, dashboard, and Mintlify docs
The investor-facing pitch is a static Next.js export on Cloudflare Pages. The broader web app and docs use the same typed TypeScript discipline.
Media and edge
Cloudflare for deploy, streaming, and edge services
Cloudflare is the deployment target for public pages and the planned edge surface for Workers, Containers, Stream, R2, Hyperdrive, and partner-facing services.
02 / Mastra toolchains
Mastra is the orchestration layer for agents, tools, workflows, memory, and evals.
The product should not hide intelligence inside screens or one-off API handlers. Mastra gives the team a place to compose agent behavior, trace decisions, test workflows, and evolve the assistant safely.
Input
Mobile context
Messages, preferences, consent, state, and product signals arrive through typed app boundaries.
Mastra
Agents + workflows
Agents decide, tools execute, workflows structure multi-step moments, and memory keeps continuity.
Output
Useful action
Nous streams a response, updates state, drafts a recommendation, or calls a partner API with permission.
Agents
Agents own the companion behavior: instructions, model routing, user context, tone, and decisions about when to answer, ask, remember, or call a tool.
Typed tools
Tools are explicit capabilities, not hidden prompt tricks. They can retrieve memory, call partner APIs, summarize a thread, rank options, or prepare a consented action.
Workflows
Structured flows handle multi-step product moments such as reflection, relationship check-ins, travel planning, or turning a chat insight into a permissioned recommendation.
Memory
Memory is treated as product infrastructure. The agent layer decides what is short-term, what is durable, what should be forgotten, and what requires explicit consent.
Streaming endpoints
AI SDK gives the mobile app a clean streaming UX while Mastra endpoints expose agent events, tool calls, and structured output without pushing that logic into screens.
Evals and observability
The system needs traces, prompt versions, regression datasets, and human review loops so the assistant gets safer and more useful as the product learns.
03 / API integration
Fern, tRPC, and TanStack Query keep backend data boring and typed.
The mobile app should consume product APIs through generated clients and predictable query hooks. That makes caching, retries, optimistic updates, and partner integrations easier to reason about.
Fern contract layer
OpenAPI and Fern define the shape of backend resources, then generate TypeScript clients for mobile and web consumers. API changes start at the contract instead of scattered fetch calls.
TanStack Query state layer
TanStack Query wraps generated client methods with caching, retries, mutation state, invalidation, optimistic UI, and offline-friendly mobile behavior.
tRPC service layer
tRPC remains useful for internal typed procedures where the app and backend move together, while Fern is the stronger boundary for generated SDKs and partner-facing APIs.
04 / Engineering principles
The stack is designed to protect product quality as Nous gets more intelligent.
The technical choices matter because personal context is sensitive. The system needs clear boundaries before it grows into partner experiences.
01
Mobile-first, not web-first
The product surface is the phone: short sessions, fast chat, native feel, notifications, haptics, and low-friction reflection.
02
Realtime by default
Chat, memory, presence, and relationship workflows need streaming and event-aware primitives rather than request/response screens bolted together later.
03
AI outside UI components
UI renders state. Hooks coordinate flows. Services and agent runtimes own business logic, memory, tools, and model calls.
04
Permissioned context boundary
Nous can become a partner ecosystem only if private understanding stays protected and translated through explicit user consent.
05
Typed contracts everywhere
Zod validation, strict TypeScript, tRPC procedures, Fern-generated clients, and OpenAPI contracts keep the app stable as the stack grows.
06
Static pitch, dynamic product
Investor and docs surfaces can deploy as static pages, while mobile, Cloudflare services, and agents handle the living product experience.
05 / Technical roadmap
The architecture grows from chat wedge to personal context platform.
The current surface can stay narrow while the backend evolves toward richer memory, stricter permission rules, and partner-facing context APIs.
Now
Mobile chat wedge
- Expo app
- Cloudflare backend APIs
- Mastra agent endpoints
- Fern-generated clients
Next
Personal context layer
- Long-term memory
- TanStack Query hooks
- Permission rules
- Model evaluation loops
Later
Partner ecosystem
- Curated partner APIs
- Travel and relationship surfaces
- Cloudflare edge services
- Outcome feedback loops
Technical thesis
Nous is not another chatbot. It is a typed, permissioned context system with a Mastra-powered toolchain and chat as the first interface.
The moat is not a prompt. It is durable personal context, typed API contracts, realtime product state, careful consent boundaries, and the ability to turn understanding into useful actions without leaking private history.