https://github.com/pyhoon/pakai-server-b4j
Build REST API Server Using B4J Template
https://github.com/pyhoon/pakai-server-b4j
ajax-request b4a b4i b4j b4x bootstrap-icons bootstrap4 bootstrap5 crud-api htmx jquery json restful-api template webapi webapp xml
Last synced: 18 days ago
JSON representation
Build REST API Server Using B4J Template
- Host: GitHub
- URL: https://github.com/pyhoon/pakai-server-b4j
- Owner: pyhoon
- License: mit
- Created: 2022-10-04T08:32:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-02-19T16:22:11.000Z (26 days ago)
- Last Synced: 2026-02-19T16:47:22.886Z (26 days ago)
- Topics: ajax-request, b4a, b4i, b4j, b4x, bootstrap-icons, bootstrap4, bootstrap5, crud-api, htmx, jquery, json, restful-api, template, webapi, webapp, xml
- Language: B4X
- Homepage: https://www.b4x.com/android/forum/threads/web-project-template-pakai-server-v6-00.169224/
- Size: 14.8 MB
- Stars: 14
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Pakai Server - Web Application framework
Version: 6.36
Create Web API or Application Backend Server using B4J project template
### Preview

---
## Templates
- Pakai Server (6.36).b4xtemplate **_recommended_**
- Pakai Server Bundle (6.36).b4xtemplate (local assets)
## Depends on
- [EndsMeet.b4xlib](https://github.com/pyhoon/EndsMeet)
- [MiniCSS.b4xlib](https://github.com/pyhoon/MiniCSS-B4X)
- [MiniHtml.b4xlib](https://github.com/pyhoon/MiniHtml2-B4X)
- [MiniJS.b4xlib](https://github.com/pyhoon/MiniJS-B4X)
- [MiniORMUtils.b4xlib](https://github.com/pyhoon/MiniORMUtils-B4X)
- [WebApiUtils.b4xlib](https://github.com/pyhoon/WebApiUtils-B4J)
- sqlite-jdbc-3.7.2.jar (SQLite)
- mysql-connector-j-9.3.0.jar (MySQL)
- mariadb-java-client-3.5.6.jar (MariaDB)
## Features
- Frontend using Bootstrap v5.3.8, Bootstrap Icons v1.13.1, HTMX v2.0.8, AlpineJS v3.15.8
- Responsive design with modal dialog and toast
- SQLite and MySQL/MariaDB backend
- Built-in REST API or CRUD examples
## Improvement
- Better UI/UX/DX compared to version 5.x
- More flexible to generate new models
- HTML generated using B4X
- No JavaScript module
- No jQuery AJAX parsing
- JSON/XML API supported
- WebApiUtils supported with HelpHandler
### Code Example
```b4x
Private Sub CreateProductsTable As MiniHtml
If App.ctx.ContainsKey("/products/table") = False Then
Dim table1 As MiniHtml = Table.cls("table table-bordered table-hover rounded small")
Dim thead1 As MiniHtml = Thead.cls("table-light").up(table1)
Th.up(thead1).sty("text-align: right; width: 50px").text("#")
Th.up(thead1).text("Code")
Th.up(thead1).text("Name")
Th.up(thead1).text("Category")
Th.up(thead1).sty("text-align: right").text("Price")
Th.up(thead1).sty("text-align: center; width: 120px").text("Actions")
Tbody.up(table1)
App.ctx.Put("/products/table", table1)
End If
DB.SQL = DB.Open
DB.Table = "tbl_products p"
DB.Columns = Array("p.id id", "p.category_id catid", "c.category_name category", "p.product_code code", "p.product_name name", "p.product_price price")
DB.Join = DB.CreateJoin("tbl_categories c", "p.category_id = c.id", "")
DB.OrderBy = CreateMap("p.id": "")
DB.Query
Dim table1 As MiniHtml = App.ctx.Get("/products/table")
Dim tbody1 As MiniHtml = table1.Child(1)
tbody1.Children.Clear ' remove all children
For Each row As Map In DB.Results
row.Put("price", NumberFormat2(row.Get("price"), 1, 2, 2, True))
Dim tr1 As MiniHtml = CreateProductsRow
tr1.Child(0).text2(row.Get("id"))
tr1.Child(1).text2(row.Get("code"))
tr1.Child(2).text2(row.Get("name"))
tr1.Child(3).text2(row.Get("category"))
tr1.Child(4).text2(row.Get("price"))
tr1.Child(5).Child(0).attr("hx-get", "/hx/products/edit/" & row.Get("id"))
tr1.Child(5).Child(1).attr("hx-get", "/hx/products/delete/" & row.Get("id"))
tr1.up(tbody1)
Next
DB.Close
Return table1
End Sub
```
**Support this project**
