Legacy Banking
Installation
Dependencies, SQL setup, and build steps required before starting legacy-banking.
Installation
Dependencies
Install and start these before legacy-banking:
- legacy-lib — provides the targeting bridge (
Target.AddModel,Target.AddLocalEntity,Target.RemoveLocalEntity), the JSONStoreused for bank locations, andGetAccentColorfor UI theming. - ox_lib — used for all server callbacks (
lib.callback.await), client notifications (lib.notify), and progress UI (lib.progressCircle). - oxmysql — the MySQL driver used for all database access.
Optional, feature-detected at runtime (no hard dependency listed in the manifest, but required for the phone app to work):
- lb-phone — the companion phone app registers itself dynamically via
exports['lb-phone']:AddCustomAppandSendCustomAppMessage. If lb-phone isn't installed, or an incompatible build is used, phone integration silently no-ops.
1. Database schema
Run sql/schema.sql once against your database. This drops and recreates every legacy_banking_* table in reverse-dependency order — do not re-run it against a database you want to keep:
legacy_banking_locationslegacy_banking_accountslegacy_banking_account_memberslegacy_banking_cardslegacy_banking_transactionslegacy_banking_atm_usagelegacy_banking_society_jobslegacy_banking_society_payrolllegacy_banking_audit
All tables use InnoDB/utf8mb4. Money columns are plain INT — whole currency units, not cents.
Optional migrations (run in order, after schema.sql)
sql/migrate-from-renewed.sql— imports society accounts from a Renewed-Banking install (bank_accounts_newtable). It has noIF EXISTSguard, so comment out the block if you never had Renewed-Banking installed, or it will error. It's safe to re-run (skips rows already migrated).sql/migrate-pin-plaintext.sql— required only if upgrading from a version that stored hashed PINs. Adds a plaintextpinVARCHAR(4) column and dropspin_hash/pin_salt. No-op on fresh installs (schema.sql already creates the plaintextpincolumn). Any card with a previously-hashed PIN loses its usable PIN — affected owners must set a new PIN via Change PIN.
Note:
server/migrate.luaalso runs automatically 3 seconds after resource boot toALTER TABLE legacy_banking_accounts(add anibancolumn + index if missing) and backfill IBANs — ensure your DB user hasALTER/CREATE INDEXprivileges.
2. Inventory item
Register a debit_card item in your inventory system's items file (ox_inventory/data/items.lua, qb-core/shared/items.lua, or qs-inventory/shared/items.lua) using the exact key debit_card — card ordering will fail (inv_full, rolled back server-side) without it.
- It must be non-usable — no
useable/client.usable, noserver.export, noregisterUsableItem. The ATM reads card data directly from the item's metadata slot; a 'use' handler will break the ATM flow. - Do not set
stack = trueif that would cause your inventory bridge to merge stacks and discard metadata — eachdebit_cardinstance carries unique metadata (card_id,last4,design,expiry,linked_label,description) set automatically by legacy-banking when a card is ordered. - Optionally add a
debit_card.pngicon to your inventory's image folder.
3. Build the web UIs
# Desktop banking UI (windowed NUI)
cd web && npm install && npm run build
# lb-phone app UI
cd phone && npm install && npm run build
web/dist is served via the resource's ui_page/files. phone/dist is served at cfx-nui-legacy-banking/phone/dist/index.html.
4. Register the lb-phone app (optional)
Add an entry to Config.CustomApps['legacy-banking'] in lb-phone/config/config.lua pointing ui at 'legacy-banking/phone/dist/index.html', then restart lb-phone (or the whole server). Optionally drop a 256x256 icon.png into phone/dist/ (or phone/public/icon.png to bundle it at build time) and set the icon field.
In practice this registration also happens automatically at runtime — see
client/phone.lua, which callsexports['lb-phone']:AddCustomApponce lb-phone is detected as started.
5. Start order
Ensure legacy-lib, ox_lib, and oxmysql start before legacy-banking. Within legacy-banking, server/server.lua must load first (it establishes the global LB namespace, LB.Framework, LB.IsAdmin, LB.Push, LB.Webhook) — this ordering is handled by the resource's own manifest, but keep it in mind if you fork the source.
6. Renewed-Banking name collision
This resource calls provide 'Renewed-Banking' and answers exports['Renewed-Banking']:getAccountMoney/addAccountMoney/removeAccountMoney calls for compatibility with resources that expect that resource (qbx_core, qbx_vehicleshop, jg-advancedgarages, lb-phone, lb-tablet, mst_bridge, rcore_casino, vms_housing, etc). Do not run the real Renewed-Banking resource at the same time — you will get a resource-name collision.