The OpenAPI document this page is rendered from: openapi.json. In a running bank it is served at /v1/openapi.json and this page under About.

API

Read off the code at build time: every route the servers register and what each handler reads and answers. Branches are not followed, so a response listed is one the handler can write on some path through it. The same walk as /v1/openapi.json.

git.bytestone.uk/hum3/gobank/bff

Package bff is the backend-for-frontend for the Model Bank apps.

It is the only server the thin clients talk to. It owns sessions and login, and turns banking data into screen-ready trees (package screen). Apart from health, the public login screen and login itself, every endpoint requires a session; the customer identity always comes from the session, never from the request.

The banking core is reached through the core package's CustomerQueries and Authenticator contracts (ADR-0002).

Health

whether the server is up, the API document, and not_found for every path no other route serves.

MethodPathRoute
GET/Every other path under /v1/: not_found, as JSON
GET/v1/healthAnswers as soon as the process serves HTTP
GET/v1/openapi.jsonServes the API document (package api): the surface this server and the staff web present, as built

Customer session

the login and the logout.

MethodPathRoute
POST/v1/loginChecks the customer ID and password, from a JSON body or a form, and opens a session: a JSON client gets the token and the home screen; a form post or a browser gets the mb_session cookie and is sent to the home screen
POST/v1/logoutEnds the session: a browser's cookie is cleared and it is sent to the login screen; a JSON client gets the login screen

Screens

the trees the app renders, the login screen open and the rest for a signed-in customer.

MethodPathRoute
GET/v1/screen/accountsThe home screen: the customer's net position and a row per account, each opening its product screen
GET/v1/screen/activityThe customer's transactions across every account, newest first, one page (?page=) at a time
GET/v1/screen/loginThe front door: the login form, whose submit is POST /v1/login, with the deployment's note
GET/v1/screen/product/{index}One account, by its index in the customer's list: its details and its own transactions, one page (?page=) at a time; 404 for an index the customer has no account at

git.bytestone.uk/hum3/gobank/bff/staff

Package staff is the staff web of the Model Bank: the login (story 1.7.1), the pages a member of staff reads the bank through (accounting, products, customers, payments, treasury, reports, about and the documentation), the role the signed-in user holds and the PII authorisation that gate what they see, the layout every page is rendered in, and the simulation console when there is one (ADR-0002 stage 6, stories 1.6.3 and 1.6.4).

It reads the bank through core.StaffQueries, acts on it through core.Commands, checks logins through core.Users and drives the simulation through Console, and knows nothing else of it. The BFF mounts it beside the customer routes (bff.Config.Staff) and its sessions are kept in the BFF's store.

Gate (*Site).requireLogin: every route but /about.json, /favicon.ico, /favicon.svg, /login needs the staff_session cookie or a bearer token.

requireLogin serves the open paths as they are and every other with the session the request's cookie names, or sends the browser to the login page with the page it wanted to come back to. An HTMX request that has lost its session is told to load the login page whole.

Simulation

the dashboard and its controls, the payments generator and the settings, what gobank-deploy drives.

MethodPathRoute
GET/The dashboard: the bank's position, the run's state and its controls; it polls its own sections
POST/add-customersOpens n customers in the background (POST n=), with the product mix the simulation uses; /about.json shows the batch's rate sim_controls
POST/advanceRuns one business day while the run is stopped (POST) sim_controls
GET/dashboard/updateThe dashboard's polled sections, as an HTML fragment
POST/payments/runStarts the payment generator (POST): the settings' payments a day send_payment
POST/payments/sendSends one generated payment now (POST) send_payment
POST/payments/stopStops the payment generator (POST) send_payment
POST/resetEmpties the bank and starts again on its opening day (POST); the settings are kept sim_controls
GET POST/settingsThe console settings: the page (GET), and the change (POST max_customers, payments_per_day, day_length; 0s runs flat out, a day length that does not parse leaves the current one) settings
GET/settings/statusThe settings page's status line, polled on its own so the form is never re-rendered under the operator
POST/startStarts the run (POST): the simulation moves day after day at the settings' day length until stopped sim_controls
POST/stopStops the run after the day in progress (POST) sim_controls

Session

the login and the logout, the PII authorisation and the view switch.

