Share My Creation [Web] [Project Template] Pakai Server v6

Pakai Server​

Version 6.39

This version lets you develop dynamic web application connected to database backend without using JSON/XML API.
You don't need to modify html and javascript using another text editor to develop the frontend.
Develop everything on B4J IDE and see the magic on your browser!

Version 6.36 brings back Web API support and API Documentation through HelpHandler.

GitHub: https://github.com/pyhoon/pakai-server-b4j

Pakai Server v6.00

Templates:​

  • Pakai Server (6.39).b4xtemplate (47KB) recommended
  • Pakai Server Bundle (6.39).b4xtemplate (448KB) - local assets

Libraries:​

Features​

  • Frontend using HTMX v2.0.8, AlpineJS v3.15.8, Bootstrap v5.3.8, Bootstrap Icons v1.13.1
  • Responsive design with modal dialog and toast
  • SQLite and MySQL/MariaDB backend
  • Built-in CRUD/REST API 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

Tutorial​

https://www.b4x.com/android/forum/threads/pakai-framework-v6.169286/

Reminder: Please do not post issue or question on this thread.
Always remember to start a new thread for any question and prefix with [Pakai v6].
 

Attachments

  • theme.zip
    2.2 KB · Views: 14
  • Pakai Server (6.39).b4xtemplate
    46.1 KB · Views: 14
  • Pakai Server Bundle (6.39).b4xtemplate
    447 KB · Views: 10
Last edited:

aeric

Expert
Licensed User
Longtime User

Example Code​

CategoriesHandler:
Private Sub CreateCategoriesTable As MiniHtml
    If App.ctx.ContainsKey("/hx/categories/table") = False Then
        Dim table1 As MiniHtml = Table.cls("table table-bordered table-hover rounded small")
        Dim thead1 As MiniHtml = Thead.up(table1).cls("table-light")
        Th.up(thead1).text("#").sty("text-align: right; width: 50px")
        Th.up(thead1).text("Name")
        Th.up(thead1).text("Actions").sty("text-align: center; width: 120px")
        Tbody.up(table1)
        App.ctx.Put("/hx/categories/table", table1)
    End If
    
    DB.SQL = DB.Open
    DB.Table = "tbl_categories"
    DB.Columns = Array("id", "category_name")
    DB.OrderBy = CreateMap("id": "")
    DB.Query

    Dim table1 As MiniHtml = App.ctx.Get("/hx/categories/table")
    Dim tbody1 As MiniHtml = table1.Child(1)
    tbody1.Children.Clear ' remove all children
    For Each row As Map In DB.Results
        Dim tr1 As MiniHtml = CreateCategoriesRow        
        tr1.Child(0).text2(row.Get("id"))
        tr1.Child(1).text2(row.Get("category_name"))
        tr1.Child(2).Child(0).attr("hx-get", "/hx/categories/edit/" & row.Get("id"))
        tr1.Child(2).Child(1).attr("hx-get", "/hx/categories/delete/" & row.Get("id"))
        tr1.up(tbody1)
    Next
    DB.Close
    Return table1
End Sub
 
Last edited:

aeric

Expert
Licensed User
Longtime User

aeric

Expert
Licensed User
Longtime User

Pakai Server v5.50​

Languages


Pakai Server v6.00​

Languages
 
Last edited:

aeric

Expert
Licensed User
Longtime User
Updated to v6.00beta3min

This template removed assets files in Objects\www folder to make it only 18KB in size
Download the following jar files and put inside B4X additional libraries folder.

The project will show broken image links and some Javascript and CSS are not working correctly.
You need to run GetResources macro to download the assets files.
https://github.com/pyhoon/resget-b4j/releases/download/v1.00/resget.jar

This template requires updated version of dependencies.
You need to run GetLibraries macro to download the updated version.
Refresh the libraries manager tab after download is completed.
https://github.com/pyhoon/libget-b4j/releases/download/v2.50/libget.jar

If the project is showing error missing libraries, run GetLibraries macro to download the libraries.
Close and relaunch the project.



Edit:
In full version I may provide additional bundled version of this template.
First post has been updated with 3 versions.
By default, please use the starter version.
  • Pakai Server (6.00beta3starter).b4xtemplate (28KB) recommended
  • Pakai Server (6.00beta3bundle).b4xtemplate (412KB)
  • Pakai Server (6.00beta3min).b4xtemplate (18KB)
If you use the bundle version template, you can select "Bundle" from the Conditional Compilation so the html generated will use the local asset files instead of from jsdelivr CDN.

MainView:
#If Bundle
body1.script("$SERVER_URL$/assets/js/bootstrap.min.js")
body1.script("$SERVER_URL$/assets/js/htmx.min.js")
#Else
body1.cdnScript("https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.min.js", _
"sha384-G/EV+4j2dNv+tEPo3++6LCgdCROaejBqfUeNjuKAiuXbjrxilcCdDz6ZAVfHWe1Y")
body1.cdnScript("https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js", _
"sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz")
#End If
 
Last edited:

aeric

Expert
Licensed User
Longtime User
It's 11-11 !!
Pakai Server v6.00 is now released !!
 

aeric

Expert
Licensed User
Longtime User

Updates: 10/02/2026​

Templates:​

  • Pakai Server (6.33) min.b4xtemplate (21KB)
  • Pakai Server (6.33) starter.b4xtemplate (32KB) recommended
  • Pakai Server (6.33) bundle.b4xtemplate (416KB)

Libraries:​

Changes:​

  • Removed Database class
  • Rebased to MiniHtml2 and MiniOrmUtils.v4 libraries
 
Last edited:

aeric

Expert
Licensed User
Longtime User

Updates: 27/02/2026​

Templates:​

  • Pakai Server (6.36).b4xtemplate (47KB) recommended
  • Pakai Server Bundle (6.36).b4xtemplate (448KB)

Libraries:​

Changes:​

  • New ApiHandlers for generating JSON and XML Web API
  • New HelpHandler based on Bootstrap 5, HTMX and AlpineJS
  • New dependency to MiniCSS.b4xlib
  • New dependency to WebApiUtils.b4xlib

1772137977071.png

Bonus:​

  • Alternate theme for API Documentation page
  • Download theme.zip from first post and unzip the file help.css to Objects\www\assets\css
1772021789715-png.170250
 
Last edited:

aeric

Expert
Licensed User
Longtime User

Updates: 27/02/2026 2:23PM GMT+8​

Templates:​

  • Pakai Server (6.39).b4xtemplate (47KB) recommended
  • Pakai Server Bundle (6.39).b4xtemplate (448KB)

Changes:​

  • Fix small bug for bundle template
  • Fix libs.json MiniJS update link
  • Fix resources.json removed unused htmx extensions
 
Top