All Projects → KwangIO → kwang

KwangIO / kwang

Licence: BSD-3-Clause license
High Performance Kotlin Native Web Framework based on Lwan

Programming Languages

kotlin
9241 projects
shell
77523 projects

Projects that are alternatives of or similar to kwang

Zato
ESB, SOA, REST, APIs and Cloud Integrations in Python
Stars: ✭ 889 (+1406.78%)
Mutual labels:  backend, high-performance
Vert.x
Vert.x is a tool-kit for building reactive applications on the JVM
Stars: ✭ 12,544 (+21161.02%)
Mutual labels:  high-performance, event-loop
Uvloop
Ultra fast asyncio event loop.
Stars: ✭ 8,246 (+13876.27%)
Mutual labels:  high-performance, event-loop
MultiplatformPlayground
Kotlin Multiplatform project in Jetpack Compose & SwiftUI with shared ViewModel layer and File upload
Stars: ✭ 72 (+22.03%)
Mutual labels:  backend, kotlin-native
fotongo
Simple boilerplate for building Backend services like ExpressJS with GOFIBER ⚡️
Stars: ✭ 29 (-50.85%)
Mutual labels:  backend
libs.kmp.icerock.dev
Kotlin Multiplatform libraries list with info auto-fetch
Stars: ✭ 178 (+201.69%)
Mutual labels:  kotlin-native
deno-pokemon
a simple api to create and explore pokemons - made with oak deno framework
Stars: ✭ 20 (-66.1%)
Mutual labels:  backend
content defender
Define allowed or denied content element types in your backend layouts
Stars: ✭ 63 (+6.78%)
Mutual labels:  backend
ex syslogger
ExSyslogger is an Elixir Logger custom backend to syslog.
Stars: ✭ 13 (-77.97%)
Mutual labels:  backend
darpc
DaRPC: Data Center Remote Procedure Call
Stars: ✭ 49 (-16.95%)
Mutual labels:  high-performance
vaahcms
VaahCMS is a laravel based open-source web application development platform shipped with a headless content management system (CMS).
Stars: ✭ 56 (-5.08%)
Mutual labels:  backend
island-time
A Kotlin Multiplatform library for working with dates and times
Stars: ✭ 69 (+16.95%)
Mutual labels:  kotlin-native
pinterest-backend
Pinterest Clone Backend in Phoenix Framework
Stars: ✭ 19 (-67.8%)
Mutual labels:  backend
parse-react
[EXPERIMENTAL] React, React Native, and React with SSR (e.g. Next.js) packages to interact with Parse Server backend
Stars: ✭ 58 (-1.69%)
Mutual labels:  backend
testnet.backend
Backend for a ViaBTC exchange server (trading engine)
Stars: ✭ 18 (-69.49%)
Mutual labels:  backend
devtools-library
Multiplatform, pluggable, extensible, and dynamic config library which supports YAML and JSON as a source.
Stars: ✭ 15 (-74.58%)
Mutual labels:  kotlin-native
lubeck
High level linear algebra library for Dlang
Stars: ✭ 57 (-3.39%)
Mutual labels:  high-performance
moko-network
Network components with codegeneration of rest api for mobile (android & ios) Kotlin Multiplatform development
Stars: ✭ 107 (+81.36%)
Mutual labels:  kotlin-native
smartsla-backend
Backend module for SmartSLA
Stars: ✭ 22 (-62.71%)
Mutual labels:  backend
ktcc
C Compiler that generates readable Kotlin and C# - Written in Kotlin + Small web-based Editor with autocompletion
Stars: ✭ 54 (-8.47%)
Mutual labels:  kotlin-native

Kwang

Kwang is a thin Kotlin/Native wrapper around high-performance, low-overhead web server(s). It is in experimental state, supporting Lwan partially. It may have libh2o backend in the future.

Build Status Build status CodeBeat badge CodeFactor Total alerts

Building

Cloning the repo with submodule(s)

git clone --recurse-submodules https://github.com/KwangIO/kwang
cd kwang

You can import it with IntelliJ IDEA

Building Lwan

cmake, zlib, and libbsd should be installed before building.

  • Arch Linux: pacman -S cmake zlib libbsd
  • Ubuntu: apt-get update && apt-get install git cmake zlib1g-dev pkg-config libbsd-dev
  • I have not tried to build it on other operating systems
./buildLwan.sh

If you want more customization, see lwan#Building.

Sample

Open SampleLinux.kt

class SampleHandler : KwangHandler("/") {
    override fun handleGet(request: RequestContext, response: ResponseContext): StatusCode {
        println("Auth: ${request.authorization}")
        println("Origin:" + request.getHeader("Origin"))
        response withHeaders listOf(
            Header("meaning-of-life", "42"),
            Header("looking-for", "job")
        ) plain ("123")
        return StatusCode(200u)
    }
}

class OtherSample : KwangHandler("/hello") {
    override fun handleGet(request: RequestContext, response: ResponseContext): StatusCode {
        response json ("""{"hello":"${request.getQuery("name")}"}""")
        return StatusCode(200u)
    }
}

fun main(args: Array<String>) {
    ServerLwan(listOf(SampleHandler(), OtherSample()), LwanConfig("localhost:8081"))
}

Running the sample

gradle runProgram (no colorful output) or gradle build (test will fail at the moment, just ignore it and run build/bin/linux/main/release/executable/kwang.kexe)

The server will start on localhost:8081

Building klib

The library is very EXPERIMENTAL and likely to change significantly, using it in production code is NOT RECOMMENDED. But yes, you can build the klib (check gradle linuxKlibrary)

Supported operating system

Linux64

Roadmap

  • Server configuration (port, ..)
  • CORS support (partially)
  • Logging
  • H2O backend (because Lwan does not support HTTP/2)
  • Finish the wrapper
  • Optimize performance
  • EventBus
  • WebSocket
  • Path params / Full-featured router

Benchmark

TODO In case you want benchmarking Kwang, you should consider compile lwan in release mode and pass -opt to konanc With autocannon -c 100 -d 40 -p 10 localhost:8080, Kwang reached around 80k reqs/sec on a MSI GE72VR laptop

Contributing

Feel free to submit issues and enhancement requests. This is a low priority side-project to me, so there is no ETA/promise, but PRs are welcomed.

Why? JVM framework like Vert.X/Ktor/Spring + GraalVM makes more sense

Agree.

Can you change the name, it looks weird

I am not in the mood of choosing bike shed's name. Moreover, it is not that weird you racist people! Kwang in Korean

Known issue

For current Kotlin/Native version (1.3.0), it will not compile due to linker issue (please clone Kotlin/Native from github or wait for the next release)

(Kudos to Kotlin/Native team)

Use latest Kotlin/Native compiler
git clone https://github.com/JetBrains/kotlin-native --depth 1 -b master
cd kotlin-native
./gradlew dependencies:update
./gradlew bundle
cp -R dist/* ~/.konan/kotlin-native-linux-[ver]

or you can set konan.home project property

Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].