---
title: Doctor
description: Run after installation to verify your setup. API keys, database, and FX cache. Prints a fix command for anything that's missing.
---

export const checks = [
  { cmd: 'Finnhub API key',   desc: 'Required for price sync, news, insider, earnings, financials' },
  { cmd: 'FRED API key',      desc: 'Required for macro, stress index, regime, and FX history' },
  { cmd: 'Display currency',  desc: <>USD by default. Change with <code>firma config set currency KRW</code></> },
  { cmd: 'Transactions',      desc: 'Count of recorded transactions and current holdings' },
  { cmd: 'Balance entries',   desc: 'Monthly net worth snapshots. 0 means no wealth history yet' },
  { cmd: 'Cash flow entries', desc: 'Monthly income/expense records' },
  { cmd: 'FX rate cache',     desc: <>Row count, currencies, and date span. Populated by <code>firma sync fx</code></> },
];

export const optionsRows = [
  { cmd: <code>firma doctor</code>,        desc: 'Human-readable output with fix suggestions' },
  { cmd: <code>firma doctor --json</code>, desc: <>Machine-readable output. Each check includes <code>status</code>, <code>detail</code>, and <code>fix</code></> },
];

<Section label="firma doctor">
Runs seven checks in order. Each row shows a status indicator, what was
checked, and what was found. When everything is green, you're ready.

<div className="terminal">
  <div className="terminal-line">
    <span className="term-prompt">$</span>
    <span className="term-cmd">firma doctor</span>
  </div>
  <table className="term-table">
    <tbody>
      <tr className="sep"><td colSpan={3}/></tr>
      <tr><td className="td-green">✓</td><td>Finnhub API key</td><td className="td-muted">set</td></tr>
      <tr><td className="td-green">✓</td><td>FRED API key</td><td className="td-muted">set</td></tr>
      <tr><td className="td-green">✓</td><td>Display currency</td><td className="td-muted">KRW</td></tr>
      <tr><td className="td-green">✓</td><td>Transactions</td><td className="td-muted">117 recorded · 4 active holdings</td></tr>
      <tr><td className="td-green">✓</td><td>Balance entries</td><td className="td-muted">36 entries</td></tr>
      <tr><td className="td-green">✓</td><td>Cash flow entries</td><td className="td-muted">36 entries</td></tr>
      <tr><td className="td-green">✓</td><td>FX rate cache</td><td className="td-muted">9525 rows · 8 currencies · 2018-08-28 → 2026-04-17</td></tr>
      <tr className="sep"><td colSpan={3}/></tr>
    </tbody>
    <tfoot>
      <tr><td className="td-muted" colSpan={3}>All systems ready. Run `firma brief` for a daily snapshot.</td></tr>
    </tfoot>
  </table>
</div>
</Section>

<Section label="When something is missing">
Any failed check prints a <code>→</code> fix command directly below it.
Address each one, then re-run <code>firma doctor</code> to confirm.

<div className="terminal">
  <div className="terminal-line">
    <span className="term-prompt">$</span>
    <span className="term-cmd">firma doctor</span>
  </div>
  <table className="term-table">
    <tbody>
      <tr className="sep"><td colSpan={3}/></tr>
      <tr><td className="td-green">✓</td><td>Finnhub API key</td><td className="td-muted">set</td></tr>
      <tr><td className="td-orange">✗</td><td>FRED API key</td><td className="td-orange">not set</td></tr>
      <tr><td/><td colSpan={2} className="td-muted">→ firma config set fred-key &lt;key&gt;</td></tr>
      <tr><td className="td-green">✓</td><td>Display currency</td><td className="td-muted">USD (default)</td></tr>
      <tr><td className="td-orange">✗</td><td>FX rate cache</td><td className="td-orange">empty</td></tr>
      <tr><td/><td colSpan={2} className="td-muted">→ firma sync fx</td></tr>
      <tr className="sep"><td colSpan={3}/></tr>
    </tbody>
    <tfoot>
      <tr><td className="td-muted" colSpan={3}>2 issues found. Fix them and re-run firma doctor.</td></tr>
    </tfoot>
  </table>
</div>
</Section>

<Section label="Checks">
  <CommandTable rows={checks} />

  <Note>
    <code>firma doctor</code> reads the database. It never writes or modifies data.
    Re-run it any time after changing config or running a sync.
  </Note>
</Section>

<Section label="Options">
  <CommandTable rows={optionsRows} />
</Section>
