Legacy MSc thesis prototype modernized into a reproducible local demo for a restaurant ordering workflow involving Solid Pods concepts, PDF bill generation, and blockchain-style payment verification.
The original project was developed as an academic prototype. This repository keeps that context explicit while making the project easier to run, inspect, and extend today.
The project currently has a stable local demo mode.
In local demo mode, the application can run without:
- a working Solid Pod;
- Solid refresh-token credentials;
- MetaMask;
- Infura or another RPC provider;
- Sepolia ETH;
- a deployed smart contract.
The local demo uses local JSON fixtures and generated runtime files to reproduce the main application flow:
- open a table page;
- load the restaurant menu;
- create an order;
- update local runtime inventory;
- generate a pre-payment bill PDF;
- complete a mock payment;
- generate a final paid bill PDF;
- download the bill.
The original Solid and blockchain integrations are still present as legacy/prototype code, but they are not treated as production-ready. The repository now includes safe tooling to inspect and rebuild the Solid side before attempting any real Pod initialization.
This project is useful as:
- a preserved MSc thesis artifact;
- a practical example of a server-rendered Node.js prototype;
- a local demo of a restaurant ordering and bill-generation workflow;
- a starting point for rebuilding a Solid Pods integration in a controlled way;
- a portfolio repository showing how an old prototype can be cleaned, documented, tested, and made reproducible.
It should not be presented as a production restaurant system.
- table-based route access;
- menu rendering from local fixtures;
- local order creation;
- local runtime inventory updates;
- PDF bill generation;
- mock payment flow;
- downloadable paid bill;
- smoke test for the local app.
The repository includes non-destructive Solid tooling:
solid:envchecks Solid-related environment configuration;solid:fixturesvalidates local files before upload;solid:planprints the expected Pod structure;solid:export-planwrites a local JSON plan;solid:readinessruns the main non-destructive readiness checks;solid:probechecks configured Solid URLs without authentication;solid:probe:authchecks configured Solid URLs with authenticated admin fetch;init:podsis protected byALLOW_POD_RESET=true.
.envis ignored;- local runtime files are ignored;
- generated PDFs are ignored;
- generated QR files are ignored;
- Dropbox and Windows metadata files are ignored;
- a
doctorcommand checks common privacy and repository hygiene issues.
- Node.js
- Express
- EJS
- PDFKit
- QRCode
- Solid client libraries
- Web3 legacy dependency retained for future blockchain-mode modernization
- Solidity smart contract source retained as legacy artifact
.
|-- restaurant.js
| Main Express application and command entry point.
|
|-- src/
| |-- config.js
| | Centralized environment-based configuration.
| |
| |-- client-functions.js
| | Core application logic for menu loading, orders, store updates,
| | bill generation, payment handling, local fallback, and Solid setup.
| |
| |-- solid-lib-interface.js
| | Legacy Solid helper functions.
| |
| |-- pdf-kit-ext.js
| PDFKit table helper.
|
|-- scripts/
| |-- doctor.js
| | Repository hygiene and privacy checks.
| |
| |-- test-local-flow.js
| | Local server smoke test.
| |
| |-- solid-env-check.js
| | Solid environment validation.
| |
| |-- solid-fixtures.js
| | Solid fixture validation.
| |
| |-- solid-export-plan.js
| Exports a local Solid planning file.
|
|-- views/
| EJS templates.
|
|-- static/css/
| CSS files.
|
|-- utils/
| |-- store.json
| |-- order-temp.json
| |-- bill-temp.json
| |-- smart-contract.sol
| |-- img/
| Local fixtures, images, and legacy smart contract source.
|
|-- .env.example
| Local demo environment example.
|
|-- .env.solid.example
| Solid-specific environment example.
The current tested environment is:
Node.js 18.x
npm 9.x
The project may work with newer Node/npm versions, but some dependencies are legacy and should be updated carefully.
Check your versions:
node --version
npm --versionInstall dependencies:
npm installCreate a local environment file:
cp .env.example .envDo not commit .env.
For the local demo, .env should include:
PORT=8080
BASE_URL=http://localhost:8080
TABLE_COUNT=4
USE_LOCAL_DATA_FALLBACK=true
SOLID_AUTH_ENABLED=false
PAYMENT_MODE=mock
ALLOW_POD_RESET=falseMeaning:
USE_LOCAL_DATA_FALLBACK=true: use local fixtures when Solid is unavailable;SOLID_AUTH_ENABLED=false: do not attempt Solid login during normal app use;PAYMENT_MODE=mock: complete payment locally without MetaMask/blockchain;ALLOW_POD_RESET=false: prevent destructive Solid initialization.
Start the app:
npm startOpen:
http://localhost:8080/
or directly:
http://localhost:8080/1
http://localhost:8080/2
http://localhost:8080/3
http://localhost:8080/4
Recommended manual flow:
- open a table page;
- add a product;
- open the cart;
- click
Order; - return to the table page if needed;
- click
Get Bill; - click
Complete Mock Payment; - download the final bill;
- click
Back to Table.
Expected terminal messages include:
Local demo mode enabled. Loading menu and order from local runtime files.
Local order saved: ./utils/runtime/activeorder/order-table-1.json
Local store updated: ./utils/runtime/store.json
Local pre-bill PDF generated: ./utils/runtime/billing/to-pay/<hash>.pdf
Mock payment executed.
Local paid bill PDF generated: ./utils/runtime/billing/payed/<hash>.pdf
The local demo writes generated files under:
utils/runtime/
Clean them with:
npm run clean:runtimeThese files are ignored by Git.
npm startStart the Express app.
npm run devStart the app with Nodemon.
npm run clean:runtimeDelete local runtime files.
npm run doctorRun repository hygiene checks.
npm run test:local-flowRun the local server smoke test.
npm testRun the doctor check and local flow smoke test.
npm run solid:envCheck Solid-related environment variables.
npm run solid:fixturesValidate local fixtures intended for Solid upload.
This currently warns that utils/store.json uses the legacy field cost_per_unit. That warning is expected.
npm run solid:planPrint the expected Solid Pod structure.
npm run solid:export-planExport the expected Solid structure to:
solid-plan.local.json
This file is ignored by Git.
npm run solid:readinessRun the main non-destructive Solid readiness checks:
solid:env
solid:fixtures
solid:export-plan
npm run solid:probePerform read-only public GET requests against the configured Solid URLs.
npm run solid:probe:authPerform read-only authenticated GET requests using admin Solid credentials.
npm run init:podsRun the legacy Solid initialization flow.
This command is protected and refuses to proceed unless:
ALLOW_POD_RESET=trueOnly use this on a dedicated test Pod path.
The historical Pod path used by the original project is no longer assumed to work. If solid:probe returns HTML pages or redirects to an Inrupt profile/landing page, the app is not receiving the expected Solid resources.
Recommended rebuild order:
npm run solid:env
npm run solid:fixtures
npm run solid:plan
npm run solid:export-plan
npm run solid:probe
npm run solid:probe:authOnly after the environment, target URLs, and credentials are correct should you consider:
ALLOW_POD_RESET=trueand then:
npm run init:podsAfter initialization, immediately return to:
ALLOW_POD_RESET=falseRecommended Solid path convention:
SOLID_ROOT_CONTEXT=restaurant-demo
SOLID_TEST_NUMBER=1Use a dedicated test area. Do not point initialization at personal, production, or shared Pod areas.
The default payment flow is:
PAYMENT_MODE=mockThis is intentional. It makes the demo reproducible without relying on a live chain.
Future blockchain mode should use:
PAYMENT_MODE=blockchain
ETH_NETWORK=sepolia
ETH_RPC_URL=
SMART_CONTRACT_ADDRESS=
RESTAURANT_WALLET_ADDRESS=The old Kovan-oriented flow is not treated as current. The blockchain path should be rebuilt with Sepolia or a local Hardhat network.
The following are runtime/generated and should not be committed:
.env
utils/runtime/
utils/temp.pdf
utils/temp.json
utils/img/QR-tables/*.png
solid-plan.local.json
The repository keeps:
utils/img/QR-tables/.gitkeep
so that the QR directory exists without tracking generated images.
Before publishing or pushing changes:
npm run doctorAdditional manual checks:
git ls-files | grep -E '(^\.env$|utils/runtime|utils/temp|QR-tables/.*\.png|dropbox|Zone.Identifier)'Expected output: nothing.
grep -RIn --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=utils/runtime --exclude=package-lock.json \
"kovan.infura\|396DC917\|09025260fc864cd09d057f68852e45ea\|Administrator0\|Ristorante1\|Authority2" .Expected output: nothing except intentional matches inside check scripts, if those scripts are not excluded.
This is still a legacy prototype.
Current limitations:
- demo-style global server state;
- no database;
- no browser-level automated tests;
- limited server-side validation;
- mock payment is not a real blockchain transaction;
- Solid initialization requires a fresh, carefully configured Pod context;
- blockchain mode requires modernization;
cost_per_unitis a legacy store field;- the current order/bill hash is a legacy JavaScript hash and can produce negative identifiers.
Recommended next steps:
- rebuild Solid integration on a fresh Pod;
- replace the legacy JavaScript hash with SHA-256 identifiers;
- refactor global state into table-scoped state;
- add deeper tests for order, bill, and mock payment flows;
- modernize blockchain payment using Sepolia or Hardhat;
- normalize store schema from
cost_per_unittoprice_per_unit; - move frontend JavaScript out of EJS templates;
- improve UI and error handling.
This repository is connected to an MSc thesis prototype on decentralized accounting/document-management workflows using Solid Pods and blockchain-based transaction/payment concepts.
It is maintained here as a cleaned and reproducible research/portfolio artifact.
The project currently uses the license declared in package.json.
Review the license before reuse or redistribution.