Giter VIP home page Giter VIP logo

bloodmoon's Introduction

bloodmoon

This repo is a test using the redbean application server with the "fullmoon" framework for lua-based web applications. Learn more about redbean, the cosmopolitan libc-based redbean application server. This seems to offer good performance according to these benchmarks:

It is a simple test trying out the "fullmoon" lua web framework with a dynamic database with three tables/entities - products, reviews and prices. The solution is packaged as a container and the application provides some routes / API endpoints for those entities (a "backend") and a very very simplistic "frontend" part capable of providing a product listing and some product details (json).

Oneliner

Run this command (which downloads a 25.4 MB container image and starts it) and then open "http://localhost:8080"

    podman run --rm -p "8080:8080" ghcr.io/mskyttner/bloodmoon

You can also download the smaller (3.2 MB of which 2.3 MB is taken by the embedded sqlite3 database) binary and run it, if you dare:

    wget https://github.com/mskyttner/bloodmoon/raw/main/redbean.com && chmod +x ./redbean.com && ./redbean.com

Synthetic data

This step is not required because synth.db is already provided in the repo.

Synthetic data for products, reviews and prices (10 000 of each) was generated using:

    make db

This uses an R script which synthesizes data based on some .json files provided in the repo. The result is the synth.dbsqlite3 database.

Usage

The Makefile makes use of podman and httpie (see httpie) and wrk2 (containerized, but see GitHub repo here).

When doing make build, this database is embedded and used from within the redbean web server which also includes an application utilizing the fullmoon.lua web framework, with the (simplistic!) application code in .init.lua.

Use the Makefile to build, start and benchmark etc.

    # build a container, 24.6 MB including everything (redbean, fullmoon, application, database)
    make build

    # start it locally, exposing it on port 8080
    make up

    # check it out in the browser
    make browse

    # issue some requests against the "backend" / API endpoints
    make request-apis

    # issue some requests against the "frontend"
    make request-webshop

    # run a benchmark
    make bench

    # clean up
    make clean

Bare-metal build

A build_metal_ape.sh script is provided for those who might want to build a portable application locally for this project.

bloodmoon's People

Contributors

mskyttner avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.