# api.stockprices.com — repo context

> Curated overview for code_search. Source: `bitbucket_server:AD/api.stockprices.com` (Bitbucket, project AD). CodeIgniter 4 REST API / PHP. Default branch `master`.

## Purpose
The **StockPrices.com backend REST API** — the server behind the `ui.stockprices.com` web UI and the companion mobile apps. CodeIgniter 4 JSON API with JWT auth. It **owns the user-domain data** (auth, subscriptions, watchlists, portfolios, alerts, notifications, devices) in MySQL; market/stock/crypto quotes are pulled from upstream data providers and re-served through these endpoints.

## Structure
- `html/` — CI4 app (web root `html/public/`). `app/Controllers/` = the API surface (map below), `app/Config/Routes.php` = the route groups, `app/Models/` = the owned data models. `html/system/` = framework (ignore).
- Auth is a JWT `auth` route filter; protected groups include `user`, `user/watchlist`, `portfolio`, and parts of `subscription`.

## API surface (controller → area)
- **Auth** — `AuthController`: signin, signup, social-signin, forgot-password, verify-account.
- **Market overview / snapshots** — `MarketController`: gainers/losers, trending/most-active/penny/dividend/top-yielding stocks, earnings calendar, upcoming events, announcements, dividends, dashboard, batch quotes, heatmap, sector/fixed-income lists; snapshots for US / world / commodities / futures / treasuries.
- **Stocks / tickers** — `StocksController` (+ `SearchController`, `WidgetController`, `ChartController`): price info, key ratios, peer comparison, about, intraday quotes, price-target summary/consensus, technical indicators, earnings summary, holders (institutional/insider/politician), historical, analysis + reports, search, compare, chart, ETFs, quarterly financials, quotes-with-fundamentals, ticker search.
- **Crypto** — `CryptoController`: list, quotes (short/batch), historical (light/full), chart, latest news, mobile lists.
- **Finance / politicians** — `FinanceController` (prediction markets, crypto news, dashboard, earnings calendar), `PoliticiansController` (senate/house trading + disclosures + by-symbol/name search).
- **Content** — `ArticlesController` (articles, articles-for-you, expert-opinions, stock-market-sectors, expert-analysis — detail + listings + search), `NewsController` (news / all-news).
- **User domain (JWT-protected)** — `UserController` (profile, change password, invoices), `WatchListController`, `PortfolioController`, `TopPicksController` (top picks + preferences + history), `SubscriptionController` (create/cancel, billing history, webhook events), `AlertController` + `NotificationController` (stock alerts + notifications), `ShopController` (homepage/search/product).
- **Infra** — `StockAlertCron` (`/cron` alert job), `DeviceController` (`/register-device` push tokens), `CapiController` (`/capi/event` conversions API), `Home` (`/`, `/console`).

## Models (MySQL, owned here)
`AuthModel`, `UserPortfolioModel`, `SubscriptionModel`, `AlertModel` / `StockAlertModel`, `NotificationModel`, `UserDeviceModel`, `ShopModel`, `CommonModel`.

## Search notes
- This is the **backend/API**; the matching UI is `ui.stockprices.com` (which proxies here). Endpoint logic is in `html/app/Controllers/*`; owned data models in `html/app/Models/*`.
- Ignore `html/system/` (framework) and any `vendor/`.

## Tech
CodeIgniter 4 · PHP · MySQL · JWT auth. Related: `ui.stockprices.com` (UI), `stockprices.com`, `rsoc.stockprices.com`.
