FastAPI alternative in Julia

I recently came across https://fastapi.tiangolo.com which looks really cool. I was wondering if there is a similar project in Julia with similar ambitions? I’m aware of Genie and Mux et. al. which are quite nice and do their jobs well. However, they seem more general and would require quite a bit of code to reproduce the FastAPI project. If there is nothing I will try to build something myself, and if so is Genie the way to go or should I start from the HTTP package? Any advice is welcomed. :blush:

8 Likes

As far as I remember, Genie is more focused on rich features rather than speed. If high performance is what attracts you in FastAPI, I’d suggest starting a new project based on HTTP.jl (maybe even patches to it will be needed).

Personally I’m quite interesting in high speed HTTP framework in Julia since existing solutions in other languages are either slow (e.g. Python’s Flask, FastAPI itself is fast, but comes with slow host language which limits applicability), have terrible API (akka-http in Scala, one of the worst things that have ever happened to me) or turn to be quite verbose for any non-trivial project (e.g. Vert.x in Java).

So if you are going to start a new project focused on high performance and nice API, please call me to the party!

4 Likes

Hi, i am a FastAPI user and quite interested in its Julia implementation. Any news about its development? Since FastAPI consist of many big libraries like pydantic and starlette, i wonder if we need to create everything from the ground up

2 Likes

JSON3.jl and HTTP.jl can do some of the work, Genie is more like Rails or Django. I haven’t heard of anything like fastapi or starlette in Julia, but it would be great to have.

1 Like

Genie actually uses HTTP.jl and builds on top of it.

What would probably bring speed is FastCGI in Genie, to get an ASGI framework like Starlette over an WSGI Framework like Flask.

Hello from the future!

I recently released a package just for that purpose, it’s called Oxygen.jl. It’s a micro-framework built on top of the HTTP.jl library. The API itself was designed to closely resemble FastApi.

Features

  • Straightforward routing (@get, @post, @put, @patch, @delete and @route macros)
  • Out-of-the-box JSON serialization & deserialization
  • Optional type definition support for Path parameters
  • Helper functions to parse & transform the body of requests & responses
  • Hosting static files
  • Built-in multithreading support

In the future, it may not always depend on HTTP.jl. I have some ambitious ideas which may include replacing HTTP.jl with a rewrite of starlette in julia. But for the time being, I’m focusing more on practical and developer-focused features to add to the framework

17 Likes

That looks really cool :sunglasses:. I’ll check it out.

1 Like

Awesome! Maybe you would get Adrian to also implement that as an alternative server in Genie. Great effort!