@pleasenobugs/server
v0.2.0
Published
The PleaseNoBugs API: a feedback board for Nimiq mini apps, with pluggable storage.
Readme
@pleasenobugs/server
The PleaseNoBugs API. Run it on its own, or mount it into an Express app you already have. Needs Node 22.13 or newer.
Run it on its own
npx @pleasenobugs/server create-project --name "My app" --origin https://my.app --owner "NQ07 ..."
npx @pleasenobugs/servercreate-project also takes --screenshots board|owners|off and --approve.
The first command prints a project id; put that in the widget. The second
starts the API on port 8787 with its data in ./pleasenobugs.db.
| Variable | Default | What it does |
|---|---|---|
| PORT | 8787 | Where to listen. |
| PNB_DB | ./pleasenobugs.db | The SQLite file. Back it up by copying it. |
| PNB_DASHBOARD_ORIGINS | none | Comma-separated origins allowed to run the dashboard. None means no dashboard; use create-project. |
| PNB_TRUST_PROXY | 0 | Proxies in front of the server. 1 behind Railway, Fly or a load balancer. |
| PNB_PROJECT_NAME, PNB_PROJECT_ORIGINS, PNB_PROJECT_OWNER | none | On an empty server, make the first project from these. Ignored once any project exists. Every start prints each project's id and rules, and on Railway the line to paste. PNB_PROJECT_LOGIN_MESSAGE optionally adds an app login. |
| PNB_PROJECT_SCREENSHOTS | board | With the variables above: owners keeps every screenshot for the owners, off refuses them. The server enforces it, whatever a widget sends. |
| PNB_PROJECT_APPROVE | off | With the variables above: on makes new posts wait until an owner approves them. For a board on a public page. |
| PNB_POSTS_PER_IP_DAY | none | How many posts one IP address may send a day, over every board. Counted in memory, as a hash, never stored or logged. Off by default: on a phone network many people share one address. |
| PNB_TELEMETRY | on | off stops the daily counts (see the main README). |
| PNB_TELEMETRY_URL | the PleaseNoBugs collector | Where the daily counts go. |
| PNB_COLLECT | off | on receives other servers' counts. Only the makers' server needs it. |
Node prints one ExperimentalWarning about SQLite at start. That is Node's
label for node:sqlite, which ships inside Node; nothing is wrong.
Mount it in your own app
import express from 'express';
import { createRouter } from '@pleasenobugs/server';
import { SqliteStore } from '@pleasenobugs/server/sqlite';
const app = express();
app.use('/feedback', createRouter({ store: new SqliteStore('./feedback.db') }));
// → /feedback/v1/projects/:pid/posts, ...The router brings its own CORS and JSON parsing.
Another database
Implement the Store interface (src/store.ts) and add it to the list at the
top of src/store.test.ts. When that suite passes, it works.