MethodPathRoute
POST/auth/authorizePII (POST): an admin authorises themselves to see personal data for a while, then returns to redirect=
POST/auth/revokePII (POST): the admin gives the authorisation up and returns to redirect=
GET POST/loginThe staff login: the form (GET) and its check (POST login, password) against the users component
POST/logoutEnds the staff session (POST): the cookie is cleared and the browser sent to the login page
GET/view/{name}Switches this browser between the bank's view and the customer's: GET view/{name}?back=<path> sets the staff_view cookie for a year and returns to the page that offered it

Accounting

the profit and loss, the balance sheet and a movement of the ledger.

MethodPathRoute
GET/accounting/balance-sheetThe balance sheet on the current business day, with the CET1 position
GET/accounting/pnlThe profit and loss statement since the bank opened, on an accrual basis
GET/movements/{id}Serves one movement of the ledger (ADR-0008): its page; with the suffix .goluca its plain-text-accounting text, with .json the movement itself

Products

the masters (a family's products, the bank's own) and the detail, a parameter's own page, which is also where a staff setting is made (ADR-0010), decided by the signed-in user.

MethodPathRoute
GET/products/bankThe bank's own parameters (Bank Rate, the reserve ratio and the rest), as the Bank tab shows them
GET/products/lendingThe lending products: the family's catalogue, each product with its book
GET/products/savingsThe savings products: the family's catalogue, each product with its book
GET POST/products/{owner}/parameters/{key}One parameter of a product or of the bank: its history and, for a signed-in user who may, the form that sets it (POST value, effective); ?refused= carries a refusal back to the page settings

Customers

the register, the search by name and a customer's detail and accounts.

MethodPathRoute
GET/customersThe customers, one page (?page=) at a time; personal data only for an authorised admin
GET/customers/Under /customers/: a customer's detail at /customers/{id}, or one of their accounts at /customers/{id}/account/{index}, each with its transactions one page (?txpage=) at a time
POST/customers/searchCustomer search by name (POST name=): the customers whose name contains it, oldest first and at most core.CustomerSearchLimit, as the register's table — the matches alone for htmx, the Customers page with them for a browser

Payments

the list and a payment's detail; the generator that makes them is Simulation's.

MethodPathRoute
GET/paymentsPayments: the list, newest first, one page (?page=) at a time, with the generator's controls
GET/payments/{id}One payment: its detail and the movements it made

Treasury

the cash position, the capital and the gilts.

MethodPathRoute
GET/treasury/capitalThe reserve ratio against its requirement, and the lending headroom
GET/treasury/cashThe cash position: deposits, loans, cash at the BoE against the required reserves, and the Bank Rate
GET/treasury/giltsThe gilt holdings and the purchase form
POST/treasury/gilts/buyBuys a gilt (POST tenor, face_value in pounds): admin only; returns to the gilts page buy_gilt

Reports

the charts, the BBSI return and a customer as the app shows them.

MethodPathRoute
GET/reports/bbsiThe BBSI return (Bank and Building Society Interest): each customer's interest for the year; personal data only for an authorised admin
GET/reports/chartsThe charts: the book, the customer count and the rates over the run
GET/reports/customer-viewA customer as the app shows them (?id=); without an id, the customer list

About

the project, the models, the documentation, the API and the ADRs; with a console, the runtime and the state another program reads.

MethodPathRoute
GET/aboutThe project: what the Model Bank is, its aims and its non-goals
GET/about.jsonThe demo's state for another program (GET, no session): version, schema, settings, the run and its rates, the position and the restart record
GET/about/adrThe architecture decision records compiled into this build
GET/about/apiThe API: every route the BFF and the staff web serve, read off the code at build time (package api), in clusters by subject (the function each is registered in), each linking to its own page; the types the bodies are made of follow
GET/about/api/{method}/{path...}One route of the API: what its handler needs, reads and answers, with a link to the registration in the source at this build's tag
GET/about/docsThe system documentation: the component registry, who may read what, the pre-rule debt and the ADR list
GET/about/docs/adr/An ADR whole: its page, or one of the diagrams and sources its markdown names beside it
GET/about/modelsThe architecture models: the C4 system context and container diagrams
GET/about/runtimeRuntime: the process, its memory against the limit, the schema versions and the restart record

Internal

the events, and with a console the explorer, export and import.

MethodPathRoute
GET/eventsEvents: the record of what happened and what it caused (ADR-0011)
GET/export.golucaThe whole book as a .goluca file (GET): admin only export
POST/importReplaces the book with an uploaded .goluca file (POST, multipart file=): admin only export
GET/internal/explorerThe DB explorer: every component's tables, read-only; a role sees only the components it may (customers needs view_pii)
GET/internal/explorer/The DB explorer's tables and rows, under its prefix

