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

Pakai Server​

Version 6.00

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

Pakai Server v6.00
Project modules


Templates (B4J)​

Depends on​

Features​

  • Frontend using HTMX v2.0.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 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 is optional
  • WebApiUtils is optional
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

  • Pakai Server (6.00) bundle.b4xtemplate
    413.1 KB · Views: 0
  • Pakai Server (6.00) starter.b4xtemplate
    28.3 KB · Views: 0
  • Pakai Server (6.00) min.b4xtemplate
    17.9 KB · Views: 0
  • libs.json.zip
    514 bytes · Views: 0
Last edited:

aeric

Expert
Licensed User
Longtime User

Example Code​

CategoriesHandler:
Private Sub CreateCategoriesTable As Tag
    Dim table1 As Tag = HtmlTable.cls("table table-bordered table-hover rounded small")
    Dim thead1 As Tag = Thead.cls("table-light").up(table1)
    thead1.add(Th.sty("text-align: right; width: 50px").text("#"))
    thead1.add(Th.text("Name"))
    thead1.add(Th.sty("text-align: center; width: 120px").text("Actions"))
    Dim tbody1 As Tag = Tbody.init.up(table1)
    
    DB.SQL = Main.DBOpen
    DB.Table = "tbl_categories"
    DB.Columns = Array("id", "category_name AS name")
    DB.OrderBy = CreateMap("id": "")
    DB.Query
    For Each row As Map In DB.Results
        Dim tr1 As Tag = CreateCategoriesRow(row)
        tr1.up(tbody1)
    Next
    DB.Close
    Return table1
End Sub
 
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:
Top