Heart πŸ’œA high performance Lua web server with a simple, powerful API

Heart πŸ’œ

A high performance Lua web server with a simple, powerful API. See the full documentation here.

Overview

Heart combines Go's fasthttp with LuaJIT to create an insanely fast Lua web server.

It also comes with a performant key-value store API backed by BadgerDB that can store data both in memory and on disk.

Features

  • High throughput
  • Low latency
  • Fast K/V store
  • Versioned API
  • Stable Lua 5.1 VM
  • Structured logs

Getting Started

  • Create a Lua file that uses the Heart API
-- main.lua
app = require('heart.v1')

app.get('/:name', function(ctx)
  return 'Hello, ' .. ctx.pathParam('name') .. '!'
end)
  • Run Heart with Docker and point it at your Lua docker run -v $(pwd):/root/app -p 3333:3333 hyperspacelogistics/heart:latest app/main.lua
  • curl localhost:3333/world to see the result
  • Congratulations you're running a wicked fast Lua server 🎊

Benchmark

Benchmark

Each stack was tasked with rendering {"hello": "world"} through their JSON stack in production mode, if applicable, with logging disabled. wrk was used with the command wrk -t32 -c512 -d30s http://localhost:3333. All benchmarks were performed on a CPU-optimized DigitalOcean droplet that had 32vCPUs and 64 GB of RAM.

Caveats

Global state, like with any parallel web server, is highly discouraged. For performance reasons Heart keeps a pool of Lua state to reuse in subsequent requests. State is reused in a random order and therefore global state that is modified in requests is functionally random in Heart. Be cautious! Static global state, like the app variable, is the exception and can generally be treated as safe.

Owner
Hyperspace Logistics
Software for the internet of the future
Hyperspace Logistics
Similar Resources

Fast, multi-platform web server with automatic HTTPS

Fast, multi-platform web server with automatic HTTPS

a project Every site on HTTPS Caddy is an extensible server platform that uses TLS by default. Releases Β· Documentation Β· Get Help Menu Features Insta

Jan 1, 2023

Lightweight go web server that provides a searchable directory index.

autoindex Lightweight go web server that provides a searchable directory index. Optimized for handling large numbers of files (100k+) and remote file

Jan 5, 2023

Static Content Web Server

Static Content Web Server The main purpose of the project is to develop static server that can be used with modern javascript frameworks (React, vue.j

Dec 17, 2021

Web server for running Brainfuck on the backend

Brainfuck Web Server Web server for running Brainfuck on the backend Run go run . brainfuck file The server will start on port 8080 by default. You

Oct 25, 2021

HTTP Echo is a go web server that echos back the arguments given to it.

HTTP Echo is a go web server that echos back the arguments given to it. This is especially useful for demos or a more extensive "hello world" application in Docker or Kubernetes.

Jan 3, 2023

Golang-redis-webserver - Web server using redis

Web Server using Redis Api REST Database SQLITE3 Cache Redis # Creating record s

Jun 19, 2022

OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021

A Language Server Protocol (LSP) server for Jsonnet

Jsonnet Language Server A Language Server Protocol (LSP) server for Jsonnet. Features Jump to definition self-support.mp4 dollar-support.mp4 Error/War

Dec 14, 2022

Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Opinionated boilerplate Golang HTTP server with CORS, OPA, Prometheus, rate-limiter for API and static website.

Teal.Finance/Server Opinionated boilerplate HTTP server with CORS, OPA, Prometheus, rate-limiter… for API and static website. Origin This library was

Nov 3, 2022
Comments
  • will there be some examples?

    will there be some examples?

    Hi. Thank you for this cool solution. How to structure a site? How to handle forms? How to manage the database? Should separate pages be kept in Lua files or in the database?

  • Problem loading driver with luajit

    Problem loading driver with luajit

    Hi, I am trying to load luasql.sqlite3 driver, it loads well with standard lua 5.4.4 but fails with luajit 2.1.0-beta3 with this error:

    undefined symbol: lua_newuserdatauv

    I have found the api changed from lua_newuserdata to this new function version with 3 parameters and standard lua seems up to-date but lua jit seems to be not. What should I change? Heart is using Luajit, what version else would I need to install for Heart to load LuaSQL correctly? I am using de dynamic version of Heart since LuaSQL is as C module.

  • πŸ’– and https

    πŸ’– and https

    Lovely project, thank you! I'm new to the lua world, I was looking for some simple and fast lua API's and discovered heart ;)

    Any plan to allow configure https? That would be awesome!

High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

[RR2-BETA] RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports runnin

Jan 4, 2023
RoadRunner: an open-source high-performance PHP application server, load balancer, and process manager
RoadRunner: an open-source high-performance PHP application server, load balancer, and process manager

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Jan 13, 2022
Go web server - A web server that can accept a GET request and serve a response.

go_web_server A web server that can accept a GET request and serve a response. Go is a great language for creating simple yet efficient web servers an

Jan 3, 2022
High Performance, Kubernetes Native Object Storage
High Performance, Kubernetes Native Object Storage

MinIO Quickstart Guide MinIO is a High Performance Object Storage released under Apache License v2.0. It is API compatible with Amazon S3 cloud storag

Jan 6, 2023
A simple http-web server logging incoming requests to stdout with simple http-interface.
A simple http-web server logging incoming requests to stdout with simple http-interface.

http-cli-echo-logger A simple http-web server logging incoming requests to stdout with simple http-interface. Run locally go run ./cmd/main.go Default

Jul 18, 2022
Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow.

Oogway Oogway is a simple web server with dynamic content generation and extendability in mind supporting a Git based workflow. It's somewhere in betw

Nov 9, 2022
a simple http server as replacement of python -m http.server

ser a simple http server as replacement of python -m http.server

Dec 5, 2022
Simple Golang Product API Server

Simple Golang Product API Server Layanan API untuk menambah, merubah informasi, mengambil data dan menghapus produk. Implementasi kode terinspirasi ol

Nov 20, 2022
A simple server with REST API to keep track of your TODOs (with html interface).
A simple server with REST API to keep track of your TODOs (with html interface).

TODOserver A simple server written in GO using gin and gorm. Getting started Download the repository docker build -t todoserver . docker run -p 8888:8

Nov 10, 2021