# What Is the Default Port for the Kaneo API?

> Discover the default Kaneo API port. Kaneo API uses port 1337 when no custom URL is set. Learn more about Kaneo configuration.

- Repository: [kaneo.app/kaneo](https://github.com/usekaneo/kaneo)
- Tags: api-reference
- Published: 2026-08-30

---

**The Kaneo API defaults to port 1337 when no custom URL is configured.**

The open-source project management platform Kaneo exposes its HTTP API on a predictable local port for rapid development. Unless you specify a custom endpoint via environment variables, the server initializes on `http://localhost:1337`. Understanding this default behavior is essential for local development, Docker networking, and reverse-proxy configuration.

## How the Default Port Is Defined in the Source Code

The fallback to port 1337 is hardcoded in three critical locations across the `usekaneo/kaneo` repository.

### Server Boot Logic in index.ts

The main entry point for the API server explicitly logs the running URL using a logical OR fallback. In [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts), the application outputs:

```typescript
console.log(`⚡ API is running at ${process.env.KANEO_API_URL || "http://localhost:1337"}`);

```

This line demonstrates that if `KANEO_API_URL` is undefined, the server reports `http://localhost:1337` as its access point.

### MCP Integration Layer

The Model Context Protocol (MCP) implementation relies on the same default when constructing public API endpoints. In [`apps/api/src/mcp/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/mcp/index.ts), the codebase resolves the base URL using identical logic, ensuring consistent addressing across subsystems.

### URL Resolution Helper

Reusable utility functions centralize this logic to avoid drift. The [`packages/libs/src/api-url.ts`](https://github.com/usekaneo/kaneo/blob/main/packages/libs/src/api-url.ts) file exports helpers that resolve the API base URL, consistently falling back to `http://localhost:1337` when no override is provided.

## How to Override the Default Port

While 1337 is the default, production deployments typically require custom ports or domain names. The codebase respects the `KANEO_API_URL` environment variable, which takes precedence over the hardcoded fallback.

To start the server on a different port, set the variable before initialization:

```bash
export KANEO_API_URL="http://0.0.0.0:4000"
npm run start:api

```

Programmatically, you can verify the resolution logic using the library helper:

```typescript
import { resolveApiBaseUrl } from "@kaneo/libs";

// Without env override
const defaultBase = resolveApiBaseUrl(undefined);
// Returns: "http://localhost:1337/api"

// With custom URL
process.env.KANEO_API_URL = "https://api.production.com";
const customBase = resolveApiBaseUrl(undefined);
// Returns: "https://api.production.com/api"

```

The `.env.sample` file in the repository root documents this optional configuration, showing teams where to declare their custom endpoints without modifying source code.

## Summary

- **Port 1337 is the default**: The Kaneo API initializes on `http://localhost:1337` unless configured otherwise.
- **Environment-driven overrides**: Setting `KANEO_API_URL` supersedes the default in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) and related modules.
- **Consistent fallback logic**: The port is centralized in [`packages/libs/src/api-url.ts`](https://github.com/usekaneo/kaneo/blob/main/packages/libs/src/api-url.ts) to ensure uniform behavior across the MCP integration and core API.
- **Zero-config development**: New contributors can start the server immediately without port configuration, as the default requires no additional setup.

## Frequently Asked Questions

### Can I run Kaneo on port 80 or 443 instead of 1337?

Yes. While the default port for the Kaneo API is 1337, you can bind to any privileged or non-privileged port by setting the `KANEO_API_URL` environment variable to your desired address, such as `http://localhost:80` or `https://localhost:443`, before starting the process.

### Does changing KANEO_API_URL affect the frontend connection?

Yes. The frontend and MCP services use the same environment variable to discover the API. Updating `KANEO_API_URL` ensures all components in the monorepo point to the correct host and port, preventing cross-origin or connection errors.

### Is port 1337 configurable during Docker deployment?

Absolutely. When running the official Kaneo container, pass the environment variable in your `docker run` command or compose file: `-e KANEO_API_URL=http://0.0.0.0:3000`. This overrides the hardcoded default without rebuilding the image.

### Where is the default port documented in the source code?

The default port 1337 appears in [`apps/api/src/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/index.ts) where the server logs its startup URL, in [`apps/api/src/mcp/index.ts`](https://github.com/usekaneo/kaneo/blob/main/apps/api/src/mcp/index.ts) for public URL construction, and in [`packages/libs/src/api-url.ts`](https://github.com/usekaneo/kaneo/blob/main/packages/libs/src/api-url.ts) which contains the centralized URL resolution logic used throughout the codebase.