SELTENLABS
Documentation

Core modules

What each core module does, why it exists, where it is set up and what it guarantees. Only what is in the code, and honest about the limits.

Documentation sections

Money and games#

Wallet and ledger#

live
What it does
A player has a real wallet and, when a bonus is granted, a bonus wallet. Every movement of money is a transaction made of entries on accounts; on the operator side entries go to service accounts (cashier, games, adjustments, bonuses, payouts pending). Transaction types: deposit, adjustment, bet, win, rollback, hold, release and payout of a withdrawal, grant, conversion and forfeit of a bonus.
Why
One source of truth for money: a balance can always be rebuilt from the entries, and any discrepancy is found by a check.
Where in the interface
Back office: Payments - Ledger; the player card (Finance, Transactions, Rounds). API: /v1/ledger, /v1/players.
Guarantees
  • Amounts are integers in minor units (BIGINT), at most 1015.
  • The entries of every transaction sum to zero; so do all accounts together.
  • A player wallet never goes below zero: a check in the code and a constraint in the database schema. Lack of funds is 402 insufficient_funds.
  • balance_version grows by one on every balance change.
  • The lock order is fixed (wallet, bonuses, round, service accounts): there are no deadlocks.
  • The integrity check (GET /v1/ledger/integrity) recomputes everything on live data: zero sums, a balance that differs from its entries, negative wallets, bonus records that disagree with the bonus wallet.
Limits
  • One ledger and one set of service accounts per currency for all projects; per-project accounts are a later step. A report splits projects by the player of a transaction.
  • There is no real money: a deposit is a demo one, with a daily limit.

Idempotency and rollbacks#

live
What it does
Every money operation has a key: a bet, win and rollback use the pair of provider and transaction_id; a withdrawal and a bonus use a key made of the number and the step (the key shapes are on the figure below); a deposit uses the client key. A repeat with the same parameters returns the original result with replay: true. A rollback of a bet returns exactly what was taken from each wallet. Cancelling a round by staff rolls back all its bets and wins.
Why
The network repeated a request, a provider sent a win twice, an operator clicked the wrong thing: money is never doubled.
Where in the interface
Visible in Payments - Ledger: the transaction statuses posted, rolled_back, tombstone. Cancelling a round: the player card - Rounds, the round_cancel right; API /v1/rounds.
Guarantees
  • The same key with other parameters: 409 idempotency_conflict.
  • A repeated rollback: status already_rolled_back, nothing changes.
  • A rollback before its bet leaves a tombstone (status tombstone, amount 0); the late bet gets 409 transaction_rolled_back and the player is not charged.
  • A rollback of a settled round (a win exists or the round is closed): 409 round_settled. Only a bet can be rolled back (rollback_not_allowed).
  • Cancelling a round requires a reason; wins are reversed first, then bets. When the wallet cannot cover the reversal the cancellation fails.
Limits
  • A repeat is safe only under the same transaction_id. If a provider sends the same bet under a new id, it is a new bet: the provider owns the id.
A money operation with an idempotency keyprovider:transaction_idwithdrawal:id:hold|release|payoutbonus:id:grant|convert|forfeitThe key is newpost it, remember the key200, replay: falseThe key exists, same parametersreturn the original result200, replay: trueThe key exists, other parametersrefuse, change nothing409 idempotency_conflictA rollback is repeatedchange nothingalready_rolled_backA bet after its own rollbackrefuse, do not charge the player409 transaction_rolled_back
What the platform does with an operation by its key: condition, action, result.
A rollback arrives firstrollback tx-1, bet tx-1 is not there yetA tombstonestatus: tombstone, amount 0The bet arrives latebet tx-1The bet is refused409 transaction_rolled_backWithout a tombstone:the bet would go through,the player is charged
The order of events: a rollback arrives before its bet, the platform leaves a tombstone, the late bet is refused.

Game catalogue and providers#

