Current Architecture
Status
- document type: current state
- source of truth: code in
app/,enterprise/,config/, anddb/ - use this page before reading target architecture pages
Current Product Shape
The current codebase is primarily:- an account-scoped omnichannel support platform
- a Rails monolith with a Vue 3/Vite frontend split into dashboard, widget, portal, survey, and SDK entrypoints
- a shared communication core around
Account,Inbox,ContactInbox,Conversation, andMessage - an inherited
enterprise/technical split underenterprise/; in Onelink this is an implementation layer, not a separate product/paywall boundary, because enterprise capabilities are currently opened for the project - a set of CRM-adjacent primitives such as
Contact,Company,Note,Label, andCustomAttributeDefinition - a native shared scheduling and kassa capability under
app/models/scheduling,app/services/scheduling, andapp/javascript/dashboard/routes/dashboard/scheduling - an event-driven application with listeners, jobs, hooks, reporting, automations, and AI/Captain features around the conversation core
Frontend Runtime
The implemented frontend shape today is:Vue 3 + Viteattached to the Rails monolith rather than a separate Nuxt-style app shell- multiple entrypoints such as dashboard, widget, portal, survey, and SDK
- incremental frontend modernization with both
VuexandPiniaactive in the dashboard - a newer shared UI layer in
app/javascript/dashboard/components-next/ - older shared UI layers and route-local composition still present across the dashboard
VueUsealready active as the shared frontend utility layer through@vueuse/coreand@vueuse/components- a native scheduling dashboard module using
Piniastores,dashboard/api/scheduling/*, andcomponents-next/Scheduling/* - Tailwind preferred for new work, while SCSS and scoped styles remain in older surfaces
HistoireandVitestalready available for component development and verification
Repository Control Surfaces
Beyond runtime code, the working project currently includes:- the main application repository under
onelink - the docs repository mounted as the
docs/git submodule - the versioned project skill source under
onelink/.codex/skills - the local Codex skill library under
$CODEX_HOME/skills
Core Runtime Graph
This is the main operational path in the repo today.Implemented Bounded Contexts
Account And Access
Core records:AccountUserAccountUserInboxMemberTeamTeamMemberCustomRoleimplemented in the inheritedenterprise/tree
Accountis the tenant boundaryUseris globalAccountUseris the per-account identity- inbox membership and policies drive most day-to-day visibility
- custom roles from the inherited
enterprise/tree narrow conversation visibility further in active Onelink code paths
Communication Core
Core records:InboxChannel::*ContactContactInboxConversationMessageAttachment
- all inbound channels normalize into the same conversation model
Conversationis the main operational aggregateMessagecreation fans out to replies, notifications, reporting, automations, and hooks
Automation And Eventing
Core records and services:AutomationRuleMacroWebhookIntegrations::Hook- dispatcher/listener pipeline
- models emit domain events
- sync listeners handle realtime and immediate side effects
- async listeners and jobs handle automation, reporting, CSAT, and external hooks
Help Center And Public Surfaces
Core records:PortalCategoryFolderArticle
- public knowledge base is a real implemented subsystem
- dashboard and public portal share this content model
AI / Captain
Core records:Captain::AssistantCaptain::DocumentCaptain::CustomToolCaptain::ScenarioCopilotThreadCopilotMessage
- Captain is a real implemented subsystem
- it provides assistant, copilot, document, tool, and scenario flows
- it extends the support platform rather than replacing core entities
CRM-Adjacent Layer
Implemented today:ContactCompanyNoteLabelCustomAttributeDefinition
- this is not yet a full shared CRM engine
Deal,Task,Pipeline,Stage, and normalizedActivityare not implemented as first-class runtime entities
Scheduling And Kassa
Implemented today:Scheduling::ResourceScheduling::ServiceScheduling::AppointmentScheduling::WorkRuleScheduling::BreakRuleScheduling::HolidayScheduling::WorkdayOverrideScheduling::TimeOffScheduling::PaymentScheduling::Expense- native dashboard module under
app/javascript/dashboard/routes/dashboard/scheduling/
- scheduling is implemented as a shared platform capability, not a healthcare-only subsystem
- backend is account-scoped and reuses
Account,Contact,Company,Conversation, andUser - dashboard surfaces already exist for calendar, resources, services, exceptions, and kassa
- finance behavior is native to the module and exposed through scheduling endpoints rather than an iframe app
Primary Runtime Flows
Inbound Message Flow
Access Resolution Flow
Event Fan-Out Flow
Native Entities To Reuse First
When adding features, check these before introducing new models:AccountContactCompanyInboxConversationMessageNoteLabelCustomAttributeDefinitionTeamMacroAutomationRuleIntegrations::AppIntegrations::HookCaptain::*Scheduling::ResourceScheduling::ServiceScheduling::Appointment
Not Implemented Yet
These appear in planning docs but should not be treated as existing runtime layers unless code is added:- dedicated
generic,healthcare, andconstructionruntime zones - shared CRM entities such as
Deal,Task,Pipeline,Stage, and normalizedActivity - a fully separated domain architecture beyond the current shared code plus inherited
enterprise/technical split
How To Use This Page
- use this page for current architecture questions
- use
frontend-implementationfor frontend stack, component sourcing, and implementation rules - use
backend-agent-playbookfor backend execution workflow - use
implementation-examples-mapfor concrete code references - use
implementation-roadmapfor delivery sequencing - use
overview,crm-architecture, anddomains/overviewfor target direction - if docs and code disagree, trust the code