Skip to content

ayushtripathi955/main-street-marketplace-toolkit

Repository files navigation

Main Street Marketplace Toolkit

Open, non-proprietary marketplace intelligence for U.S. small businesses.

msmt is a Python toolkit that translates the kind of analytics enterprise marketplaces use internally — listing integrity, supply resilience, demand forecasting with practitioner guardrails — into transparent, auditable modules that an SBDC counselor, a state commerce program analyst, a niche marketplace operator, or an SMB seller can run on their own laptop.

It is a companion to the Main Street Marketplace article series, a five-part, plain-language walk-through of the same ideas:

  • Part 1 — (coming soon)
  • Part 2 — (coming soon)
  • Part 3 — (coming soon)
  • Part 4 — (coming soon)
  • Part 5 — (coming soon)

There is no commercial version of this toolkit and no paid tier. It is MIT licensed, free forever, and intentionally built from public methods and synthetic data so anyone can read, run, and adapt it without asking permission.

Who this is for

  • SBDC counselors advising small marketplace sellers who want a defensible, explainable view of demand and inventory risk.
  • State and regional commerce program staff evaluating where small sellers are most exposed to marketplace volatility.
  • Niche marketplace operators (regional, industry-vertical, or co-op marketplaces) who need ideas that scale down to a few hundred SKUs.
  • SMB sellers on Amazon, Walmart, eBay, Shopify, Etsy, or any comparable platform who want to reason about their own data without handing it to a black-box vendor.
  • Policy researchers studying small-business resilience in digital commerce.

The three pillars

The toolkit is organized around three problems every marketplace seller runs into, regardless of size:

  1. Marketplace integrity (msmt.integrity) — Score a seller against ten fulfillment, post-purchase, and content signals; surface suppression risk and the top issues to fix. Includes a catalog concentration audit using the DOJ Herfindahl-Hirschman thresholds.
  2. Supply resilience (msmt.resilience) — Classify each SKU's demand pattern, compute safety stock and reorder points, and rank the catalog by current stockout risk — including the platform suppression tail.
  3. Forecasting with guardrails (msmt.forecasting) — Auto-select a forecasting method per SKU (six baselines, Croston for intermittent demand, Prophet for holiday-spike SKUs with a numpy fallback) and wrap the result in five plain-language guardrails that tell a counselor when to trust it.

Shared utilities live under msmt.data (synthetic data generation).

Running the app

The toolkit ships with an interactive Streamlit app that exposes all three modules to a non-technical audience — the primary artifact for SBDC counselors, state commerce program staff, and SMB sellers who don't want to read Python:

pip install -e ".[app,forecasting]"
streamlit run app/streamlit_app.py