live
What it does
Providers, games and hiding rules are back-office objects, separate in each project. Before any money moves the catalogue decides whether to accept a bet: the provider and the game are active, the caller address is trusted, the bet is within the game's limits, no country or currency restriction applies. The decision is stamped on the round for reports.
Why
The operator decides which games are available to players of which countries and within which limits, and the platform enforces it instead of only displaying it.
Where in the interface
Back office: Games - Game providers, Games, Hiding games by rules; reports Games - Performance, Catalogue health; board: Statistics - Games and providers.
Guarantees
  • Refusals are named by codes: provider_disabled, ip_not_allowed, game_not_found, game_disabled, bet_out_of_range (with the bounds in the answer), game_restricted.
  • The catalogue never refuses a win or a rollback: money owed to a player always goes through.
  • Refusals are counted and visible on the statistics page. The catalogue cache lives at most 30 seconds.
  • A project in the status draft, suspended or archived accepts no bets.
Limits
  • Bet limits are checked in the default currency of the project; in other currencies the check is skipped and counted as a warning.
  • The catalogue today works with the built-in provider selten-mock and the Hub88 and Slotegrator adapters without a contract: details.

Bonuses with wagering#

live
What it does
An offer (a cash bonus) turns into a player record with frozen terms when granted: editing the offer does not change a granted bonus. Money is posted at activation, not at the offer. A bonus is granted by the player (claiming it), by staff or by a deposit: a matching deposit automatically grants one offer (the lowest priority number, then the larger bonus). The wagering target is the bonus and (or) the deposit times a multiplier; stakes use real money first, then bonus money. A win is shared in the proportion of the round's stakes. When wagering is done the balance converts to real money, up to a cap.
Why
A bonus attracts a player, but it must not become a way to withdraw money without playing or a hole in the books.
Where in the interface
Back office: Bonus engine - Cash bonuses, Wagering rules, Forfeiture settings, Granted bonuses; the player card - Bonuses.
Guarantees
  • One bonus is active per player at a time (a unique index in the database); the rest wait as offered.
  • Bonus money cannot be withdrawn until the bonus is wagered. The rounding remainder of a win goes to the bonus share: rounding never creates withdrawable money.
  • The maximum bet applies to every bet while a bonus is active; exceeding it is refused or forfeits the bonus when so configured.
  • A rollback of a bet returns exactly what was taken from each wallet and reverses the wagering progress.
  • A withdrawal request forfeits an active bonus (on by default); a declined withdrawal does not bring it back.
  • The agreement of bonus records with the bonus wallet is checked by the general integrity check.
Limits
  • Not executed: sign-up packages, free spins, bonus codes, the deposit-window period, payment methods of a bonus, comeback discounts, wagering rules for sports. These sections only store settings, see settings sections.
  • A game's contribution to wagering comes from the game fields of the catalogue; the contribution rows of a wagering rule are not evaluated yet (only the rule's maximum bet is used).
  • No message is sent on a bonus grant or forfeit.

Cashier and withdrawal checks#

live (demo), payment systems planned
What it does
A withdrawal request passes through the states requested, in review, approved, paid; or declined, or cancelled. At the request the amount is held from the balance at once; a decline or cancellation returns it and a payout moves the held money to the cashier. The request is checked by the enabled check rules at creation and again at approval. There are no payments to an outside system: a payout in the demo is the posting itself.
Why
A withdrawal is where a platform loses money if it errs. Checks and a hold give a person time to decide and keep money from leaving twice.
Where in the interface
Back office: Payments - Deposits, Withdrawals, Ledger; settings in the Payments group: Withdrawal checks, Payout settings, Payment methods, Withdrawal decline reasons.
Guarantees
  • Every transition runs under a lock on the request; each posting and state change is one database transaction.
  • A repeated request with the same key creates no second one; the same key with other parameters is 409.
  • A rule's result is pass, fail, manual review or not available. A rule without a data source answers not available, never pass. Only a failed rule with the action block stops a request (409 risk_blocked); manual review sends it to a person.
  • Approving a withdrawal despite a failed blocking check takes the separate right withdrawals_override.
  • The person who approved a withdrawal cannot pay it.
  • Payout details are stored masked (the last four characters).
Limits
  • Data exists for seven checks: an active bonus, wagering of the deposit, open rounds, an unverified identity, an amount threshold, the frequency of requests, a country that does not match the method. For six (account not verified, duplicate accounts, a new account, responsible-gaming limits, AML lists, a manual flag) there is no data source yet.
  • Auto-payout (on or off, the maximum amount, the daily total) fires only when every check passes and the request is in the default currency of the project.
  • There are no payment providers: details.

