# Where Is the Main Entry Point for the Kaneo Application? A Complete Guide to the Monorepo Structure

> Discover the main entry points for the Kaneo application within its monorepo structure. Find the API server at apps/api/src/index.ts and the web client at apps/web/src/main.tsx.

- Repository: [kaneo.app/kaneo](https://github.com/usekaneo/kaneo)
- Tags: how-to-guide
- Published: 2026-08-10

---

**The Kaneo application has two distinct main entry points: the API server bootstraps in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) using the Hono framework, while the React web client initializes in [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx) with Vite and TanStack Router.**

Finding the main entry point for the Kaneo application requires understanding that `usekaneo/kaneo` is a monorepo containing separate runtimes for the backend and frontend. Unlike single-package applications with one [`index.js`](https://github.com/usekaneo/kaneo/blob/main/index.js), Kaneo maintains isolated bootstrapping logic for its API server and web client, each with dedicated dependency injection and configuration steps.

## API Server Entry Point: [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts)

The backend runtime initiates in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts), which serves as the central bootstrap file for the Hono-based HTTP server. This file performs several critical initialization steps before the application accepts traffic.

First, it creates the Hono application instance and configures global middleware including CORS, WebSocket support, and authentication handlers. Then it registers all feature-specific routers covering tasks, projects, workspaces, and integrations. Finally, it invokes the `serve` function to begin listening on the configured port.

```typescript
// apps/api/src/index.ts (excerpt)
import { serve } from "@hono/node-server";
import { Hono } from "hono";

export function createApp() {
  const app = new Hono<AppVariables>();
  // …middleware & route registration…
  return app;
}

// At the bottom of the file
if (import.meta.main) {
  const app = createApp();
  serve(app, { port: Number(process.env.PORT) ?? 1337 });
}

```

The `createApp` function exported from this file allows for testable instantiation without starting the server, while the `import.meta.main` guard ensures the server only starts when the file is executed directly rather than imported as a module.

## Web Client Entry Point: [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx)

The frontend runtime bootstraps in [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx), which is the standard Vite entry point for React applications. This file mounts the React component tree onto the DOM and initializes the client-side routing infrastructure.

The entry point creates a root React instance using `createRoot` from `react-dom/client`, then renders the `RouterProvider` from TanStack Router. This setup enables file-based routing and type-safe navigation throughout the application.

```tsx
// apps/web/src/main.tsx (excerpt)
import { createRoot } from "react-dom/client";
import { RouterProvider } from "@tanstack/react-router";
import { router } from "./tanstack/router";

const root = createRoot(document.getElementById("root")!);
root.render(
  <React.StrictMode>
    <RouterProvider router={router} />
  </React.StrictMode>
);

```

This file also imports global UI providers and initializes the client-side state management before the router takes over rendering duties.

## How the Monorepo Orchestrates Both Entry Points

Kaneo uses TurboRepo to coordinate the two main entry points during development and build processes. The root [`package.json`](https://github.com/usekaneo/kaneo/blob/main/package.json) defines scripts that execute both runtimes concurrently, ensuring the API and web client start in the correct order.

When you run `pnpm dev` from the repository root, TurboRepo executes the development servers for both `apps/api` and `apps/web` in parallel. This orchestration ensures that changes to either entry point trigger hot reloads while maintaining the dependency graph between the client and server.

The build process similarly triggers both entry points through `turbo build`, generating optimized bundles for the API server and static assets for the web client from their respective bootstrap files.

## Supporting Files That Initialize Before the Entry Points

Several critical modules initialize before the main entry points execute, preparing the infrastructure required by the application.

### Database Configuration ([`apps/api/src/database/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/database/index.ts))

Before the API server in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) can register routes, the database layer must establish connections. The [`apps/api/src/database/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/database/index.ts) file configures Drizzle ORM, runs pending migrations, and exports the database connection instance used by repository functions throughout the API.

### Router Configuration ([`apps/web/src/tanstack/router.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/tanstack/router.tsx))

The web entry point depends on [`apps/web/src/tanstack/router.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/tanstack/router.tsx) to define all client-side routes before mounting. This file configures the TanStack Router instance with route tree definitions, enabling type-safe navigation and code-splitting for the React application.

## Summary

- **The Kaneo monorepo maintains two separate entry points**: [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) for the Hono API server and [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx) for the React web client.
- **The API entry point** creates a Hono application, registers middleware for CORS and authentication, wires up feature routers, and calls `serve` to start listening on port 1337 by default.
- **The web entry point** mounts the React tree using `createRoot`, initializes TanStack Router via `RouterProvider`, and attaches to the DOM element with ID `root`.
- **TurboRepo orchestrates both entry points** through root-level [`package.json`](https://github.com/usekaneo/kaneo/blob/main/package.json) scripts, enabling concurrent development and coordinated builds.
- **Supporting initialization** occurs in [`apps/api/src/database/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/database/index.ts) for database setup and [`apps/web/src/tanstack/router.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/tanstack/router.tsx) for route definitions.

## Frequently Asked Questions

### Does Kaneo use a single entry point for the entire application?

No, Kaneo does not use a single entry point. Because it is a monorepo architecture with distinct backend and frontend applications, it maintains separate bootstrap files: [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) initializes the server-side Hono application, while [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx) initializes the client-side React application. Each runtime has its own dependency tree and build process.

### What framework does the Kaneo API use to handle HTTP requests?

The Kaneo API uses **Hono**, a lightweight, fast web framework for the Node.js runtime. The entry point in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) imports `Hono` from the `hono` package and `@hono/node-server` for the serve functionality. This framework handles routing, middleware composition, and request/response lifecycle management for the REST API and WebSocket connections.

### How does the web client handle routing in Kaneo?

The web client uses **TanStack Router** for type-safe, file-based routing. In [`apps/web/src/main.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/main.tsx), the application imports a pre-configured `router` instance from `./tanstack/router` and renders it via `RouterProvider`. This router configuration, defined in [`apps/web/src/tanstack/router.tsx`](https://github.com/usekaneo/kaneo/blob/main/apps/web/src/tanstack/router.tsx), manages client-side navigation and code-splitting without requiring a page refresh.

### What command starts both the API and web client during development?

Running `pnpm dev` from the repository root starts both entry points concurrently. This command leverages TurboRepo's pipeline configuration to execute the development scripts for both `apps/api` and `apps/web` simultaneously, ensuring that the API server starts on its configured port while the Vite development server serves the web client with hot module replacement enabled.