Repository navigation
Bridge Integration
M3rcena edited this page Nov 1, 2026
·
3 revisions
This guide details how @m3rcena/eco connects with @m3rcena/bridge to power real-time web dashboards, headless banking operations, and canvas card generation.
Connecting @m3rcena/eco to @m3rcena/bridge is done in one line:
import { M3rcenaBridge } from "@m3rcena/bridge";
import { EcoManager } from "@m3rcena/eco";
export const bridge = new M3rcenaBridge();
export const eco = new EcoManager({
bridge,
database: "sqlite",
});export const bridge = new M3rcenaBridge();
export const eco = new EcoManager();
bridge.use(eco);Both patterns automatically register the /api/eco gateway routes and establish the bidirectional state synchronization handshake.
When mounted on @m3rcena/bridge, the economy engine automatically exposes the following REST routes:
| Method | Endpoint | Description | Query / Body Parameters |
|---|---|---|---|
GET |
/api/eco/account/:userId |
Get full user account ledger (wallet, bank, net worth, vault, credit score). | None |
GET |
/api/eco/cards/debit/:userId |
Returns rendered PNG buffer of user's holographic debit card. | ?bankName=... |
GET |
/api/eco/market/overview |
Returns live prices and 24h metrics for all stocks and crypto. | None |
GET |
/api/eco/market/chart/:symbol |
Returns rendered PNG sparkline / candlestick chart buffer. | None |
GET |
/api/eco/leaderboard |
Returns top accounts ranked by net worth, wallet, or bank. | ?sortBy=netWorth&limit=10 |
GET |
/api/eco/vault/:userId |
Returns current bank vault tier and upgrade pricing. | None |
GET |
/api/eco/loans/:userId |
Returns FICO credit score, active debt, and loan offers. | None |
GET |
/api/eco/bills/:userId |
Returns pending municipal utility bills and wealth taxes. | None |
POST |
/api/eco/action/transfer |
Execute peer-to-peer money transfer. | { toUserId, amount } |
POST |
/api/eco/action/gamble |
Place bets on coinflip, slots, dice, or roulette. | { game, amount, choice } |
POST |
/api/eco/action/trade-stock |
Execute stock/crypto buy or sell orders. | { symbol, shares, action } |
The bridge dispatches audio cues to web dashboards when financial events take place:
| Sound Key | Trigger Event | Target Audience |
|---|---|---|
coin_drop |
Cash earned from work, beg, crime, or daily claims. | Specific User |
cash_register |
Shop item purchases and bill settlements. | Specific User |
jackpot |
Slot machine 50x Mega Jackpots. | All Online Users |
alarm |
Bank robbery attempts and syndicate heists. | Specific / Target |
upgrade_ding |
Bank vault tier upgrades and job promotions. | Specific User |
import { createBridgeClient } from "@m3rcena/bridge/client";
const client = createBridgeClient({
url: "ws://localhost:3001/bridge",
userId: "web_admin_1",
});
// Listen for audio cues
client.onAudioCue((cue) => {
if (cue.soundKey === "coin_drop") {
new Audio("/sounds/coin.mp3").play();
}
});
// Listen for real-time economy events
client.onAction((action) => {
if (action.module === "eco") {
console.log(`Financial event: ${action.action} by ${action.playerId}`);
}
});
Built with β€οΈ by M3rcena Development β’ @m3rcena/eco v14.28.1 β’ Licensed under Apache-2.0
GitHub: M3rcena/m3rcena-eco β’ NPM: @m3rcena/eco
GitHub: M3rcena/m3rcena-eco β’ NPM: @m3rcena/eco
- Bank Vaults & Compound Interest
- FICO Credit Scoring (300-850)
- Bank Loans & Debt
- Municipal Utility Bills
- Progressive Wealth Taxes & Evasion
- Interactive Blackjack Table
- Slot Machine (50x Mega Jackpot)
- European Roulette
- Crash Multiplier Simulator
- Coinflip & Dice
- Simulated Stock & Crypto Exchange
- Multiplayer Syndicate Heists
- Companion Pets & Foraging
- Mystery Loot Crates
- Dashboard Bridge Integration
- Weky Minigames Integration
- Complete REST API Reference
- Scoped Audio Cues Table