Assets

the tab icons and pta2svg's browser renderer.

MethodPathRoute
GET/favicon.icoThe tab icon as .ico, from lofigui unknown
GET/favicon.svgThe tab icon as SVG
GET/wasm/pta2svg's browser renderer and its loader, embedded (ADR-0008), so the movement page draws in the tab

Routes

API › bff › Health

GET /

Every other path under /v1/: not_found, as JSON

Needsnothing: open
Answers
404 Not found as application/json, text/html: screen.Screen or bff.errorBody (not_found)
Sourcebff/server.go:136, registered in (*Server).healthRoutes
API › bff › Health

GET /v1/health

Answers as soon as the process serves HTTP

No session.

Needsnothing: open
Answers
200 OK as application/json
Sourcebff/server.go:133 (*Server).health, registered in (*Server).healthRoutes
API › bff › Customer session

POST /v1/login

Checks the customer ID and password, from a JSON body or a form, and opens a session: a JSON client gets the token and the home screen; a form post or a browser gets the mb_session cookie and is sent to the home screen

Five failures for one customer ID or from one address in fifteen minutes lock that key for the rest of the window (429 with Retry-After).

Needsnothing: open
Formcustomer_id password
JSON bodybff.loginRequest
Answers
200 OK as application/json: bff.loginResponse
303 Redirect to /v1/screen/accounts
400 Bad request as application/json, text/html: screen.Screen or bff.errorBody (bad_request)
401 Unauthenticated as application/json, text/html: screen.Screen or bff.errorBody (bad_credentials)
429 Too many requests as application/json, text/html: screen.Screen or bff.errorBody (rate_limited)
500 Internal error as application/json, text/html: screen.Screen or bff.errorBody (internal)
Sourcebff/server.go:143 (*Server).login, registered in (*Server).sessionRoutes
API › bff › Customer session

POST /v1/logout

Ends the session: a browser's cookie is cleared and it is sent to the login screen; a JSON client gets the login screen

Needscookie mb_session, bearer token
Answers
200 OK as application/json: bff.screenBody
303 Redirect to /v1/screen/login
401 Unauthenticated as application/json, text/html: screen.Screen or bff.errorBody (unauthenticated)
Sourcebff/server.go:144 (*Server).logout in (*Server).authed, registered in (*Server).sessionRoutes
API › bff › Health

GET /v1/openapi.json

Serves the API document (package api): the surface this server and the staff web present, as built

Needsnothing: open
Answers
200 OK as application/json
Sourcebff/server.go:134 (*Server).openapi, registered in (*Server).healthRoutes
API › bff › Screens

GET /v1/screen/accounts

The home screen: the customer's net position and a row per account, each opening its product screen

Needscookie mb_session, bearer token
Answers
200 OK as application/json, text/html: screen.Screen
303 Redirect to /v1/screen/login
401 Unauthenticated as application/json, text/html: screen.Screen or bff.errorBody (unauthenticated)
404 Not found as application/json, text/html: screen.Screen or bff.errorBody (not_found)
500 Internal error as application/json, text/html: screen.Screen or bff.errorBody (internal)
Sourcebff/server.go:151 (*Server).accounts in (*Server).authed, registered in (*Server).screenRoutes
API › bff › Screens

GET /v1/screen/activity

The customer's transactions across every account, newest first, one page (?page=) at a time

Needscookie mb_session, bearer token
Querypage
Answers
200 OK as application/json, text/html: screen.Screen
303 Redirect to /v1/screen/login
401 Unauthenticated as application/json, text/html: screen.Screen or bff.errorBody (unauthenticated)
404 Not found as application/json, text/html: screen.Screen or bff.errorBody (not_found)
500 Internal error as application/json, text/html: screen.Screen or bff.errorBody (internal)
Sourcebff/server.go:152 (*Server).activity in (*Server).authed, registered in (*Server).screenRoutes
API › bff › Screens

GET /v1/screen/login

The front door: the login form, whose submit is POST /v1/login, with the deployment's note

No session.

Needsnothing: open
Answers
200 OK as application/json, text/html: screen.Screen
Sourcebff/server.go:150 (*Server).loginScreen, registered in (*Server).screenRoutes
API › bff › Screens

