Oxygen.jl: A breath of fresh air for programming web apps in Julia (2025)

Nathan Ortega

Posted on

Oxygen.jl: A breath of fresh air for programming web apps in Julia (3) Oxygen.jl: A breath of fresh air for programming web apps in Julia (4) Oxygen.jl: A breath of fresh air for programming web apps in Julia (5) Oxygen.jl: A breath of fresh air for programming web apps in Julia (6) Oxygen.jl: A breath of fresh air for programming web apps in Julia (7)

#package #web #framework #http

I'm excited to announce Oxygen.jl, a micro-framework built on top of the HTTP.jl library that's designed to simplify building web applications in Julia.

using Oxygenusing HTTP@get "/greet" function(req::HTTP.Request) return "hello world!"end# both path parameters are automatically converted to Float64's @get "/multiply/{a}/{b}" function(req, a::Float64, b::Float64) return a * bend# all objects are automatically deserialized into JSON@get "/getdata" function() return Dict("message" => "hello!")end# mount all nested files inside the "content" folder under "/static"@staticfiles "content" "static"# start the web serverserve()

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

Why build another web framework?

That's a great question, why create another package if Julia already has full stack frameworks like Genie.jl that can do just about anything?

My quick answer: most people don't need all features that come with these heavyweight packages. About a month ago, I was one of those people looking to quickly spin up a web server to prototype some ideas.

I wanted something lightweight and straightforward, and I didn't want to spend a lot of time learning a new syntax. Ideally, I wanted something similar to Flask or FastApi but in Julia.

So, I set out to create this package and design a no-nonsense api that would hopefully feel familiar to JS and Python programmers and drive greater adoption in these communities.

Feature Requests

If you have any ideas or feature requests, please feel free to open an issue on the github page!

Top comments (13)

Subscribe

Ifihanagbara Olusheye

Ifihanagbara Olusheye

Software Engineer & Technical Writer.

  • Joined

Jun 6 '22 • Edited on Jun 6 • Edited

  • Copy link

This is nice. The first thing that came to mind was this is Flask but for Julia and I'm happy I saw it in the post. Great work 😄

I'll try it out and if I find have any questions, I will ask

Christopher Rowley

Christopher Rowley

  • Joined

Jun 6 '22

  • Copy link

Looks cool, I too have wanted "FastAPI for Julia".

Logan Kilpatrick

Logan Kilpatrick

Julia Developer Community Advocate | JuliaCon Organizer | NumFOCUS Board of Directors | Ping me if I can be of any help!

  • Email

    logan@julialang.org

  • Location

    California

  • Joined

Jun 6 '22

  • Copy link

Same here, Jeremey Howard (creator of FastAI) has said many times that having things like FastAPI is critical for Julia's long term success so I am excited to see this!

melonedo

melonedo

  • Joined

Jun 7 '22 • Edited on Jun 7 • Edited

  • Copy link

I am so exited to see that Julia finally have a web server that does not heavily rely on global states! It feels much more "Julian" than existing frameworks.

By the way, I am very interested in how you implement the @route macro, because it does not seem obvious to me how to manipulate a function by its signature. In python it is done with a special annotation system, how do you do that in Julia?

Nathan Ortega

Nathan Ortega

  • Joined

Jun 7 '22

  • Copy link

That's a great question! And one that was difficult for me to figure out as well. It involved a lot of googling and reading into the Base library documentation

Essentially, there's a low-level api just for methods that's pretty good at extracting useful information. I was able to extract the number of function arguments and their types, but was unable to get the name of each variable.

I found a snippet in the julia forums that did exactly what I needed and modified it a bit to return strings instead of symbols.

(get parameter names)
github.com/ndortega/Oxygen.jl/blob...

(get parameter types & count)
github.com/ndortega/Oxygen.jl/blob...

(low-level api)
docs.julialang.org/en/v1/base/base...

Emmanuel_R8

Emmanuel_R8

  • Joined

Jun 7 '22

  • Copy link

Great work! Looks almost as easy as the R Plumber framework. Almost, because Plumber automatically generates the Swagger description.

I have no idea about the amount of work that would be involved, but does an integration with the Genie/Stipple framework make any sense?

emmy

emmy

Hi, I like developing the Julia ecosystem to do various awesome things from Science to Data to Web Development

  • Joined

Jun 8 '22

  • Copy link

cool

abhimanyuaryan

abhimanyuaryan

Baby Genie | Julia and Python :)

  • Joined

Jun 9 '22

  • Copy link

so nice Nathan congrats on making an awesome package :)

ImreSamu

ImreSamu

interested in Postgres, PostGIS, Routing, Geo, Openstreetmap, Wikidata, ... Data ...

  • Joined

Jun 6 '22

  • Copy link

Please add a benchmark :-)

to -> github.com/TechEmpower/FrameworkBe...

Edwin Lock

Edwin Lock

  • Joined

Jun 6 '22

  • Copy link

Very nice. Do you happen to know whether there's a templating engine (like Jinja for flask) that can be used in combination with Oxygen?

Nathan Ortega

Nathan Ortega

  • Joined

Jun 6 '22

  • Copy link

There's a package called Mustache.jl which is a generic templating engine. They should be compatible, but I haven't tested this yet. Let me know if you run into any issues.

github.com/jverzani/Mustache.jl

Eric Forgy

Eric Forgy

  • Joined

Jun 7 '22

  • Copy link

Neat 👍

Your motivation was the same as mine when I wrote Pages.jl. Have you seen it?

Nathan Ortega

Nathan Ortega

  • Joined

Jun 7 '22

  • Copy link

Up until now, I have not! But that's because the prototype I was working on a month ago was supposed to be a simple REST api with no front-end. I had no plans to add websockets to communicate with the browser

For further actions, you may consider blocking this person and/or reporting abuse

Oxygen.jl: A breath of fresh air for programming web apps in Julia (2025)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Van Hayes

Last Updated:

Views: 6222

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.