Then open the URL Streamlit prints (typically http://localhost:8501) and pick a module from the sidebar. Every page runs on synthetic data generated in-memory; the app does not read or write any files and does not call any external APIs.

The four pages mirror the modules:

  • Home — what each pillar does, with links into the modules.
  • Marketplace Integrity — score a demo seller or enter your own metrics; see the scorecard, top issues, recommendations, and a catalog concentration audit.
  • Supply Resilience — generate a synthetic catalog, see the stockout-risk heatmap, and use the platform-suppression cost calculator.
  • Demand Forecasting — pick a demand pattern, see the auto- selected method's forecast and 95% prediction interval, and watch the five guardrails fire (or not).

Screenshot placeholder — running the app locally and taking screenshots of each page is the recommended next step.

Deployment

The repo is set up for two independent deployments — the interactive Streamlit app and the standalone landing page — both free.

Streamlit Community Cloud (the app)

The app is configured for one-click deployment to Streamlit Community Cloud:

  1. Go to share.streamlit.io and connect your GitHub account.
  2. Select this repo (main-street-marketplace-toolkit), branch main, main file app/streamlit_app.py.
  3. The included requirements.txt (which installs the msmt package directly from this GitHub repo via git+https://...) and .streamlit/config.toml (theme + headless server) are picked up automatically.
  4. Streamlit builds and deploys; the app goes live at a *.streamlit.app URL.
  5. To use a custom subdomain (e.g. app.mainstreetmarketplace.org), add it under Settings → Custom domain in your Streamlit Cloud app settings and point a CNAME record at the URL Streamlit gives you.

Static landing page (mainstreetmarketplace.org)

The website/ folder is a self-contained static site. No build step, no JavaScript framework, no Node toolchain.

  • Vercelnpx vercel deploy website/, or connect the GitHub repo via vercel.com/new and set the root directory to website/.
  • Netlify — drag the website/ folder onto netlify.com/drop, or connect the repo and set the publish directory to website/.
  • GitHub Pages — set the Pages source to the main branch with the /website folder.

After the static site is live, point mainstreetmarketplace.org's DNS A or CNAME record at the deployed host.

Walkthrough notebooks

For readers who want to see the toolkit run end-to-end in code, the notebooks/ folder ships four walkthroughs:

  • 01_marketplace_integrity_walkthrough.ipynb
  • 02_supply_resilience_walkthrough.ipynb
  • 03_forecasting_guardrails_walkthrough.ipynb
  • 04_end_to_end_case_study.ipynb — the capstone: a single 50-SKU synthetic catalog runs through all three modules to produce a combined SMB diagnostic report.

All notebooks ship pre-executed so they render with charts on GitHub.

Quickstart

Install from source (a PyPI release will come once the API stabilizes):

git clone https://github.com/ayushtripathi955/main-street-marketplace-toolkit.git
cd main-street-marketplace-toolkit
pip install -e .

The library itself only depends on pandas and numpy. Optional extras pull in the rest of the stack only if you need them:

  • pip install -e ".[forecasting]" — Prophet and statsforecast for holiday-spike forecasting.
  • pip install -e ".[notebooks]" — Jupyter and matplotlib for the walkthrough notebooks.
  • pip install -e ".[app]" — Streamlit and matplotlib for the interactive app.
  • pip install -e ".[test]" — pytest for the test suite.

Generate a synthetic multi-SKU dataset:

from msmt.data import generate_seller_data

df = generate_seller_data(n_skus=50, n_days=365, seed=42)
print(df.head())
print(df["pattern"].value_counts())

You will get a tidy, daily DataFrame with the columns date, sku_id, units_sold, listing_price, stock_on_hand, lead_time_days, category, and pattern. Feed any column into your own analysis — the rest of the toolkit will use this exact schema.

Need a single SKU of one specific archetype (handy for unit tests or worked examples)?

from msmt.data import (
    generate_smooth,
    generate_weekly_seasonal,
    generate_holiday_spike,
    generate_intermittent,
    generate_new_sku,
)

steady = generate_smooth(n_days=180, seed=0)
seasonal = generate_weekly_seasonal(n_days=180, seed=0)
holiday = generate_holiday_spike(n_days=365, seed=0, end_date="2025-12-31")
lumpy = generate_intermittent(n_days=365, seed=0)
brand_new = generate_new_sku(n_days=180, history_days=30, seed=0)

Every generator accepts a seed, so the same arguments always return the same DataFrame.

A note on the data

All data produced by this toolkit is synthetic. It is not derived from, sampled from, or modeled on any proprietary or real-world seller dataset. The five demand archetypes are well-known patterns from the public operations-research and demand-forecasting literature; the generators here are simple, transparent implementations meant to make the rest of the toolkit demonstrable end-to-end without anyone needing to share their real numbers.

If you want to run msmt against your own data, just match the schema — the column names listed in the quickstart are all the toolkit expects.

License

MIT. Free to use, modify, and redistribute. No attribution required, though a link back to the article series is appreciated.

Author

Ayush Tripathi — data analytics and marketplace strategy practitioner based in San Francisco. The toolkit and accompanying article series were built to give Main Street sellers and the people who advise them the same kind of marketplace intelligence enterprise sellers take for granted, in a form anyone can read, run, and trust.

About

Open, free, MIT-licensed Python toolkit translating enterprise marketplace intelligence methods into non-proprietary frameworks for U.S. SMBs, SBDCs, accelerators, and state commerce programs.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors