Guides · For businesses

A secure staff portal with Node.js and SQLite

A place your team signs in to keep customers, jobs, stock or whatever your business tracks, with roles so people only do what they should. This guide shows how the staff portal BackendGen.dev generates is built, what keeps it safe, and how to set it up and look after it.

Why Node.js and SQLite

A staff portal for a small business has a handful of people signed in at once and a few thousand records. That doesn't need a database server, a cluster or a cloud account. SQLite keeps everything in one file next to the program: nothing extra to install, run or pay for, and a backup is a copy of that file. Node.js with Express is one of the most widely used ways to write a web server, so any web developer can read and change the code.

The whole thing runs as one program: the server, the database and the portal's web pages. You can run it on the computer in your office, or on a small server for a few pounds a month so your team can sign in from anywhere.

What's inside

File or folderWhat it is
server.js, app.jsStarts the Express app and connects the parts.
lib/Sign-in, sessions, roles, the database, emails, backups.
routes/What the portal can ask the server to do: staff, records and, with Advanced, the shop and bookings.
portal/The staff portal itself: plain HTML, CSS and JavaScript, served by the same server.
business-config.jsonYour settings: business details, record types and fields, security and backups.
.envSecrets such as the session key and email password. Never share it.
business.sqliteThe database, made the first time it starts.
backups/Automatic copies of the database.
self-test.js, update.jsA check that everything works, and safe updates.

Roles

Everyone signs in with their own email and password. Each person has one of three roles, and the server checks the role on every request, so hiding a button in the portal is never the only thing standing in the way.

RoleCanCan't
OwnerEverything, including adding and removing managers and owners.—
ManagerEverything else: delete records, export to CSV, see the activity log, manage staff.Change owners or other managers.
StaffView, add and edit records; day-to-day shop and booking work with Advanced.Delete (unless you allow it for a record type), export, refund, change prices or see the activity log.

New people get a temporary password, shown once, and must choose their own before they can do anything else. When someone leaves, switch their account off: their sessions stop working straight away and their history stays in the activity log.

Your records

You decide what the portal keeps. Each record type is a list, such as Customers, Jobs, Suppliers or Tasks, with the fields you need. They're set in the generator, or later in business-config.json:

"collections": [
  {
    "key": "jobs", "label": "Jobs", "singular": "Job", "staffCanDelete": false,
    "fields": [
      { "key": "title",    "label": "Job",      "type": "text",   "required": true, "listed": true },
      { "key": "customer", "label": "Customer", "type": "text",   "listed": true },
      { "key": "status",   "label": "Status",   "type": "select", "listed": true,
        "options": ["Quote", "Booked", "In progress", "Done", "Invoiced", "Paid"] },
      { "key": "due",      "label": "Due",      "type": "date",   "listed": true },
      { "key": "price",    "label": "Price",    "type": "money" },
      { "key": "notes",    "label": "Notes",    "type": "longtext" }
    ]
  }
]

Field types are text, longtext, number, money, date, datetime, email, phone, url, select (with options) and checkbox. "listed": true shows a field as a column in the table. Add a type or a field, restart, and it's there; removing a field hides it but keeps what was stored, so nothing is lost by accident.

What keeps it safe

These are on by default; there's nothing to switch on.

The limits are in business-config.json under "security":

"security": {
  "sessionHours": 12,
  "loginAttempts": 5,
  "lockMinutes": 15,
  "auditDays": 365
}

What it doesn't have: two-step sign-in (codes from an app). If your business needs it, put the portal behind a service that adds it, such as a VPN or a sign-in gateway in front of the server.

Set it up

  1. Generate it

    In the business generator, pick Staff portal (customers + jobs) for a trade, agency or repair shop, or Start empty to add your own record types. Fill in the business name and the owner's email, then download.

  2. Start it

    Install Node.js 22 or newer, then double-click start-local.cmd (Windows) or start-local.command (Mac). Or in a terminal:

    npm install
    npm start
  3. Sign in as the owner

    Open http://localhost:3000/portal and sign in with the owner's email and the OWNER_PASSWORD from .env. Choose your own password, then delete the OWNER_PASSWORD line. Locked yourself out later? Run node reset-owner.js on the server for a new temporary password.

  4. Add your team

    Open Team and add each person with their role. Give them their temporary password in person or by phone, not in the same email as the address of the portal.

  5. Check it

    npm run self-test

    The self-test checks that wrong passwords are refused, that staff can't do what only managers can, that the cross-site protection works, and that records can be added and edited. Then it tidies up after itself.

Before you go live

To let your team sign in from anywhere, put it on a small server with HTTPS. The deploy guide takes about 20 minutes on Ubuntu or Windows Server. Then go through this list:

Looking after it

Changing how it works

Most changes need no code: record types, fields, roles allowed to delete, session length and backups are all settings. For anything else, the code is plain, commented JavaScript, and your web developer can change it.

Update packages replace the generated files (app.js, lib/, routes/, portal/). Your copies are saved in update-backups/ first, so nothing is lost, but changes to those files have to be made again after an update. Keep a short note of what you changed, or put bigger additions in files of your own.

Your website, a spreadsheet or another program can use the same server: the full list of endpoints is at /api/openapi.json.

See your portal before you buy

Create a free account, set up your record types in the business generator and see exactly which files you'd get. You only need a licence to download.

Open the business generatorBusiness backends

More for businesses: online bookings for a clinic or salon · self-hosted vs Firebase vs Retool.