Ocelot is a free, open source api development & testing project written in C# and released under MIT. It has 8,715 GitHub stars, 1,683 forks and 57 open issues, and was last pushed 5 hours ago. On this registry it ranks #24 of 103 tracked projects in API Development & Testing, with 5 head-to-head comparisons available. It gained 1 stars over the last 3 tracked days.

What is Ocelot?

What it is

Ocelot is a .NET API gateway built as a series of ASP.NET Core middlewares arranged in a specific order. It is aimed at teams running a microservices or service-oriented architecture on .NET that need a unified point of entry into their system, though the README notes it will work with anything that speaks HTTP(S) and runs on any platform that ASP.NET Core supports. The project lives in the .NET ecosystem, is written in C#, and is distributed under the MIT license.

The concrete problem it solves is request routing and pipeline control at the edge of a distributed system. Ocelot's custom middlewares manipulate the HttpRequest object into a state specified by its configuration until the request reaches a request builder middleware, where a HttpRequestMessage is created and used to call a downstream service. That request-making middleware is the last item in the Ocelot pipeline and does not call the next middleware. The downstream response is retrieved as control passes back up the pipeline, where a further piece of middleware maps the HttpResponseMessage onto the HttpResponse object returned to the client. This gives a single configured entry point instead of clients addressing each service directly.

Key capabilities

  • Acts as an API gateway and reverse proxy for HTTP(S) traffic in front of downstream services.
  • Composes an ASP.NET Core middleware pipeline in a defined order, with custom middlewares that transform the incoming HttpRequest according to configuration.
  • Builds downstream calls through a request builder middleware that produces an HttpRequestMessage.
  • Terminates the pipeline at the request-making middleware, which does not invoke the next middleware.
  • Maps the downstream HttpResponseMessage back onto the client-facing HttpResponse.
  • Targets net9.0 STS plus net8.0 and net10.0 LTS target framework monikers.
  • Ships as the Ocelot NuGet package with documentation hosted on Read the Docs.

Who uses it and how

  • .NET teams running microservices that need one unified entry point into the system rather than exposing every service.
  • Service-oriented architectures where routing and request shaping are declared in configuration instead of hand-written per client.
  • Deployments on any platform ASP.NET Core supports, since the gateway itself is an ASP.NET Core application.
  • Non-.NET backends that speak HTTP(S), because the gateway only requires the downstream service to be reachable over HTTP or HTTPS.
  • Teams that need to inspect or extend gateway behavior by inserting their own ASP.NET Core middleware into the Ocelot pipeline.

Getting started

Install the package and its dependencies with the .NET CLI using dotnet add package Ocelot; all versions are available on NuGet. Documentation sources live in the repository as reStructuredText files, with rendered HTML at the Read the Docs site.

When to use it — and when not to

Ocelot fits projects already committed to ASP.NET Core and .NET, where the gateway can be hosted as another ASP.NET Core application and configured through its middleware pipeline. It is a library rather than a hosted service, so a self-h

project readme (upstream, from github) — read inline

Ocelot Logo

Release Status Development Status ReadTheDocs coveralls codecov License: MIT NuGet Downloads

About

Ocelot is a .NET API gateway. This project is aimed at people using .NET running a microservices (service-oriented) architecture that needs a unified point of entry into their system. However, it will work with anything that speaks HTTP(S) and runs on any platform that ASP.NET Core supports.

Ocelot consists of a series of ASP.NET Core middlewares arranged in a specific order. Ocelot custom middlewares manipulate the HttpRequest object into a state specified by its configuration until it reaches a request builder middleware, where it creates a HttpRequestMessage object, which is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. The response from the downstream service is retrieved as the request goes back up the Ocelot pipeline. There is a piece of middleware that maps the HttpResponseMessage onto the HttpResponse object, and that is returned to the client. That is basically it, with a bunch of other features!

Install

Ocelot is designed to work with ASP.NET Core and it targets net9.0 STS and net8.0, net10.0 LTS target framework monikers (TFMs). [^1] Install Ocelot package and its dependencies using the .NET CLI:

dotnet add package Ocelot

All versions are available on NuGet.

Documentation

  • RST-sources: This includes the source code for the documentation (in reStructuredText format, .rst files), which is up to date for the current development. And the rendered HTML documentation is available here.
  • Read the Docs: This official website, in HTML format, contains a wealth of information and will be helpful if you want to understand the features that Ocelot currently offers. The rendered HTML documentation, which is currently in development, is available here.
  • Ask Ocelot Guru: It is an AI focused on Ocelot, designed to answer your questions. [^2]

Features

The primary features—Configuration and Routing—are always utilized by users, even in a minimal app setup, without customizations or extra configurations. Ocelot's capabilities are categorized into three main groups of features: solid, hybrid, and feature-family groups, which are explained below.

  • Solid features are unique to Ocelot. They do not contain subfeatures and are not related to other features.
  • Hybrid features, on the other hand, have multiple relationships with other features and can be part of other features.
  • Feature families are large groups that consist of multiple subfeatures.

Feature groups are explained in the table below

Feature Relationships and Notes
Administration Administration heavily depends on Authentication, and Administration API methods are part of Authentication, Caching, and Configuration
Aggregation[^4] Aggregation relies on Routing
Authentication Authentication followed by Authorization
Configuration Configuration depends on Dependency Injection, including GET/POST operations via the [Administration REST API](https://ocelot.readthedocs.io/en/latest/features/administr

readme truncated — read the full docs on github

Frequently asked questions

Is Ocelot free to use?

Ocelot is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does Ocelot do?

.NET API Gateway

What is Ocelot written in?

Ocelot is primarily written in C#. Its source is publicly available at https://github.com/ThreeMammals/Ocelot, and it has 8,715 GitHub stars.