GET /v1/screen/product/{index}

One account, by its index in the customer's list: its details and its own transactions, one page (?page=) at a time; 404 for an index the customer has no account at

Needscookie mb_session, bearer token
Pathindex
Querypage
Answers
200 OK as application/json, text/html: screen.Screen
303 Redirect to /v1/screen/login
401 Unauthenticated as application/json, text/html: screen.Screen or bff.errorBody (unauthenticated)
404 Not found as application/json, text/html: screen.Screen or bff.errorBody (not_found)
500 Internal error as application/json, text/html: screen.Screen or bff.errorBody (internal)
Sourcebff/server.go:153 (*Server).product in (*Server).authed, registered in (*Server).screenRoutes
API › staff › Simulation

GET /

The dashboard: the bank's position, the run's state and its controls; it polls its own sections

Needscookie staff_session, bearer token
Answers
200 OK as text/html
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/console_routes.go:21, registered in (*Site).simulationRoutes
API › staff › About

GET /about

The project: what the Model Bank is, its aims and its non-goals

Needscookie staff_session, bearer token
Answers
200 OK as text/html
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:542, registered in (*Site).aboutRoutes
API › staff › About

GET /about.json

The demo's state for another program (GET, no session): version, schema, settings, the run and its rates, the position and the restart record

gobank-deploy's upgrade drill reads it before and after each redeploy; a performance run reads the rates.

Needsnothing: open
Answers
200 OK as application/json: staff.AboutStatus
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:617, registered in (*Site).aboutRoutes
API › staff › About

GET /about/adr

The architecture decision records compiled into this build

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:587, registered in (*Site).aboutRoutes
API › staff › About

GET /about/api

The API: every route the BFF and the staff web serve, read off the code at build time (package api), in clusters by subject (the function each is registered in), each linking to its own page; the types the bodies are made of follow

The OpenAPI document is at v1/openapi.json. A static page: the surface does not change while the run goes.

Needscookie staff_session, bearer token
Answers
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:564, registered in (*Site).aboutRoutes
API › staff › About

GET /about/api/{method}/{path...}

One route of the API: what its handler needs, reads and answers, with a link to the registration in the source at this build's tag

The method is the pattern's or "any", the path the pattern's.

Needscookie staff_session, bearer token
Pathmethod path
Answers
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:574, registered in (*Site).aboutRoutes
API › staff › About

GET /about/docs

The system documentation: the component registry, who may read what, the pre-rule debt and the ADR list

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:555, registered in (*Site).aboutRoutes
API › staff › About

GET /about/docs/adr/

An ADR whole: its page, or one of the diagrams and sources its markdown names beside it

Needscookie staff_session, bearer token
Answers
200 OK as text/html
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:592, registered in (*Site).aboutRoutes
API › staff › About

GET /about/models

The architecture models: the C4 system context and container diagrams

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:550, registered in (*Site).aboutRoutes
API › staff › About

GET /about/runtime

Runtime: the process, its memory against the limit, the schema versions and the restart record

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:610, registered in (*Site).aboutRoutes
API › staff › Accounting

GET /accounting/balance-sheet

The balance sheet on the current business day, with the CET1 position

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:287, registered in (*Site).accountingRoutes
API › staff › Accounting

GET /accounting/pnl

The profit and loss statement since the bank opened, on an accrual basis

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:283, registered in (*Site).accountingRoutes
API › staff › Simulation

POST /add-customers

Opens n customers in the background (POST n=), with the product mix the simulation uses; /about.json shows the batch's rate

Needscookie staff_session, bearer token; role action sim_controls
Formn
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:78 via control, registered in (*Site).simulationRoutes
API › staff › Simulation

POST /advance

Runs one business day while the run is stopped (POST)

Needscookie staff_session, bearer token; role action sim_controls
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:72 via control, registered in (*Site).simulationRoutes
API › staff › Session

POST /auth/authorize

PII (POST): an admin authorises themselves to see personal data for a while, then returns to redirect=

Needscookie staff_session, bearer token
Formredirect
Answers
303 Redirect
Sourcebff/staff/login.go:57, registered in (*Site).sessionRoutes
API › staff › Session

POST /auth/revoke

PII (POST): the admin gives the authorisation up and returns to redirect=

Needscookie staff_session, bearer token
Formredirect
Answers
303 Redirect
Sourcebff/staff/login.go:69, registered in (*Site).sessionRoutes
API › staff › Customers