People, access and outside services#

KYC#

in progress
What it does
A case of an identity check: a level (identity, address, source of funds), a provider, a status (pending, in review, approved, rejected, cancelled) and documents. The decision comes from the vendor (a webhook or a poll) or from staff and is the only thing that changes the player's verification mark (none, in review, verified, rejected). The provider is chosen explicitly or as auto, which uses routing.
Why
Verification is needed for withdrawals and by regulator requirements; a case gives one trail of the decision whoever made it.
Where in the interface
Back office: Players - KYC; the player card - Verification. API: /v1/kyc. A vendor calls /api/hooks/kyc/{code}.
Guarantees
  • One open case per player and level.
  • A webhook is accepted only with the vendor signature; a repeat of the same status changes nothing.
  • Creating a case is safe for the cascade: before the player is sent anywhere any failure moves the request to the next vendor (the safe rule). The chosen provider and every attempt are stored in the case.
  • A case event goes to the event bus; a decision triggers a message to the player when a template exists.
  • A player's verification changes only through a case decision; a case without documents cannot be approved by hand.
Limits
  • The outside vendor (Sumsub) has no contract and no keys: the adapter exists, there has been no live check. The built-in manual check and the sandbox work.
  • The sandbox approves test players at once and sends the rest to manual review; it is not meant for real players.

Messaging#

live
What it does
A template becomes a message to one recipient (a player or a staff member); the message gets its fate at once: queued, suppressed with a reason, or failed with an error code. The sender is chosen by rules; when routes are set for the channel, a failure moves the message to the next one. Channels: email, SMS, push, Telegram. System events trigger messages: block and unblock, an identity check result, a staff password change, a sign-up confirmation.
Why
A message goes to a living person and cannot be recalled. So the platform protects the person first and delivers second.
Where in the interface
Back office: Templates - Message queue, Send; templates, senders and sender rules are in the same group. API: /v1/messages.
Guarantees
  • Silent mode is on by default: everything except test messages is suppressed. Switching on real delivery takes the separate right messaging_launch.
  • Marketing never goes to a blocked player, a test player or a player without consent; system messages need no consent.
  • At most five messages per recipient and channel per hour (configurable).
  • Test messages reach only test players and staff: they cannot be used to bypass silent mode.
  • The dedupe key is unique: one event never yields two messages. A failed send is retried after 1, 5 and 30 minutes and the fourth failure is final.
  • When the outcome of a send is unknown (the connection dropped after sending), the next sender is not tried: the message may have gone out. It waits for the usual retry.
Limits
  • The sender adapters (SMTP, an HTTP SMS gateway, a Telegram bot) are written but nothing is delivered live through them: the platform is in silent mode and there are no contracts or keys. Details.
  • There are no messages on a bonus grant or forfeit.

Rights and roles#

live
What it does
A right is written section:level; levels: view, edit (includes view), grant (the right to give this right to others). Rights come from a preset (a role; a person may have several) and personal assignments. The sign * in a preset is a master administrator: everything, including rights added later. Money actions may carry a limit per currency (a manual balance correction). Sign-in: an Argon2id password and a mandatory TOTP, protection against request forgery (CSRF).
Why
Everyone sees and changes only their own area and answers for their actions: the log and the history keep who did what.
Where in the interface
Core: Access - Accounts, Right presets, Change history, Action log, Invitations.
Guarantees
  • Rights are checked on the server on every request, not only hidden in the interface.
  • One cannot give more than one holds: the right being given requires the level grant.
  • A staff bonus grant has a per-currency limit; manual balance corrections have a daily cap.
  • The log records only the fact that a personal field changed, never the value.
  • Settings sections keep every change with a mandatory comment and allow a revert to a version; staff actions are written to the log.
  • Network access: a policy may require a VPN at sign-in and allow sign-in only from listed addresses. A failure of the VPN connector does not lock sign-in: the address list works. A master administrator's break-glass login is written to the log.
Limits
  • Country-based access settings are stored but not executed: they need IP geolocation.

Projects by geo#

