> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shipthing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> How the "API" application works in ShipThing.

<Tip>The `api` application runs on port 3002. We recommend deploying it to `api.{yourdomain}.com`.</Tip>

ShipThing exports the API from the `apps/api` directory. It is designed to be run separately from the main app, and is used to run isolate functions that are not part of the main user-facing application e.g. webhooks, cron jobs, etc.

## Overview

The API is designed to run serverless functions, and is not intended to be used as a traditional Node.js server. However, it is designed to be as flexible as possible, and you can switch to running a [traditional server](/deployment/standalone-api) if you need to.

Functionally speaking, splitting the API from the main app doesn't matter if you're running these projects on Vercel. Serverless functions are all independent pieces of infrastructure and can scale independently. However, having it run independently provides a dedicated endpoint for non-web applications e.g. mobile apps, smart home devices, etc.

## Hono

ShipThing is designed to be a scalable and production-ready fullstack starter kit. One of the core features is a dedicated and extendable API layer. To enable this in a type-safe manner, we chose [Hono](https://hono.dev/) as the API server and their RPC client

### Why Hono

Hono is a modern and minimalistic web framework for TypeScript and JavaScript. It is designed to be simple, fast and easy to use. It is also designed to be very flexible and easy to extend. You can deploy it almost anywhere and use it in a type-safe manner with the Hono RPC client. It is also capable of generating an OpenAPI documenation automatically for you API.

<Tip>
  Don't worry, if you don't plan to use Hono for the time being, you can continue to use [Next.js API Routing](https://nextjs.org/docs/pages/building-your-application/routing/api-routes) to handle API requests. You can skip the later chapters, and Hono is just an optional alternative, it is not a must.
</Tip>

## Features

* **Cron jobs**: The API is used to run [cron jobs](/packages/cron). These are defined in the `apps/api/app/cron` directory. Each cron job is a `.ts` file that exports a route handler.
* **Webhooks**: The API is used to run [inbound webhooks](/packages/webhooks). These are defined in the `apps/api/app/webhooks` directory. Each webhook is a `.ts` file that exports a route handler.

## Development

To start the app, run the following command in the root directory:

```sh Terminal theme={"system"}
pnpm --filter api dev
```
