https://github.com/HapticX/happyx
Macro-oriented asynchronous web-framework written in Nim with β₯
https://github.com/HapticX/happyx
backend frontend full-stack hacktoberfest happyx http-server javascript nim open-source python server spa ssg ssr typescript web web-framework
Last synced: 11 days ago
JSON representation
Macro-oriented asynchronous web-framework written in Nim with β₯
- Host: GitHub
- URL: https://github.com/HapticX/happyx
- Owner: HapticX
- License: mit
- Created: 2023-03-27T04:47:32.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-30T00:36:21.000Z (6 months ago)
- Last Synced: 2024-10-30T02:50:39.682Z (6 months ago)
- Topics: backend, frontend, full-stack, hacktoberfest, happyx, http-server, javascript, nim, open-source, python, server, spa, ssg, ssr, typescript, web, web-framework
- Language: Nim
- Homepage: https://hapticx.github.io/happyx/
- Size: 53.2 MB
- Stars: 536
- Watchers: 13
- Forks: 18
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-nim - happyx - A macro-oriented full stack asynchronous web framework written in Nim. (Web / Frameworks)
- awesome-java - HappyX
README
### Macro-oriented asynchronous full-stack web-framework written in Nim with β₯


[](https://wakatime.com/badge/user/eaf11f95-5e2a-4b60-ae6a-38cd01ed317b/project/bbd13748-36e6-4383-ac40-9c4e72c060d1)
[](https://github.com/HapticX/happyx/actions/workflows/tests.yml)[](https://hapticx.github.io/happyx/#/guide/)
[](https://github.com/HapticX/happyx-tutorial-series)[](https://github.com/HapticX/hpx-vs-code)
[](https://pypi.org/project/happyx/)
[](https://www.npmjs.com/package/happyx)# Why HappyX? πββοΈ
> HappyX is a web framework with asynchronous, macro-oriented, full stack support.In HappyX you can write `single page`, `static site generation` and `server side rendering` applications π‘
You can write Rest API with HappyX also π
HappyX is very simple to use. Keep your peace of mind π
## Why Not Jester/Karax? π€
Jester and Karax have many features, but Jester is a `backend web framework`, and Karax is a `frontend web framework`. HappyX is a `full-stack web framework` that combines the features of Jester and Karax and slightly improves them πWith HappyX you mustn't learn new libraries/frameworks to switch between `frontend` and `backend`. You can switch between them easily using HappyX β
HappyX is macro-oriented web framework so you mustn't write a lot of code β¨
## Features β‘
- Multiple options for HTTP server! Happyx use `asynchttpserver` as default HTTP server (`httpx` via `-d:happyxHttpx`, `httpbeast` via `-d:happyxBeast` and `microhttpserver` via `-d:happyxMicro` as alternative HTTP servers).
- Support `SPA` on `JS` backend and `SSR` on other backends.
- Build HTML, CSS and pure JS with `buildHtml`, `buildStyle` and `buildJs` macros.
- Request models that supports `JSON`/`XML`/`Form-Data`/`x-www-form-urlencoded` with `model` macro.
- Routing and powerful path params.
- Assignment path params with `pathParams` macro.
- Powerful mounting sub-applications with `mount` macro.
- Logging with `-d:debug`.
- Automatic translate with `-d:hpxTranslate` or `-d:translate` flags.
- CLI tool for `creating`, `serving` and `building` your projects.
- Hot code reloading (only for `SPA` projects as of now).
- [Python bindings](https://pypi.org/project/happyx/)
- [NodeJS bindings](https://www.npmjs.com/package/happyx)## Minimal Example π©βπ»
SPA
SSR
import happyx
appRoutes "app":
"/":
"Hello, world!"
import happyx
serve "127.0.0.1", 5000:
"/":
"Hello, world!"
# Get Started π¨βπ¬
## Installing π₯
### Nimble
```shell
nimble install happyx@#head
```### Nimble via Git
```shell
nimble install https://github.com/HapticX/happyx
```### PyPI
```shell
pip install happyx
```## Usage βΆ
### SSR
```bash
hpx create --name ssr_project --kind SSR
cd ssr_project/src
```Main script will be able in `/ssr_project/src/main.nim`
#### Run π»
| HTTP Server | Flag |
| -------------------- | ---------- |
| Default | no flags |
| Httpx | `-d:httpx` |
| MicroAsyncHttpServer | `-d:micro` |
| HttpBeast | `-d:beast` |### SPA
```bash
hpx create --name spa_project --kind SPA --path-params
cd spa_project
```Main script will be able in `/spa_project/src/main.nim`
#### Run π»
Just run this command and see magic β¨
```bash
hpx dev --reload
```## Have A Question? π
[](https://stackoverflow.com/search?q=%5Bnim-lang%5D+HappyX)
## Have A Nice Idea? π
[Open issue](https://github.com/HapticX/happyx/issues/new/choose) or contact us hapticx.company@gmail.com
## Contributing π
See [Contributing.md](https://github.com/HapticX/happyx/blob/master/.github/CONTRIBUTING.md) for more information## Donate π°
[](https://www.tinkoff.ru/cf/9HWYxcPF4pS)## Star History β¨