live
What it does
A project is a market on the shared platform: a code, a name, a region, a status (draft, active, suspended, archived), a default currency and a list of currencies, languages, allowed and restricted countries, a time zone, player domains. A project has its own settings, game catalogue, templates, check rules and players with everything attached to them (wallet, withdrawals, bonuses, KYC cases, messages). LATAM, DACH and Australia exist as configuration and are not launched.
Why
One operator works in several markets with different currencies, languages and rules without a separate platform for each.
Where in the interface
There is no project selector screen in the interface yet. Projects are managed through the core API (/api/admin/projects, the projects right); the project of a request is set by the X-Project header.
Guarantees
  • A project is never deleted, only archived; the default project selten cannot be archived, nor can a project with open withdrawals.
  • A player gets the project of the invitation and never moves between projects; the currency must be one of the project's list.
  • In a draft and a suspended project players cannot register or bet, while wins and rollbacks of bets already accepted still go through: what is owed to a player is never refused. An archive is read-only.
  • A staff member's access is limited to the list of their projects; a master administrator sees all.
Limits
  • The ledger and the service accounts are shared by all projects; a report splits projects by the player of a transaction.

External API keys#

live
What it does
A key slk_... opens the /v1 operations to an operator's outside system: with its own rights, projects, lifetime and a mandatory IP allowlist. A key has a service account.
Why
An operator's integration should not run under a person's account and should not be able to do more than it needs.
Where in the interface
Core: Access - API keys (the api_keys right): issue, change, new secret, revoke.
Guarantees
  • The secret is shown once; only the hash is stored; a lost key is rotated.
  • Checks on every call, bypassing the session cache: a revocation, a new allowlist or a changed right takes effect from the next request.
  • A key reaches only the paths of the published part of the API; staff management, integrations, network, mirror and the owner console are out of reach.
  • A key never carries * or grant rights, nor the rights to create money or bypass a person's decision.
Limits

Integration hub and cascade#

live, adapters verified on stubs
What it does
A single contract for every outside service: a description, config and secret fields, a health check, the methods of its kind. Secrets are encrypted (AES-256-GCM) and never returned to the client. Every exchange is written to the exchange log. Several connectors of one kind can be kept at once: routes decide who serves a request and in which order.
Why
A primary vendor goes down, errs or gets blocked. Every category needs a fallback, and the choice between them must be explainable and safe for money.
Where in the interface
Core: Owner - Integrations (keys, check, state, exchanges), Vendors, How the platform works. Routes and the cascade are set through the core API (/api/admin/integrations/routing, the rights integrations:view and integrations:edit): there is no routes screen yet.
Guarantees
  • The cascade never repeats an action with an outside effect: it stops on an unknown outcome. The rule and the figure: cascade and routing.
  • Internal network addresses are refused (except monitoring and network tools); when an address changes, the keys must be entered again.
  • Every attempt and every change of a circuit breaker is written to the log and the event bus.
  • Saving a route list requires a comment and is written to the action log with the state before and after.
Limits
  • Routing is wired to KYC case creation and to messaging. For payments, games, proxy and VPN rules can be saved and simulated, but the platform does not consume them yet.

Data and reliability#

Kafka event bus: outbox and topics#

live
What it does
An event is written to a queue table in the same transaction as the change, and a separate process publishes it to Kafka. Six topics: ledger (6 partitions), players, staff actions, back-office objects, KYC, integrations (3 each). An event carries an id, a type, a time, a key and data.
Why
Other systems (analytics, anti-fraud, notifications) learn about money and decisions without polling the database, and never get an event about something that did not happen.
Where in the interface
Core: Owner - Kafka event bus (topics, the queue, publishing errors).
Guarantees
  • An event is committed or rolled back together with the business change: there is no event without a change and no change without an event.
  • Delivery is at least once; a consumer drops repeats by id. The order in the queue is kept.
  • The publisher is an idempotent producer with acknowledgement by all replicas (acks=all).
Limits
  • Kafka is optional: without it the platform works and events wait in the database queue. Published queue records are kept for seven days.

Valkey: limits, session cache, cascade#

