A core goal of the OpenFaith platform is to accelerate the development of rich, data-driven church management applications. To achieve this, OpenFaith will provide a Frontend SDK designed to dynamically generate common UI structures and ship a set of pre-built, customizable React components for interacting with OpenFaith data. These components will be based on the popular and accessible shadcn/ui library, ensuring a modern, clean aesthetic out-of-the-box.
The SDK leverages the OpenFaith Canonical Data Model (CDM) schemas, defined using Effect.Schema, to automate UI generation and power these components.
For any data entity (Persons, Groups, Events, etc.), developers face significant repetitive work:
- Displaying Data: Defining table columns, data cell renderers, card layouts, and list views.
- Data Entry & Editing: Creating form fields, input types, validation logic, and submission handlers.
- Consistent Look & Feel: Ensuring UI elements are styled consistently and adhere to accessibility best practices.
This not only slows development but can lead to fragmented user experiences.
The OpenFaith Frontend SDK addresses these challenges by:
- Dynamically Generating UI Definitions: Using the metadata within CDM
effect/Schemadefinitions to create configurations for popular libraries like TanStack Table and TanStack Forms. - Providing Pre-built React Components: Offering a library of default UI components (built with
shadcn/uiand Tailwind CSS) for common display and input scenarios. These components are designed to be easily customizable and themeable. - Powering AI Interactions: These same UI components can be leveraged by the AI Chat interface to render data, present forms for clarification, or display results of actions, creating a seamless experience between conversational AI and structured UI elements.
How it Works (Conceptual):
-
Schema as the Source of Truth: Your OpenFaith CDM schemas (e.g.,
PersonSchema) provide field names, data types, validation rules, user-friendly labels (viaannotations), and relationship information. Custom fields (defined via theFieldentity) are also translated into schema representations. -
SDK Helper Functions & Component Library:
- Dynamic Definitions: Functions like
createTableDefsFromSchema(entitySchema)andcreateFormDefsFromSchema(entitySchema)generate configurations for TanStack Table/Forms. - Component Set: The SDK provides components like:
<OpenFaithFormField schemaField={...} form={...} />: Renders an appropriateshadcn/uiinput (Input, Textarea, Select, Checkbox, DatePicker, etc.) based on thefieldTypefrom the schema, including labels and validation messages.<OpenFaithTableHeader schemaField={...} />: Renders sortable column headers.<OpenFaithTableCell schemaField={...} data={...} />: Renders data cells with appropriate formatting.<OpenFaithEntityCard schema={...} data={...} />: A default card view for an entity.<OpenFaithKanbanCard schema={...} data={...} />: A default card for Kanban board views.<OpenFaithTable schema={...} data={...} />and<OpenFaithForm schema={...} onSubmit={...} />: Higher-level components that compose the above.
- Dynamic Definitions: Functions like
-
Usage Example (Illustrative):
import { PersonSchema } from "@openfaith/schemas"; import { OpenFaithTable, OpenFaithForm, } from "@openfaith/sdk-frontend-react"; // Hypothetical SDK import // Displaying a table of people function PeopleList({ peopleData }) { return <OpenFaithTable schema={PersonSchema} data={peopleData} />; } // Displaying a form to create/edit a person function PersonEditor({ initialData, onSubmit }) { return ( <OpenFaithForm schema={PersonSchema} initialValues={initialData} onSubmit={onSubmit} /> ); }
The
<OpenFaithTable>and<OpenFaithForm>components would internally use the SDK helpers to generate TanStack Table/Form configurations and then render the appropriateshadcn/ui-based field and cell components. -
Integration with AI Chat:
- When the AI Chat needs to display a list of records (e.g., "Show me members of the 'Welcome Team'"), it can invoke a component like
<OpenFaithTable schema={GroupMembersSchema} data={results} />or<OpenFaithEntityCard />for each member to render the information within the chat interface. - If the AI needs more information to complete an action (e.g., "Create a new event." AI: "Okay, what's the event name and date?"), it can present an
<OpenFaithForm schema={PartialEventSchemaForAI} />focused on the missing fields. - This ensures consistency between the standard UI and AI-driven interactions.
- When the AI Chat needs to display a list of records (e.g., "Show me members of the 'Welcome Team'"), it can invoke a component like
- Accelerated Development: Drastically reduces boilerplate for common UI patterns.
- Professional UI Out-of-the-Box:
shadcn/uiprovides a modern, accessible, and highly customizable look and feel. - Consistency: Ensures data display, input fields, and validation are consistent with the CDM definitions across all parts of an application, including AI interactions.
- Customizable Defaults: While providing sensible defaults, developers can easily override or extend the provided components to fit specific application needs, leveraging
shadcn/ui's composition model. - Single Source of Truth: UI elements (labels, input types, validation) are derived from
effect/Schema, minimizing discrepancies. - Enhanced AI Experience: The AI can use the same trusted UI components to display data or request input, making the conversational interface more robust and visually integrated.
- Community & Ecosystem: Building on popular libraries like TanStack and
shadcn/uifosters a larger community and makes it easier for developers to contribute or adopt.
- Initial Focus:
- Core set of
shadcn/ui-based components for form fields (input, select, date, checkbox, textarea), table cells, and basic card views. - Robust generation of TanStack Table and TanStack Forms configurations from
effect/Schema.
- Core set of
- Future Possibilities:
- More complex view components (e.g., calendar views, detailed entity views, relationship browsers).
- Advanced Kanban board components.
- Theming capabilities to easily adapt the look and feel.
- SDKs for other frontend frameworks, potentially sharing the core schema-to-definition logic.
The OpenFaith Frontend SDK, with its dynamic UI definition capabilities and pre-built shadcn/ui React components, aims to revolutionize how developers build UIs for church management applications. By providing a powerful combination of schema-driven automation and high-quality default components, the SDK will free up developers to focus on unique application logic and user experience. This integration of schema, UI components, and AI interaction is key to OpenFaith's strategy for creating a highly productive, flexible, and intelligent development ecosystem.