Introduction
Mordn is a complete agent system for software products. Configure the agent in one place, then add it to your React or Next.js product with one server handler and one component. The system provides streaming, conversation history, knowledge, memory, private attachments, actions, and operations without making your team assemble each layer separately.
@mordn/chat-widget is the integration surface. Identity and policy remain on
your server, while hosted or self-managed contracts let you choose where the
rest of the system runs.
Identity is established on your server
The browser never tells the server who it is. Implement getChatUserId(request)
from a verified session; the handler must not trust any client-supplied id. The
store and storage factories are then bound to that server-derived identity.
Minimum integration decisions
Resolve the user from a verified server session.
Provide a Vercel AI SDK model in code or through hosted configuration.
Provide a Drizzle, hosted, or custom ChatStoreFactory.
Tools and attachment storage are optional. Omitting storage disables uploads.
Request flow
Browser ChatWidget
→ createChatHandler
→ getUserId(request)
→ ChatStoreFactory(verifiedUserId)
→ optional StorageAdapterFactory(verifiedUserId)
→ model + optional tools/retrieval/memorycreateChatHandler returns GET, POST, DELETE, and OPTIONS. Export
OPTIONS when using its cross-origin CORS support.