Skip to content

bnlang/bnlang-sqlite-simple-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—‚οΈ Bnlang CRUD Example

A simple CRUD (Create, Read, Update, Delete) web application built with Bnlang using:

  • 🧭 route-on β€” lightweight web framework for routing and rendering
  • πŸ’Ύ bnlang-sqlite β€” SQLite database connector
  • 🎨 Tailwind CSS β€” for modern UI styling (via CDN)
  • 🧩 BHTML view engine β€” HTML templating

πŸ“ Project Structure

bnlang-crud/
β”œβ”€ index.bnl
β”œβ”€ db.bnl
β”œβ”€ data.sqlite
β”œβ”€ bnl_package.json
β”œβ”€ /views
β”‚  β”œβ”€ layout.bhtml
β”‚  β”œβ”€ items-index.bhtml
β”‚  β”œβ”€ items-new.bhtml
β”‚  β”œβ”€ items-edit.bhtml
β”‚  β”œβ”€ items-show.bhtml

βš™οΈ Features

βœ… SQLite database using raw queries
βœ… Dynamic views rendered via BHTML
βœ… Full CRUD: Create, Read, Update, Delete
βœ… Tailwind UI (no build step, via CDN)
βœ… Clean and dependency-light Bnlang app


πŸš€ Installation & Setup

# 1. Install dependencies
bpm install

# 2. Run the app
bnl index.bnl
# or
bpm run start

Then open your browser at http://localhost:3000.


🧠 How It Works

  • index.bnl: Main server file β€” defines routes, CRUD logic, and rendering.
  • db.bnl: Initializes SQLite database and schema.
  • /views: Contains .bhtml templates for pages (layout, list, form, details).
  • /public: Static folder for CSS, JS, or images if needed.

🧰 Example Routes

Method Path Description
GET /items Show all items
GET /items/new Create form
POST /items Add new item
GET /items/:id View item
GET /items/:id/edit Edit form
POST /items/:id Update item
POST /items/:id/delete Delete item

🎨 UI Example

Tailwind CDN is used directly inside layout.bhtml:

<script src="https://cdn.tailwindcss.com"></script>

This allows you to use Tailwind classes instantly without any build tools.


πŸ§‘β€πŸ’» Author

Developed with ❀️ using Bnlang
https://bnlang.dev


About

A simple CRUD application using BNL and SQLite

Resources

Stars

Watchers

Forks