GET /customers

The customers, one page (?page=) at a time; personal data only for an authorised admin

Needscookie staff_session, bearer token
Querypage
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:382, registered in (*Site).customersRoutes
API › staff › Customers

GET /customers/

Under /customers/: a customer's detail at /customers/{id}, or one of their accounts at /customers/{id}/account/{index}, each with its transactions one page (?txpage=) at a time

Needscookie staff_session, bearer token
Querytxpage
Answers
200 OK as text/html
303 Redirect
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:408, registered in (*Site).customersRoutes
API › staff › Simulation

GET /dashboard/update

The dashboard's polled sections, as an HTML fragment

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/console_routes.go:41, registered in (*Site).simulationRoutes
API › staff › Internal

GET /events

Events: the record of what happened and what it caused (ADR-0011)

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:637, registered in (*Site).internalRoutes
API › staff › Internal

GET /export.goluca

The whole book as a .goluca file (GET): admin only

Needscookie staff_session, bearer token; role action export
Answers
200 OK as application/octet-stream
403 Forbidden as text/plain (Forbidden)
405 Method not allowed as text/plain (Method not allowed)
500 Internal error as text/plain
Sourcebff/staff/site.go:668, registered in (*Site).internalRoutes
API › staff › Assets

GET /favicon.ico

The tab icon as .ico, from lofigui

Needsnothing: open
Answers
Sourcebff/staff/site.go:720 lofigui.ServeFavicon, registered in (*Site).assetRoutes
Unknownhandler lofigui.ServeFavicon: body outside the walk; no response found
API › staff › Assets

GET /favicon.svg

The tab icon as SVG

Needsnothing: open
Answers
200 OK as image/svg+xml
Sourcebff/staff/site.go:722, registered in (*Site).assetRoutes
API › staff › Internal

POST /import

Replaces the book with an uploaded .goluca file (POST, multipart file=): admin only

Needscookie staff_session, bearer token; role action export
Uploadfile
Answers
303 Redirect
400 Bad request as text/plain (No file uploaded; Read error)
403 Forbidden as text/plain (Forbidden)
405 Method not allowed as text/plain (Method not allowed)
500 Internal error as text/plain
Sourcebff/staff/site.go:687, registered in (*Site).internalRoutes
API › staff › Internal

GET /internal/explorer

The DB explorer: every component's tables, read-only; a role sees only the components it may (customers needs view_pii)

Needscookie staff_session, bearer token
Answers
200 OK as text/html
303 Redirect
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:663, registered in (*Site).internalRoutes
API › staff › Internal

GET /internal/explorer/

The DB explorer's tables and rows, under its prefix

Needscookie staff_session, bearer token
Answers
200 OK as text/html
303 Redirect
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:665, registered in (*Site).internalRoutes
API › staff › Session

GET POST /login

The staff login: the form (GET) and its check (POST login, password) against the users component

Five failures for one login or from one address lock it for fifteen minutes; 503 on a deployment with no users.

Needsnothing: open
Queryredirect
Formlogin password redirect
Answers
200 OK
303 Redirect
400 Bad request as text/plain (Malformed login form; Enter your login and password.)
401 Unauthenticated (Unknown login or wrong password.)
405 Method not allowed as text/plain (Method not allowed)
429 Too many requests
503 Unavailable (Staff login is not set up on this deployment.)
Sourcebff/staff/login.go:26, registered in (*Site).sessionRoutes
API › staff › Session

POST /logout

Ends the staff session (POST): the cookie is cleared and the browser sent to the login page

Needscookie staff_session, bearer token
Answers
303 Redirect
Sourcebff/staff/login.go:42, registered in (*Site).sessionRoutes
API › staff › Accounting

GET /movements/{id}

Serves one movement of the ledger (ADR-0008): its page; with the suffix .goluca its plain-text-accounting text, with .json the movement itself

Needscookie staff_session, bearer token
Pathid
Answers
200 OK as application/json, text/html, text/plain: core.Movement
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
500 Internal error as text/plain (Internal error)
Sourcebff/staff/site.go:291 (*Site).movement, registered in (*Site).accountingRoutes
API › staff › Payments

GET /payments

Payments: the list, newest first, one page (?page=) at a time, with the generator's controls

Needscookie staff_session, bearer token
Querypage
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:454, registered in (*Site).paymentsRoutes
API › staff › Simulation

