Docs / Backend
ven.php

Backend

VenJS ships a secure PHP backend: a PDO database endpoint (ven.php) and a notification registration handler (ven_notify.php), plus a service worker (sw.js).

Files

FileRole
ven.phpSecure DB endpoint. Receives a JSON payload (op, table, …) and runs prepared statements. Used by venjs.db.connect().
ven_notify.phpReceives { deviceId, type } and appends the subscription to notification_handler.txt.
sw.jsService worker handling push and notificationclick events.
api/read.txtPlaceholder folder note for your own API entry files.

Frontend ↔ Backend flow

// Browser (venjs.db)                       // Server (ven.php)
venjs.db.connect({ endpoint:'/ven.php',     // 1. check origin + API key
  apiKey:'...', table:'users' })            // 2. sanitize identifiers / table allowlist
  .read({ where:{ id: 1 } })                // 3. build + execute prepared statement
  .then(rows => ...)                         // 4. respond JSON { ok, data, count }

Real-life structure

Developers keep the form UI in components/login.js and the DB call in logic/login.js. The router maps /login to the page component.

venjs/
  components/
    login.js        # LoginPage — form UI + local state
  logic/
    login.js        # loginUser() — venjs.db.connect() call
  router.js         # maps /login => window.LoginPage()

See Database Engine → Real-life login example for the full code.

Requirements

  • PHP 8+ with the pdo_mysql extension enabled.
  • A MySQL/MariaDB database and a user with table access.
  • Served over HTTP(S); the ven.php endpoint must be reachable by the frontend's fetch calls.