Happyx

Latest version: v4.7.4

Safety actively analyzes 723177 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 12 of 13

0.5.1

SPA, States And More Other 🎉

In this release we added powerful state management and components!

Components
Project structure:

project/
-- components/
-- -- hello_world.nim
-- main.nim

`project/components/hello_world.nim`
nim
import happyx

component MyComponent:
counter: int

`template`:
{self.counter}
button:
"Increase"
click:
self.counter += 1

`script`:
echo self.counter

`style`:
"""
button {
background: 212121;
color: dfdfdf;
padding: 12px {self.counter + 1}px;
}
"""

`project/main.nim`
nim
import happyx

var app = registerApp()
app.routes:
"/":
component MyComponent(counter = 5)
app.start()

0.5.0

Changelog

- Support routing in SPA like SSG (12).
- Support event handling in `buildHtml` macro (14).
- Tags in `buildHtml` can be starts with `t`, `h` or `tag` (18).

0.4.8

Changelog
- Support `staticDir` in `SSG` routing (8).
nim
server.routes:
staticDir "myDirectory"

- Support regex patterns `SSG` routing (9).
nim
server.routes:
"/regex/pattern{patternId:/[a-zA-Z0-9_]/}"
echo patternId

- Support `SPA` with `JS` backend.
nim
var app = newApp()
app.routes:
"/":
echo path
buildHtml(`div`):
"Hello, world!"
"/hello!":
buildHtml(`div`):
"No, bye!"
app.start()

- New syntax sugar (10).
- Some fixes and improves (11)

0.4.6

Changelog
- Support `middleware` (3) and request methods (3) in server 🌟
nim
server.routes:
get "/":
req.answer "Root via GET"
post "/":
req.answer "Root via POST"
middleware:
echo req

- Support `JSON` and `HTML` answers (2) 📤
nim
var
server = newServer()
userId = 0
server.routes:
get "/html":
req.answerHtml:
buildHtml(`div`):
script(src="https://cdn.tailwindcss.com") # Tailwind CSS :D
`div`(class="bg-gray-700 text-pink-400 px-8 py-24"):
"Hello, world!"

post "/user":
inc userId
req.answerJson {"response": {"id": %userId}}

- Some improves and fixes 🐛

0.4.5

Changelog
- Support variables in strings in `if` and `for` statements
- Support attributes and children `if` and `for` statements
- Support variables in curly brackets:
nim
var state = remember true
var html = buildHtml(`div`):
{state}

- `if` and `for` statements does not generates root tags.

0.4.4

Changelog
- Support `for` statement in `buildHtml` macro.
- Refactor `renderer.nim`, `tag.nim`

Page 12 of 13

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.