POST /payments/run

Starts the payment generator (POST): the settings' payments a day

Needscookie staff_session, bearer token; role action send_payment
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:104 via payments, registered in (*Site).simulationRoutes
API › staff › Simulation

POST /payments/send

Sends one generated payment now (POST)

Needscookie staff_session, bearer token; role action send_payment
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:102 via payments, registered in (*Site).simulationRoutes
API › staff › Simulation

POST /payments/stop

Stops the payment generator (POST)

Needscookie staff_session, bearer token; role action send_payment
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:106 via payments, registered in (*Site).simulationRoutes
API › staff › Payments

GET /payments/{id}

One payment: its detail and the movements it made

Needscookie staff_session, bearer token
Pathid
Answers
200 OK as text/html
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:442, registered in (*Site).paymentsRoutes
API › staff › Products

GET /products/bank

The bank's own parameters (Bank Rate, the reserve ratio and the rest), as the Bank tab shows them

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:313, registered in (*Site).productsRoutes
API › staff › Products

GET /products/lending

The lending products: the family's catalogue, each product with its book

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:308, registered in (*Site).productsRoutes
API › staff › Products

GET /products/savings

The savings products: the family's catalogue, each product with its book

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:303, registered in (*Site).productsRoutes
API › staff › Products

GET POST /products/{owner}/parameters/{key}

One parameter of a product or of the bank: its history and, for a signed-in user who may, the form that sets it (POST value, effective); ?refused= carries a refusal back to the page

Needscookie staff_session, bearer token; role action settings
Pathowner key
Queryrefused
Formvalue effective
Answers
200 OK as text/html
303 Redirect
403 Forbidden as text/plain (Forbidden)
404 Not found as text/plain
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:319, registered in (*Site).productsRoutes
API › staff › Reports

GET /reports/bbsi

The BBSI return (Bank and Building Society Interest): each customer's interest for the year; personal data only for an authorised admin

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:519, registered in (*Site).reportsRoutes
API › staff › Reports

GET /reports/charts

The charts: the book, the customer count and the rates over the run

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:514, registered in (*Site).reportsRoutes
API › staff › Reports

GET /reports/customer-view

A customer as the app shows them (?id=); without an id, the customer list

Needscookie staff_session, bearer token
Queryid
Answers
200 OK as text/html
303 Redirect
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:524, registered in (*Site).reportsRoutes
API › staff › Simulation

POST /reset

Empties the bank and starts again on its opening day (POST); the settings are kept

Needscookie staff_session, bearer token; role action sim_controls
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:75 via control, registered in (*Site).simulationRoutes
API › staff › Simulation

GET POST /settings

The console settings: the page (GET), and the change (POST max_customers, payments_per_day, day_length; 0s runs flat out, a day length that does not parse leaves the current one)

The day length set here is the run's and outlives the process.

Needscookie staff_session, bearer token; role action settings
Formmax_customers payments_per_day day_length
Answers
200 OK as text/html
303 Redirect
403 Forbidden as text/plain (Forbidden)
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/console_routes.go:114, registered in (*Site).simulationRoutes
API › staff › Simulation

GET /settings/status

The settings page's status line, polled on its own so the form is never re-rendered under the operator

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/console_routes.go:142, registered in (*Site).simulationRoutes
API › staff › Simulation

POST /start

Starts the run (POST): the simulation moves day after day at the settings' day length until stopped

Needscookie staff_session, bearer token; role action sim_controls
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:68 via control, registered in (*Site).simulationRoutes
API › staff › Simulation

POST /stop

Stops the run after the day in progress (POST)

Needscookie staff_session, bearer token; role action sim_controls
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/console_routes.go:70 via control, registered in (*Site).simulationRoutes
API › staff › Treasury

GET /treasury/capital

The reserve ratio against its requirement, and the lending headroom

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:474, registered in (*Site).treasuryRoutes
API › staff › Treasury

GET /treasury/cash

The cash position: deposits, loans, cash at the BoE against the required reserves, and the Bank Rate

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:470, registered in (*Site).treasuryRoutes
API › staff › Treasury

GET /treasury/gilts

The gilt holdings and the purchase form

Needscookie staff_session, bearer token
Answers
200 OK as text/html
405 Method not allowed as text/plain (Method not allowed)
Sourcebff/staff/site.go:478, registered in (*Site).treasuryRoutes
API › staff › Treasury

