diff --git a/CLAUDE.md b/CLAUDE.md index 5f77c67..0632786 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,10 +2,30 @@ ## Hosting & URLs -- Docs site is hosted on **Vercel** at `docs.marketdata.app` -- Cloudflare rules proxy it to the public URL: `www.marketdata.app/docs/` -- Staging is at `docs-staging.marketdata.app` → `www.marketdata.app/docs-staging/` +- Docs site is hosted on **Cloudflare Pages** with a **Cloudflare Worker** reverse proxy +- Worker (`worker/`) proxies `www.marketdata.app/docs/*` → `marketdata-docs.pages.dev` +- Staging: `www.marketdata.app/docs-staging/*` → `marketdata-docs-staging.pages.dev` +- CI/CD: GitHub Actions (`.github/workflows/deploy-docs.yml`) builds Docusaurus, restructures output to match URL paths, and deploys to Cloudflare Pages + Worker via Wrangler +- Build output is restructured in CI to nest under `docs/` or `docs-staging/` so static files serve from correct paths without rewrite rules +- Edge caching enabled on Worker subrequests; `_headers` file generated in CI for asset cache control + +## Workflow + +- Work on the **staging** branch, verify changes at `www.marketdata.app/docs-staging/` +- Once verified, open a PR from `staging` → `main` and merge to deploy to production ## Package Manager - Use **yarn**, not npm (project uses `yarn.lock`) + +## Search + +- Algolia DocSearch (App ID: IUHZFO750H, Index: "Market Data Documentation") +- Crawler config is managed in the Algolia dashboard, not in the codebase +- `hierarchy.lvl1` is ranked above `hierarchy.lvl0` in searchable attributes (custom tweak from Docusaurus default) + +## Sidebar Badges + +- Badges (New, Premium, Beta, High Usage) are configured via `sidebar_custom_props: { badge: n/p/b/h }` in page frontmatter +- Rendered by `src/theme/RenderTag.js`, styled in `src/css/custom.css` +- Supported in sidebar links, sidebar categories, and page titles via swizzled theme components diff --git a/README.md b/README.md index 445e3fe..ea589bc 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,55 @@ # Market Data Documentation -This website is built using [Docusaurus 3](https://docusaurus.io/), a modern static website generator. +The official documentation for [Market Data](https://www.marketdata.app/) — covering the REST API, SDKs, and Google Sheets Add-On. Built with [Docusaurus 3](https://docusaurus.io/). -### Installation -``` -$ yarn -``` -### Local Development -``` -$ yarn start -``` -This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. -### Build -``` -$ yarn build -``` -This command generates static content into the `build` directory and can be served using any static contents hosting service. -### Deployment -Using SSH: -``` -$ USE_SSH=true yarn deploy +**Production:** [www.marketdata.app/docs/](https://www.marketdata.app/docs/) +**Staging:** [www.marketdata.app/docs-staging/](https://www.marketdata.app/docs-staging/) + +## Documentation Sections + +| Section | Path | Description | +|---------|------|-------------| +| **API** | `/api` | REST API reference — stocks, options, indices, funds, markets, and utilities | +| **SDKs** | `/sdk` | Client libraries for Go, Python, and PHP | +| **Sheets Add-On** | `/sheets` | Google Sheets Add-On documentation | +| **Accounts & Billing** | `/account` | Account management, plans, billing, and entitlements | + +## Local Development + +```bash +yarn # Install dependencies +yarn start # Start dev server at localhost:3000 +yarn build # Production build ``` -Not using SSH: + +## Deployment + +The site is hosted on **Cloudflare Pages** with a **Cloudflare Worker** reverse proxy. Deployment is fully automated via GitHub Actions. + +1. Push to `staging` — deploys to the staging site +2. Verify changes at the staging URL +3. Open a PR from `staging` → `main` and merge — deploys to production + +The CI pipeline (`.github/workflows/deploy-docs.yml`) builds the Docusaurus site, restructures the output to match the `/docs/` and `/docs-staging/` URL paths, generates cache headers, and deploys via Wrangler. + +## Project Structure + ``` -$ GIT_USER= yarn deploy +api/ # API reference docs (MDX) +sdk/ # SDK docs — Go, Python, PHP (MDX) +sheets/ # Google Sheets Add-On docs (MDX) +account/ # Account & billing docs (MDX) +src/ + theme/ # Swizzled Docusaurus theme components + css/ # Custom styles +worker/ # Cloudflare Worker reverse proxy +.github/workflows # CI/CD pipeline ``` -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. +## Search + +Search is powered by [Algolia DocSearch](https://docsearch.algolia.com/). The crawler configuration is managed in the Algolia dashboard, not in this repository. + +## License + +MIT diff --git a/api/funds/candles.mdx b/api/funds/candles.mdx index 089d8bc..78fd252 100644 --- a/api/funds/candles.mdx +++ b/api/funds/candles.mdx @@ -1,6 +1,8 @@ --- -title: Candles tg n +title: Candles sidebar_position: 1 +sidebar_custom_props: + badge: n --- import Tabs from "@theme/Tabs"; diff --git a/api/options/quotes.mdx b/api/options/quotes.mdx index d8a11ba..e8bf16e 100644 --- a/api/options/quotes.mdx +++ b/api/options/quotes.mdx @@ -1,8 +1,10 @@ --- -title: Quotes tg h +title: Quotes sidebar_position: 4 tags: - "API: High Usage" +sidebar_custom_props: + badge: h --- Get a current or historical end of day quote for a single options contract. diff --git a/api/stocks/earnings.mdx b/api/stocks/earnings.mdx index 82711f5..58d0c68 100644 --- a/api/stocks/earnings.mdx +++ b/api/stocks/earnings.mdx @@ -1,8 +1,10 @@ --- -title: Earnings tg p +title: Earnings sidebar_position: 4 tags: - "API: Premium" +sidebar_custom_props: + badge: p --- Get historical earnings per share data or a future earnings calendar for a stock. diff --git a/api/stocks/news.mdx b/api/stocks/news.mdx index 8e37bd5..37fd75b 100644 --- a/api/stocks/news.mdx +++ b/api/stocks/news.mdx @@ -1,8 +1,10 @@ --- -title: News tg b +title: News sidebar_position: 5 tags: - "API: Beta" +sidebar_custom_props: + badge: b --- :::warning Beta Endpoint diff --git a/api/stocks/prices.mdx b/api/stocks/prices.mdx index f8778c6..7d0f57a 100644 --- a/api/stocks/prices.mdx +++ b/api/stocks/prices.mdx @@ -1,8 +1,10 @@ --- -title: Real-Time Prices tg h +title: Real-Time Prices sidebar_position: 1 tags: - "API: High Usage" +sidebar_custom_props: + badge: h --- Get real-time midpoint prices for one or more stocks. This endpoint returns real-time prices for stocks, using the [SmartMid](https://www.marketdata.app/smart-mid/) model. diff --git a/api/utilities/status.mdx b/api/utilities/status.mdx index 4312faf..4d7cbf4 100644 --- a/api/utilities/status.mdx +++ b/api/utilities/status.mdx @@ -1,6 +1,8 @@ --- -title: API Status tg n +title: API Status sidebar_position: 1 +sidebar_custom_props: + badge: n --- import Tabs from "@theme/Tabs"; diff --git a/sdk/php/index.mdx b/sdk/php/index.mdx index 97bec08..6404e56 100644 --- a/sdk/php/index.mdx +++ b/sdk/php/index.mdx @@ -2,6 +2,8 @@ title: PHP SDK sidebar_position: 4 slug: /php +sidebar_custom_props: + badge: n --- Welcome to the Market Data PHP SDK documentation. This SDK allows you to easily integrate Market Data services into your PHP applications. diff --git a/sdk/py/index.mdx b/sdk/py/index.mdx index e48cf18..14158e9 100644 --- a/sdk/py/index.mdx +++ b/sdk/py/index.mdx @@ -2,6 +2,8 @@ title: Python SDK sidebar_position: 3 slug: /py +sidebar_custom_props: + badge: n --- Welcome to the Market Data Python SDK documentation. This SDK allows you to easily integrate Market Data services into your Python applications. diff --git a/src/theme/DocBreadcrumbs/index.js b/src/theme/DocBreadcrumbs/index.js index 7568aac..d85ee20 100644 --- a/src/theme/DocBreadcrumbs/index.js +++ b/src/theme/DocBreadcrumbs/index.js @@ -11,15 +11,13 @@ import { translate } from "@docusaurus/Translate"; import HomeBreadcrumbItem from "@theme/DocBreadcrumbs/Items/Home"; import EditThisPage from "@theme/EditThisPage"; import styles from "./styles.module.css"; -import { getLabelAndTag } from "@site/src/utils/functions"; // TODO move to design system folder function BreadcrumbsItemLink({ children, href, isLast }) { - let { label, tag } = getLabelAndTag({ label: children }); const className = "breadcrumbs__link"; if (isLast) { return ( - {label} + {children} ); } @@ -60,7 +58,7 @@ export default function DocBreadcrumbs() { const { editUrl } = metadata; const windowSize = useWindowSize(); const isDesktop = windowSize === "desktop" || windowSize === "ssr"; - + if (!breadcrumbs) { return null; } diff --git a/src/theme/DocCard/index.js b/src/theme/DocCard/index.js index 1d749b1..1180403 100644 --- a/src/theme/DocCard/index.js +++ b/src/theme/DocCard/index.js @@ -9,7 +9,6 @@ import isInternalUrl from "@docusaurus/isInternalUrl"; import { translate } from "@docusaurus/Translate"; import Heading from "@theme/Heading"; import styles from "./styles.module.css"; -import { getLabelAndTag } from "@site/src/utils/functions"; function CardContainer({ href, children }) { return ( - {icon} {label} + title={title}> + {icon} {title} {description && (

