# KTW ECS — Economy Control System
**Stop guessing what your economy is doing. See it, measure it, and fix it — live, from in-game or your browser.**
ECS is a complete economy analytics and rebalancing suite for FiveM. It reads every player's cash and bank straight from your database and turns it into a real-time picture of your server's economy: who holds the money, how unequal it's getting, whether you're inflating, and where new money is entering. Then it gives admins the tools to act on it — tax, stimulus, decay, scale — with a full audit trail and one-click undo on every action.
Built for **QBCore, QBX, Ox Core, and ESX** (auto-detected). No SQL file to import — ECS builds its own tables on first start.
---
## 📊 Real-Time Economy Overview
- **Total economy** at a glance — cash vs bank split, updated live.
- **Gini coefficient** with plain-English rating, so you instantly know if your economy is healthy or dangerously top-heavy.
- **Wealth concentration** — exactly how much the top 10%, middle 40%, and bottom 50% hold.
- **Player activity** breakdown — active, dormant, and inactive accounts.
- **Daily economy trend chart** — watch total money, inequality, and player count move over time and catch inflation before it's a problem.
- **Health indicators** — stagnation, inflation pressure, affordability, middle-class health, and hoarding risk, each with configurable warn/critical thresholds.
## 🏦 Wealth Classes
- Fully **configurable wealth tiers** (names, thresholds, colors) — **edited live in-game**, no config file edits needed.
- See the **distribution of players and wealth** across every class.
- Distribution summary: total, average, and median wealth, plus which class holds the largest share.
## 🔍 Player Analysis
- **Searchable, ranked** per-account breakdown with cash/bank split and character counts.
- Per-player **operation history** — see exactly how every rebalance touched any individual.
## ⚖️ Rebalance Operations
Every operation shows a **full preview** of who's affected and by how much before you commit, and **every run is logged and reversible**.
- **Global Scale** — proportionally adjust all balances to deflate or reset inflation, with a preserve-minimum floor.
- **Tax Return** — targeted stimulus paid to the wealth classes you choose.
- **Daily Auto-Tax** — an automatic, scheduled progressive tax that runs on a timer; fully editable in-game and database-backed so it survives restarts.
- **Dormant Decay** — reclaim wealth from long-inactive players while leaving active ones untouched.
- **Progressive Tax** — tiered, bracket-based taxation, just like real income tax.
## 🕓 Audit Log & One-Click Rollback
- Every operation is written to a **complete audit history** with executor, scope, and impact.
- **Roll back any operation in one click** — balances are restored from an exact pre-operation snapshot.
- Configurable rollback window.
## 💸 Money-Source Attribution
- See **where new money enters your economy**.
- **Automatic capture** on QBCore/QBX, plus simple exports to log income or payments from any of your own scripts.
- Ignore-list support so transfers and withdrawals don't pollute the picture.
## 🌐 Web Dashboard (Browser Access)
Manage your economy **from a web browser** — phone or desktop — without launching the game. Served by the resource itself over your existing server port. Off by default, opt-in.
- **Password-protected sign-in** with brute-force lockout.
- **Two access tiers:** a view-only password for read-only access, and a *separate*, opt-in admin password that unlocks full control. Read-only by default — write access is never on unless you deliberately enable it.
- **Fully responsive** — clean layout on desktop and mobile.
- **Audit-safe** — web actions are logged just like in-game ones.
- **HTTPS-ready** — auto-secures session cookies behind a reverse proxy.
## 🔔 Discord Integration
- Optional **webhook alerts** for operations and rollbacks.
## 🖥️ Clean, Purpose-Built Interface
- A **distinctive dark console UI** built specifically for ECS — dense, fast, and readable at a glance, not a recycled template.
- **Monospace data** and a clear cyan / amber / red health language, so the state of your economy reads instantly.
- The **same polished look in-game and in the browser** — one design, everywhere.
---
## ✨ Built Right
- **In-game configurability** — wealth classes and auto-tax are edited from the dashboard, so day-to-day tuning never touches a config file.
- **Framework auto-detection** — QBCore, QBX, Ox Core, or ESX, no setup.
- **No SQL import** — tables are created automatically.
- **Clean integration exports** for hooking ECS into your own economy and money scripts.
- **Permission tiers** — full admins and read-only viewers, keyed off player identifiers.
- **Secrets stay server-side** — admin list, Discord webhook, and web passwords live in a server-only config (or `server.cfg` convars), so they're never shipped to clients or exposed to resource dumpers.
---
## Requirements
- QBCore, QBX, Ox Core, **or** ESX
- [ox_lib]
- [oxmysql]
## Installation
Drop it in, add three identifiers to the admin list, `ensure ecs`. Full setup guide and the web-panel walkthrough are included in the README.
---
*Manage your server's economy like it's a real one.*