Introduction to Hexclave
Relevant source files
The following files were used as context for generating this wiki page:
Hexclave is a comprehensive user infrastructure platform designed to handle all aspects of user management, including authentication, team collaboration, payments, emails, and analytics. It is built as a unified solution to replace the need for integrating multiple separate vendors, providing a seamless experience for modern frameworks like Next.js and React.
Sources: README.md:1-12, apps/backend/src/lib/ai/prompts.ts:7-13, skills/hexclave/SKILL.md:2-10
The platform operates on a "catalog of apps" model, allowing developers to enable specific features as their products grow. All data remains portable, supporting both cloud-hosted and self-hosted deployments.
Sources: README.md:22-25, packages/shared/src/ai/unified-prompts/reminders.ts:16-16
Core Architecture and Components
Hexclave is structured as a monorepo managed by Turbo, consisting of a backend service, an admin dashboard, and several specialized SDKs for different environments.
Sources: AGENTS.md:28-30
System Components Overview
The following diagram illustrates the high-level relationship between Hexclave's core applications and the underlying data layer.
The Hexclave architecture separates concerns between front-end SDKs, a centralized Next.js API backend, and specialized data stores for transactional and analytical data.
Sources: AGENTS.md:32-48
The Hexclave App Object
The most critical object in the Hexclave ecosystem is the Hexclave App object. It exists in two primary forms:
- HexclaveClientApp: Provides client-side functionality (e.g., in a browser or mobile app).
- HexclaveServerApp: Provides sensitive server-side APIs requiring a secret server key.
Sources: docs-mintlify/snippets/home-prompt-island.jsx:25-27, packages/shared/src/ai/unified-prompts/reminders.ts:25-27
Feature Catalog (Apps)
Hexclave provides a modular set of "apps" that can be enabled via configuration.
Sources: README.md:22-24, docs-mintlify/snippets/home-prompt-island.jsx:23-24
| App Name | Purpose | Key Functionality |
|---|---|---|
| Authentication | User Identity | Passkeys, OAuth (Google, GitHub, etc.), Magic Links, and CLI auth. |
| Teams | Multi-tenancy | Workspaces, email invites, and role-based access within teams. |
| RBAC | Authorization | Nested roles and permission checks that work on both client and server. |
| Payments | Monetization | Subscriptions, one-time charges, and credit-based usage metering. |
| Analytics | User Insights | Event tracking, session replays, and SQL-driven dashboards. |
| Emails | Communication | Transactional and marketing emails with AI-driven template editing. |
| API Keys | Programmatic Access | Secure user and team API key management with auto-revocation. |
| Data Vault | Encryption | Secure, encrypted key-value store for sensitive user data. |
| Webhooks | Real-time Events | Tamper-proof notifications for external system synchronization. |
| Sources: README.md:31-118, docs-mintlify/snippets/home-prompt-island.jsx:23-24, apps/backend/src/lib/ai/prompts.ts:7-13 |
Technical Implementation and Integration
Unified Authentication Headers
Hexclave utilizes specific headers for API requests instead of standard Bearer tokens. This ensures proper routing and security context for client vs. server interactions.
Sources: apps/backend/src/lib/ai/prompts.ts:223-238
Environment and Configuration
Local development is driven by the Hexclave CLI, which automatically injects necessary environment variables (e.g., HEXCLAVE_PROJECT_ID, HEXCLAVE_SECRET_SERVER_KEY) into the application process.
Sources: docs-mintlify/snippets/home-prompt-island.jsx:28-29, AGENTS.md:104-106
Configurations are typically defined in a hexclave.config.ts file, which allows for declarative setup of authentication methods, team settings, and RBAC permissions.
Sources: docs-mintlify/snippets/home-prompt-island.jsx:87-95, packages/shared/src/ai/unified-prompts/reminders.ts:39-41
Data Models and Analytics
Hexclave leverages ClickHouse for its analytics engine. Key tables include events for user activity and users for profile metadata. JSON data within these tables requires explicit extraction using toString() and JSONExtractString functions.
Sources: apps/backend/src/lib/ai/prompts.ts:80-97, apps/backend/src/lib/ai/prompts.ts:553-562
Summary
Hexclave provides a robust, all-in-one infrastructure for modern applications, consolidating identity, billing, and communication into a single platform. By utilizing framework-specific SDKs and a powerful CLI, it simplifies the transition from local development to production-ready user management.
Sources: README.md:5-9, skills/hexclave/SKILL.md:2-10