{syntheticTitle && ( @@ -38,7 +38,7 @@ export default function DocItemContent({ children }) { alignItems: "center", display: "flex", }}> - {`${label} `} + {`${syntheticTitle} `}

- +
diff --git a/src/theme/DocItem/Metadata/index.js b/src/theme/DocItem/Metadata/index.js index 54f649c..fc324af 100644 --- a/src/theme/DocItem/Metadata/index.js +++ b/src/theme/DocItem/Metadata/index.js @@ -1,14 +1,12 @@ import React from "react"; import { PageMetadata } from "@docusaurus/theme-common"; import { useDoc } from "@docusaurus/theme-common/internal"; -import { getLabelAndTag } from "@site/src/utils/functions"; export default function DocItemMetadata() { const { metadata, frontMatter, assets } = useDoc(); - let { label, tag } = getLabelAndTag({ label: metadata.title || "" }); return ( {label} + {href && collapsible && ( {label} - + {!isInternalLink && } diff --git a/src/theme/PaginatorNavLink/index.js b/src/theme/PaginatorNavLink/index.js index 5dedaea..0285ff9 100644 --- a/src/theme/PaginatorNavLink/index.js +++ b/src/theme/PaginatorNavLink/index.js @@ -1,10 +1,8 @@ import React from "react"; import clsx from "clsx"; import Link from "@docusaurus/Link"; -import { getLabelAndTag } from "@site/src/utils/functions"; export default function PaginatorNavLink(props) { const { permalink, title, subLabel, isNext } = props; - let { label, tag } = getLabelAndTag({ label: title || "" }); return ( {subLabel &&
{subLabel}
} -
{label}
+
{title}
); } diff --git a/src/utils/functions.js b/src/utils/functions.js deleted file mode 100644 index ddb74de..0000000 --- a/src/utils/functions.js +++ /dev/null @@ -1,13 +0,0 @@ -export function getLabelAndTag({ label }) { - // check if there's "tg" - if (!label.includes("tg")) { - return { - label, - tag: "", - }; - } - return { - label: label.split("tg")[0].trim(), - tag: label.split("tg")[1].trim(), - }; -}