live
What it does
A shared fast layer between the platform processes. Three uses: request-limit counters (sign-in per address and per name, session requests, API-key requests), the shared state of the cascade circuit breakers, a short (30 second) cache of staff sessions.
Why
Several processes must count limits and failures together and not each by itself, or a limit can be bypassed and the cascade decides on partial data.
Where in the interface
There is no separate screen. The state (latency, memory, cache hits and misses, refusals by a limit, errors) is visible on the system map in the owner console, the Valkey node.
Guarantees
  • Money, the ledger, bet idempotency, sessions as a source of truth and the event bus do not go through Valkey: all of it is in PostgreSQL.
  • The session cache never outlives a change: any edit of sessions, accounts, presets or rights invalidates every copy in every process at once. The password hash and the 2FA secret never reach Valkey.
  • An unavailable Valkey does not break the platform: a call returns no answer, the layer switches off for a few seconds, and the process memory decides the limit. "Let everyone in" is never the fallback.
Limits
  • Valkey is disposable: without it (REDIS_URL empty) the platform works as before. There are no catalogue or lobby caches in Valkey.

Mirror#

in progress
What it does
A warm standby in another datacenter: PostgreSQL streaming replication (physical, asynchronous) and the same platform services in standby mode: they read, and any write is refused (mirror_standby). A signed exchange of state runs between the sites; the platform shows a verdict (ok, lagging, versions diverged, disconnected, not configured, split brain) and a seven-day history.
Why
If the primary site is down, the operator has a copy of the data to continue from instead of restoring from scratch.
Where in the interface
There is no screen yet: the state is served by the core API (GET /api/admin/mirror, the check POST /check, history, the mirror right) and shown by the owner console on the system map.
Guarantees
  • Switching is manual and deliberate: there is no automatic one and there must not be, so that both sites never accept writes at once.
  • Replication is protected by TLS with server-name verification; a cap on retained log sits next to it so that a dead mirror cannot fill the primary's disk.
Limits
  • The second server is not running: the verdict is not configured by default and no mirror code runs. The capability and the status are built.
  • Replication is asynchronous: the last moments before a failure of the primary can be lost at promotion. Backup dumps and the Kafka history do not move to the mirror.

Monitoring#

live
What it does
Four layers. Health checks of each integration and a log of its exchanges. The owner console: load per module by the minute for a day and the system map with its flows. Uptime Kuma is connected as an integration: the state of the watched services and the public status page. Selten Guard looks at the platform from outside.
Why
Seeing a failure before a player does and telling the platform being down from a vendor being down.
Where in the interface
Core: Owner - System map, Everything that moves, Integrations; Access - System status. Public: status.seltenlabs.com. From outside: guard.seltenlabs.com.
Guarantees
  • Request metrics are counted over all platform processes, so the console shows the same figures whichever process answers.
Limits
  • The sections Mirror domains and Monitoring notifications store settings that the platform does not execute. No alert channels are connected.

Settings sections: what is executed, what is only stored#

Almost the whole back office is described declaratively: from a section's description the engine builds the menu, the list, the form, validation, rights, a change history with a mandatory comment, a revert to a version and a CSV export. But describing a section does not mean executing its settings. The honest picture today:

SectionsWhat happensWho uses it
Cash bonuses, Wagering rules (maximum bet only), Forfeiture settingsexecutedthe bonus engine
Game providers, Games, Hiding games by rulesexecuteddecision on every bet
Withdrawal checks, Payout settings, Payment methods, Withdrawal decline reasonsexecutedthe cashier
Templates (email, SMS, push, Telegram, system), Senders, Sender rulesexecutedmessaging
Staff access policy, Allowed staff IPs, Staff VPN profiles, Player tagsexecutedstaff sign-in, players
Sign-up packages, free spins, free bets, cashback, rebate, lossback, reload bonuses, bonus codes, referrals, campaigns, event chains, coinsstored onlysettings with history, served through the API
Tournaments, lotteries, streamer tools, loyalty levelsstored onlythe same
Lobby, content, registration, SEO, page templatesstored onlymeant for the player product, which is not published
Segments and duplicate-account rules, trust presets, responsible gaming, currency rates, AI connections, billingstored onlythe same

A stored-only section does no harm: the values, the history and the rights already work, and the API serves them. Execution is wired in as the stages progress; until then do not assume the platform pays cashback or runs a tournament by itself.