POST /treasury/gilts/buy

Buys a gilt (POST tenor, face_value in pounds): admin only; returns to the gilts page

Needscookie staff_session, bearer token; role action buy_gilt
Formtenor face_value
Answers
303 Redirect
403 Forbidden as text/plain (Forbidden)
Sourcebff/staff/site.go:483, registered in (*Site).treasuryRoutes
API › staff › Session

GET /view/{name}

Switches this browser between the bank's view and the customer's: GET view/{name}?back=<path> sets the staff_view cookie for a year and returns to the page that offered it

Needscookie staff_session, bearer token
Pathname
Queryback
Answers
303 Redirect
Sourcebff/staff/login.go:80 (*Site).viewSwitch, registered in (*Site).sessionRoutes
API › staff › Assets

GET /wasm/

pta2svg's browser renderer and its loader, embedded (ADR-0008), so the movement page draws in the tab

Needscookie staff_session, bearer token
Answers
200 OK (static files)
Sourcebff/staff/site.go:729 in http.StripPrefix, registered in (*Site).assetRoutes

Types

Every type the bodies above are made of, from the Go declarations and their comments.

bff.errorBody object

errorBody is every error as a JSON client gets it: a stable code to switch on, what to tell the customer, and the screen to show with it when there is one (the login screen with its notice).

FieldType
errorstringbad_request, unauthenticated, bad_credentials, rate_limited, not_found or internal
messagestring
screenscreen.Screen or null optional

bff.loginRequest object

FieldType
customer_idstring
passwordstring

bff.loginResponse object

loginResponse is what a JSON client gets for a login: the session token to send back as a bearer, when the session ends whatever happens (it also ends after fifteen idle minutes), and the home screen, so the client has nothing more to fetch.

FieldType
tokenstring
expires_atstringRFC 3339, UTC
screenscreen.Screen

bff.screenBody object

screenBody is a screen on its own, as the logout answers a JSON client.

FieldType
screenscreen.Screen

core.EventRecord object

EventRecord is one event on the bank's record (ADR-0011): something that happened at an instant, raised by someone, whose cascade is pending or done.

FieldType
IDstring
Kindstring"start of day", "publication", "payment", "setting", "opening"
Attime.Time
Statusstring"pending", "done"
Bystringwho raised it: a user, a customer, a market's name, "clock"
RaisedAttime.TimeRaisedAt and DoneAt are wall time: in a simulation the bank's time (At) runs apart from the wall's, and the gap between them is how fast the bank works through its events.
DoneAttime.Time

core.Leg object

Leg is one side of a movement: the account and the balance it was left with, signed as the ledger holds it.

FieldType
AccountIDstring
Pathstring"Liability:Savings:cust-001:easy-access"
Typestringthe path's first segment: Asset, Liability, Equity, Income, Expense
Balanceluca.Amount

core.Movement object

Movement is one ledger movement as written (ADR-0008): a signed amount from one account to another, the to account's balance rising by it and the from account's falling, with the balance each is left with, in the bank's view.

FieldType
IDstring
Fromcore.Leg
Tocore.Leg
Amountluca.Amount
Currencystring
Codestring
ValueTimetime.Time
KnowledgeTimetime.Time
Descriptionstring
Causecore.EventRecord or nullCause is the root event a rule's posting was made under (ADR-0011) and Step the posting's name within it; nil and empty for a movement that is not a rule's, or from before the record.
Stepstring

luca.Amount integer

screen.Action object

Action is what happens when the user taps a component. Exactly one of the fields is set.

FieldType
screenstring optionalGET this path and show the result
submitstring optionalPOST form values to this path
logoutboolean optionalend the session

screen.Component object

Component is one element of a screen body. Type selects the component and which of the other fields are meaningful; unused fields are omitted from JSON.

FieldType
typestring
tonescreen.Tone optional
iconscreen.Icon optional
titlestring optional
subtitlestring optional
valuestring optional
notestring optional
currencystring optionalISO 4217 code of the money a row or tx shows; the renderer picks the glyph by it
textstring optional
pairs[]screen.Pair optional
fields[]screen.Field optional
actionscreen.Action or null optional

screen.Field object

Field is one input in a form.

FieldType
namestring
labelstring
kindstring"text", "password", "number"
placeholderstring optional
requiredboolean optional

screen.Icon string

Icon names a glyph. Clients map icons to their icon set.

