A minimal, ready-to-run admin panel built with Bnlang (Bangla Programming Language), using RouteOn for routing, SQLite for persistence, and AdminLTE for UI.
https://github.com/bnlang/bnlang-simple-admin-panel
- Login/logout flow with cookie-based session
- Auth middleware guarding
/admin/*routes - Admin dashboard scaffold (AdminLTE theme)
- SQLite database with auto-migration and seed
- XHR-friendly responses (JSON + redirect hints)
- Bnlang runtime (
bnl) - Routing:
route-on - Cookies:
route-on-cookies - Database:
bnlang-sqlite(SQLite) - UI: AdminLTE, Bootstrap, jQuery (served from
public/)
- Bnlang and BPM installed (provides the
bnlandbpmCLIs)
If dependencies are not already present:
bpm installbnl index.bnlOn first run, the database is created and a default admin is seeded:
- Email:
admin@example.com - Password:
admin123
Change these in data.sqlite or update via SQL once logged in.
bnlang-simple-admin-panel/
├─ index.bnl # App entrypoint, routes hookup
├─ db.bnl # SQLite connection + setup/seed
├─ routes/
│ ├─ login.bnl # GET /, POST /login
│ └─ admin/
│ ├─ dashboard.bnl # GET /admin/dashboard
│ └─ logout.bnl # GET /admin/logout
├─ middleware/
│ └─ auth.middleware.bnl # Session/auth guard
├─ views/
│ ├─ index.bhtml # Login page
│ └─ admin/
│ ├─ dashboard.bhtml # Dashboard view
│ └─ layouts/ # Header/footer (AdminLTE)
├─ public/ # CSS/JS/assets (AdminLTE, jQuery, Bootstrap)
├─ data.sqlite # SQLite DB file (auto-created)
└─ bnl_package.json # Project metadata and scripts
GET /→ Login pagePOST /login→ Authenticate; setsusercookie; JSON response with optionalredirectGET /admin/dashboard→ Protected dashboardGET /admin/logout→ Clears cookie and redirects to/
Middleware: middleware/auth.middleware.bnl
- Redirects unauthenticated
/admin/*requests to/ - Prevents visiting
/when already logged in (redirects to dashboard) - Loads
auth_userintores.localsfor views
- Port:
3000(seeindex.bnl→app.listen(3000)) - Static assets: served from
public/ - Views:
bhtmlengine, templates inviews/ - Cookies:
route-on-cookiesis initialized with a fixed secret; theusercookie itself is not signed in this demo
Database initialization (in db.bnl):
- Creates
adminstable if missing - Seeds the default admin when table is empty
This project is intended as a simple demo. For production:
- Store password hashes (e.g., bcrypt) instead of plaintext
- Sign or encrypt session cookies; consider rotating secrets
- Add CSRF protection to form submissions
- Validate and rate-limit login attempts
- To reset the admin, delete
data.sqliteand restart, or update theadminstable directly:
UPDATE admins SET email = 'you@example.com', password = 'change-me' WHERE id = 1;- Adjust the cookie secret in
index.bnlwherecookieParser("...")is configured.
MIT
Author: Bnlang