Writing Modern Web Applications In Nim

Qtless
1 min readJul 22, 2023

--

HappyX cover

Nim programming language has some famous web frameworks. There are Jester, Karax, Prologue. These frameworks support only backend/frontend development. I’ll tell about HappyX web framework.

HappyX is macro-oriented full-stack web framework. It’s mean that:

  • Most code executes at compile-time due to metaprogramming (macro-oriented), so HappyX applications is very fast.
  • Developer may write both backend and frontend parts effectively with the same code.
  • Most code that developer uses is the macros which represents like DSL (Domain-specific language), so developers spend less time to development.
  • Business will be expand and develop faster due to developers development speed.

Hello, World!

Here is hello world examples for server-side and client-side

Server-Side

import happyx  # Import HappyX web framework

# Declare server at http://127.0.0.1:5000
serve "127.0.0.1", 5000:
# Match at http://127.0.0.1:5000/
get "/":
# Respond plain/text
return "Hello, world!"

Client-Side

import happyx

# Declare application at element with id "app"
appRoutes "app":
# Match at example.com/#/
"/":
tDiv(class = "..."): # <div class="...">
"Hello, world!" # Hello, world!

Additional Links

--

--