One of: accounts, activity, bank, home, in, interest, lending, loan, "", out, savings

screen.Nav object

Nav is the bottom tab bar.

FieldType
activestring
tabs[]screen.Tab

screen.Pair object

Pair is a label/value line inside a hero or details component.

FieldType
labelstring
valuestring

screen.Screen object

Screen is one app view.

FieldType
schemainteger
idstring
pathstringGET path that returns this screen
titlestring
subtitlestring optional
backscreen.Action or null optional
body[]screen.Component
navscreen.Nav or null optional

screen.Tab object

Tab is one entry in the bottom tab bar.

FieldType
keystring
labelstring
iconscreen.Icon
screenstring

screen.Tone string

Tone selects a colour treatment. Clients map tones to their theme.

One of: danger, lending, muted, negative, "", positive, savings

staff.AboutOwed object

AboutOwed is core.Owed as another program reads it.

FieldType
at_restboolean
daysinteger
unprojectedinteger
eventsintegerroot events due and not done: cascades in progress (ADR-0011)

staff.AboutPosition object

AboutPosition is the bank's position: what the dashboard leads with.

FieldType
daystringYYYY-MM-DD
day_countinteger
customersinteger
savingsstringformatted, as the dashboard shows it
lendingstring

staff.AboutRestart object

AboutRestart is one row of the restart record, newest first, read with the row before it (see Restart).

FieldType
versionstring
started_attime.Time
day_countinteger
customersinteger
previous_versionstring"" for unrecorded or none
previous_stopped_attime.Time or null
downtimestringGo duration; "" when unknown
intactboolean or nullday and customers equal across the stop; null when the previous row cannot say
stopped_attime.Time or null
stop_day_countinteger
stop_customersinteger

staff.AboutRoute object

AboutRoute is one route's figures since the process started, as internal/routestats keeps them: the count, the latency (last, p50 and p95 of the latest requests, the maximum ever), the most in flight at once and the rate over the last minute.

FieldType
patternstringas registered: "GET /v1/health"
methodstring optional
pathstring
countinteger
in_flightinteger
peak_in_flightinteger
laststringGo durations
p50string
p95string
maxstring
per_secondnumbercompleted in the last minute, a second

staff.AboutSettings object

AboutSettings are the console settings.

FieldType
day_lengthstringGo duration; "0s" is flat out
max_customersinteger

staff.AboutSim object

AboutSim is the run as it is now, with the two rates a performance run reads: customers added per second (the live rate while a batch add runs, else the last batch's) and account days per 12h at the pass's measured whole-day rate, with the last day it is made of.

FieldType
runningboolean
wallstringthe wall clock now, RFC 3339 UTC
clockstringthe bank's clock now (simulated time), RFC 3339 UTC
warpnumbersimulated seconds per wall second; 0 when flat out
day_ends_instringGo duration; "0s" when flat out or stopped
adding_customersboolean
customers_per_secnumber
account_days_per_12hinteger
last_day_durationstringGo duration; "" before the first day
last_day_accountsinteger
day_refusedstring optionalwhy the bank would not follow the clock when last asked
owedstaff.AboutOwedwhat the bank owed when last asked (ADR-0010); a drill waits for at_rest
next_eventstring optionalthe event the run loop waits for: "payment at 2020-03-04T10:32:00Z"

staff.AboutStatus object

AboutStatus is the demo's state as another program reads it, at /about.json: the version and schema this process runs, the console settings, the run's position and the restart record. gobank-deploy's upgrade drill reads it before and after each redeploy to compare the position and read the downtime off the newest restart row.

FieldType
versionstring
schema[]staff.SchemaVersion
settingsstaff.AboutSettings
simstaff.AboutSim
positionstaff.AboutPosition
restarts[]staff.AboutRestart
routes[]staff.AboutRoute optionalwhat the process has measured of each route it served
tables[]staff.AboutTable optionalThe data's size on PostgreSQL: every table biggest first, and the whole database. None on pglike.
database_bytesinteger optional

staff.AboutTable object

AboutTable is one table's share of the database: its size on disk with indexes and TOAST, and its rows as PostgreSQL estimates them (as of the last ANALYZE; a count would scan the biggest tables).

FieldType
namestring
rowsinteger
bytesinteger

staff.SchemaVersion object

SchemaVersion is the version a component's tables are at.

FieldType
componentstring
versioninteger

time.Time string (date-time)

RFC 3339