Toolips.jl

A manic web-development framework
Popularity
48 Stars
Updated Last
1 Year Ago
Started In
January 2022

( the toolips website is going to be down for a bit, pending a new version release. sorry for the inconvenience )

deps version

| toolips app | documentation | examples | extensions |

Toolips.jl is a fast, asynchronous, low-memory, full-stack, and reactive web-development framework always written in pure Julia. Here is Toolips.jl in a nutshell:

  • Fast and secure. All routes are served through Julia, and anything that can be written must be written using a method that can only write very specific types.
  • HTTPS capable, load balancer friendly. Can easily be deployed with SSL.
  • Extensible servers, components, and methods, they are all extendable!
  • Modular applications. Toolips applications are regular Julia modules.
  • Regular Julia projects.
  • Declarative, high-level syntax.
  • Extremely low memory usage.
  • Asynchronous. Run multiple functions at the same time as you serve to each incoming request.
  • Versatile. Toolips.jl can be used for all scenarios, from full-stack web-development to APIs.
using Pkg; Pkg.add("Toolips")
julia> # Press ] to enter your Pkg REPL
julia> ]
pkg> add Toolips
projects

Here are some projects created using Toolips to both inspire and demonstrate!

Olive is a mission to create a cell-based IDE, rather tthan cell-based notebook environment, inside of Julia using only Julia. This is somewhat similar to Pluto.jl, however is also a lot more feature-rich, extensible, and built differently.

ToolipsApp was originally conceived in order to demonstrate the first version of toolips, and has continued to see development throughout the development of toolips itself.

EmsComputer is a blog and project website.

JLChat is a simple chat application that demonstrates the ToolipsSession RPC feature.

basics

Toolips is pretty easy to grasp, especially for those who have worked with similar web-frameworks in the past. If you prefer video, here is a toolips tutorial playlist. To get started, you may create a new project with Toolips.new_app or Toolips.new_webapp

  • Here are the different types you might encounter while using toolips:
  • Connections
  • ServerExtensions
  • Routes
  • ToolipsServers
  • Modifiers
  • Servables

Connections are passed through our route functions. ServerExtensions are loaded by the server on startup and extend the capabilities of the framework. Routes are where the functions that write our pages go and tell the browser what to do with our client. ToolipsServers hold routes and extensions and create a server to serve said routes. While Connections facilitate incoming clients, client callbacks are left to Modifiers. These can be used for anything from changing properties of elements to changing incoming GET requests. Finally, there is the Servable; which is essentially anything with a name field which can be written to a Connection with write!. Let's write our first route! We will do so with the route method.

using Toolips

newroute = route("/") do c::Connection

end

We will use write! to write a String to our Connection:

using Toolips

newroute = route("/") do c::Connection
    write!(c, "Hello world!")
end

Next, we need to make our server. For this we just provide our route in a Vector:

using Toolips

newroute = route("/") do c::Connection
    write!(c, "Hello world!")
end

server = WebServer(routes = [newroute])
server.start()

It really is that easy!. As a final introduction, we will briefly review Components. Components can be constructed with basically whatever String Pairs or key-word arguments we want. These are HTML properties given to our elements. That being said, Component functions are simply HTML element names.

using Toolips

newroute = route("/") do c::Connection
    mydiv = div("mydiv")
    myb = b("label", text = "hello world!")
    push!(mydiv, myb)
    write!(c, mydiv)
end

server = WebServer(routes = [newroute])
server.start()
new in 0.2.3
  • new get binding for getting children from Components (get(::Component{<:Any}, s::String))
  • new getarg bindings that parse types or have a default, (get_arg(::Connection, ::Symbol, ::Any), get_arg(::Connection, ::Symbol, ::Type))
  • Some improvements to style!
  • Updated server display
  • Modifier abstract type (brought here from ToolipsSession)