Stock Master Tracker docs
v2.0.0
Get help
● Set up · The admin

Operator console
run the app without code.

A small Node server you host yourself. It writes your app's configuration to Firestore, keeps your keys encrypted, and adds pages for users, alerts, push campaigns, news and revenue.

MIKODES Admin KitOwner · manager · viewerAudit log

011. Run it

The console reaches Firebase with the Admin SDK on the server; the browser never talks to Firestore. You need a service-account key of your Firebase project (Project settings → Service accounts → Generate new private key).

VariableMeaning
GOOGLE_APPLICATION_CREDENTIALSPath to the service-account key. Leave it empty on Cloud Run or Compute Engine to use the attached service account.
FIREBASE_PROJECT_IDOptional; set it when the credentials do not name the project.
ADMIN_SECRET_KEY32 random bytes as hex. Encrypts the secrets the console stores. Back it up: without it the stored secrets cannot be read. Without it the console generates data/.admin-secret-key and warns.
PORTDefault 8790.
DATABASE_URLOptional Postgres for the console's own data (team, sessions, settings, audit) instead of the file data/admin.sqlite.
FIRESTORE_EMULATOR_HOSTLocal development against the Firestore emulator (for example 127.0.0.1:8080), no credentials needed. Never set it on a production host.
ADMIN_DATAsample = built-in sample data, no Firebase. Empty = Firestore. Never on your real install.
ADMIN_DEMO_PASSWORDOnly for a public read-only demo host.

Copy admin/.env.example to admin/.env and fill in the lines you need (the console reads it if present):

cd admin
npm ci
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"   # copy the output
# create admin/.env with:
#   ADMIN_SECRET_KEY=<the hex string>
#   GOOGLE_APPLICATION_CREDENTIALS=/full/path/to/service-account.json
npm start        # http://localhost:8790/admin
The service-account key is powerful

It bypasses Firestore security rules. Keep it only on the console's server, never in the app, in git or in a support message.

022. Create the owner

On the first start the log prints a one-time setup code. Open /admin, choose Create the owner, and enter the code, your e-mail and a password of 12 or more characters. A start before the owner exists prints a new code; any printed code works. Add managers and viewers under Team.

  • Roles: viewers read; managers act on the product pages and change settings; only the owner sets secrets, store identifiers and the display-licence confirmation.
  • Every write is in the kit's append-only audit log.

033. What to fill in, in order

  1. LegalPrivacy and terms URLs (required by the stores), the disclaimer and the labels.
  2. BrandApp name and support e-mail.
  3. Market dataKeys, routing, budgets, SEC contact, then the display-licence confirmation (Market data).
  4. News sources, AI summaries (optional).
  5. Money sections only when you are ready: Ads, ad ids, Pro and purchases, Affiliates, Sponsored.
  6. StatusShows what is still missing.
The console Status page
Status shows what is still missing

04Settings sections

SectionWhat it controls
BrandApp name and support e-mail. The app name is the app's title, the Pro screen title and the About page. (The accent colour field is stored; the app's colours come from the code: Rebranding.)
LegalTerms and privacy URLs, disclaimer, the labels "AI-generated", "Automatic summary", "Sponsored", "Affiliate link".
FeaturesPortfolio, alerts, news, AI, widgets, cloud backup, earnings calendar, SEC filings. A switched-off feature disappears from the app.
Sign-in methodsGoogle, Apple, e-mail buttons.
MarketRefresh interval, the index strip (SYMBOL|Label), featured tickers.
Market dataDisplay licence, Finnhub and Twelve Data keys, routing, budgets, cache, SEC contact.
News sourcesRSS feeds, refresh, retention.
AI summariesProvider, key, model, caps, per-user allowances.
Ads, AdMob / AppLovin MAX / Unity Ads / ironSource LevelPlay idsWhich network, which placements, your ids.
Pro and purchasesPro on/off, limits, perks, product ids, store verification.
Affiliates, Sponsored slotsLabelled partner links and sponsored tickers and news.
Ad revenue reportingOptional reporting keys.

Every number has a hard minimum and maximum. Invalid list lines (a news source without a URL, a waterfall naming a network without that format, a sponsored slot ending before it starts) are skipped, never guessed; Status lists every skipped line. Money switches default to off, and an untouched console writes exactly what the backend already falls back to.

05Product pages

PageWhat you see and do
OverviewReal counts only: users, active and new today, Pro users, active alerts, alerts triggered and AI calls today, provider usage this month.
Revenue centreMeasured revenue only; see Revenue centre.
UsersSearch by user id (users sign in anonymously). Grant Pro until a date or for life, revoke a console grant, add or remove AI credits, grant remove-ads, ban or unban. Every action needs a reason and is audited.
AlertsActive alerts by type and ticker, triggers in the last 7 days. Disable sets one alert inactive; the console never edits or deletes a user's alert otherwise.
Sponsored campaignsSponsored tickers and news with schedule, impressions and clicks (Affiliates and sponsored).
Affiliate clicksTaps per broker link.
Push campaignsCreate, schedule and cancel (Alerts and push).
NewsNewest stored headlines and the last item per source.
Provider usageCalls, credits and errors for Finnhub, Twelve Data and SEC EDGAR per month.
StatusFirestore reachable, last config sync, display licence, each key, SEC contact, AI key, each RSS feed, ad ids for what is on, store verification, ad reporting, revenue events without an amount, legal URLs.
The console Overview page
Overview
The console Users page
Users
The console Provider usage page
Provider usage

06What the console never does

  • It never writes a field the backend owns (proStore, alertsCount, stats, purchases, providerUsage, newsItems, briefs, stockReports, usage) and never creates a store revenue event.
  • It never sends a push message itself and never deletes a user's alert.
  • It never estimates revenue, converts currencies or shows a projected earning.
  • It never shows a saved key again and never puts one in config/public.

07Secrets at rest and the key

Keys you enter (market data, AI, store verification, ad reporting) are encrypted with ADMIN_SECRET_KEY, written only to config/private and never sent to the browser. If you lose ADMIN_SECRET_KEY or change it, the stored secrets cannot be decrypted: enter them again. Back up data/ and the key together. If ADMIN_SECRET_KEY is unset the console generates data/.admin-secret-key; back that file up too.

08Where to host it

  • Any Node host (VPS, Render, Railway, Fly, a container): npm ci && npm start. Put data/ on a persistent disk and back it up with the key. Run one instance.
  • Docker: docker build -t stockmaster-admin . && docker run -p 8790:8790 -v stockmaster-admin-data:/app/data --env-file .env stockmaster-admin. Mount the service-account file into the container and point GOOGLE_APPLICATION_CREDENTIALS at the path inside it.
  • Serverless or several instances (Cloud Run with autoscaling): set DATABASE_URL to a Postgres database (pooled URL with sslmode=require) and ADMIN_SECRET_KEY. On Cloud Run attach an account with the Cloud Datastore User role and leave GOOGLE_APPLICATION_CREDENTIALS empty.
  • HTTPS in front of it (reverse proxy or platform TLS). The session cookie is marked Secure over HTTPS and the server honours x-forwarded-proto.
  • Compiled build: npm run build && npm run start:dist.

09A public read-only demo console

To publish a console that needs no Firebase, set ADMIN_DATA=sample and ADMIN_DEMO_PASSWORD=<a password you publish>. Visitors sign in as demo@stockmaster.demo, a viewer; every write answers 403. The sample users, alerts and campaigns are labelled "Sample", and the sample has no revenue, no news and no provider usage.