What Are the Main Packages Within the Kaneo Monorepo?
The Kaneo monorepo contains five core internal packages—@kaneo/libs, @kaneo/email, @kaneo/mcp, @kaneo/permissions, and @kaneo/typescript-config—that provide shared utilities, email templates, CLI tooling, permission checks, and TypeScript configuration across the workspace.
Kaneo is organized as a pnpm monorepo that groups reusable code into several first-party packages under the packages/ directory. Each package maintains its own package.json and follows the shared TypeScript configuration found in packages/typescript-config. Understanding the main packages within the Kaneo monorepo is essential for navigating the codebase and extending the platform's functionality.
Package Architecture Overview
The monorepo follows a clean separation of concerns between applications (apps/api and apps/web) and shared libraries. The internal packages are referenced via the @kaneo/* scope and enable consistent code reuse, linting, and formatting standards across the backend, frontend, and auxiliary tooling.
The Five Core Packages
@kaneo/libs — Shared Runtime Utilities
Located in packages/libs/, this package provides cross-cutting utilities used by both the API and Web client. According to the source code in packages/libs/src/index.ts, it exports the resolveApiBaseUrl function for API URL resolution and the client object—a typed Hono client wrapper—along with windowId utilities.
Key exports from packages/libs/src/index.ts:
resolveApiBaseUrlfrom./api-urlclientandwindowIdfrom./hono
Example usage of the shared Hono client:
import { client, windowId } from "@kaneo/libs";
async function loadProfile() {
const profile = await client["/api/v1/profile"].$get();
console.log("Window:", windowId, "Profile:", profile);
}
Source: packages/libs/src/hono.ts
@kaneo/email — Email Templates and SMTP
This package handles all email communication within Kaneo, including workspace invitations, password resets, and OTP notifications. It contains React-based email templates in packages/email/src/templates/ and SMTP utilities in packages/email/src/send-email.tsx.
Key files:
Example implementation:
import { sendEmail } from "@kaneo/email";
import { WorkspaceInvitation } from "@kaneo/email/templates/workspace-invitation";
await sendEmail({
to: "newuser@example.com",
subject: "You're invited to a Kaneo workspace!",
html: WorkspaceInvitation({ workspaceName: "Acme", inviterName: "Bob" }),
});
Source: packages/email/src/send-email.tsx
@kaneo/mcp — CLI and Authentication Platform
The Kaneo Command-Line Platform (packages/mcp/) provides CLI utilities for installing and interacting with Kaneo instances. It includes device-flow authentication helpers, configuration merging, and the main CLI entry point at packages/mcp/src/cli.ts.
Key functionality:
- Device flow authentication (
packages/mcp/src/auth/device-flow.ts) - CLI entry point (
packages/mcp/src/cli.ts)
Example device registration:
import { registerDevice } from "@kaneo/mcp";
await registerDevice({
clientId: "my-cli",
scopes: ["read", "write"],
});
Source: packages/mcp/src/auth/device-flow.ts
@kaneo/permissions — Access Control Utilities
Located in packages/permissions/, this package exports permission-checking helpers and test utilities that enforce access rules across the API. The main entry point at packages/permissions/src/index.ts exposes functions used by API routes to validate user permissions before executing sensitive operations.
@kaneo/typescript-config — Shared TypeScript Configuration
This package centralizes TypeScript configuration through preset files like base.json and react-library.json. Located in packages/typescript-config/, it ensures type consistency and compiler options are synchronized across all workspace packages, eliminating configuration drift between the API, Web, and library code.
Summary
- Kaneo organizes shared code into five internal packages under the
packages/directory @kaneo/libsprovides the typed Hono client and API URL resolution used across the stack viapackages/libs/src/hono.ts@kaneo/emaildelivers React-based email templates and SMTP functionality for notifications throughpackages/email/src/send-email.tsx@kaneo/mcpsupplies CLI tooling and device-flow authentication for external integrations viapackages/mcp/src/cli.ts@kaneo/permissionscentralizes access control logic for API route protection inpackages/permissions/src/index.ts@kaneo/typescript-configmaintains consistent compiler settings via shared JSON presets likereact-library.json
Frequently Asked Questions
What is the purpose of the @kaneo/libs package?
The @kaneo/libs package serves as the shared runtime utility library for both the API and Web applications. It exports critical functions like resolveApiBaseUrl from packages/libs/src/api-url.ts for environment-based URL resolution and a typed Hono client (client) from packages/libs/src/hono.ts that standardizes HTTP communication across the monorepo.
How does Kaneo handle email templating?
Kaneo uses the @kaneo/email package which contains React components for email templates stored in packages/email/src/templates/. These components render to HTML and are sent via the sendEmail function exported from packages/email/src/send-email.tsx, supporting templates for workspace invitations, password resets, and OTP verification.
What does the MCP package do in Kaneo?
The @kaneo/mcp (Kaneo Command-Line Platform) package provides CLI utilities and authentication flows for external tools interacting with Kaneo. It includes device-flow authentication helpers located in packages/mcp/src/auth/device-flow.ts and serves as the entry point for command-line operations via packages/mcp/src/cli.ts.
How are TypeScript configurations managed across the monorepo?
TypeScript configurations are centralized in the @kaneo/typescript-config package, which exports preset files like base.json and react-library.json from packages/typescript-config/. This ensures all workspace packages share identical compiler options, strictness settings, and type-checking behavior.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →