---
title: "Controller"
source: "https://github.com/remix-run/remix/blob/8905f3943706e1f53696ab83e70a84873cabfc90/packages/fetch-router/src/lib/controller.ts#L117"
---

# Controller

## Summary

A controller maps route leaves in a route map to actions.

Controllers let you store related actions together while preserving the params
and request-context contract for each action. Most app code should use
[`createController`](/router/function/createController/); use this type directly when you need to describe a
controller for an explicit RequestContext type.

## Signature

```ts
type Controller<routes, context, middleware> = {
  actions: ControllerActions<routes, MiddlewareContext<middleware, context>>
  middleware?: readonly [...middleware]
}

```