{"id":48633082,"url":"https://github.com/usemoss/moss-image-search-demo","last_synced_at":"2026-04-09T06:03:39.930Z","repository":{"id":322293796,"uuid":"1087777909","full_name":"usemoss/moss-image-search-demo","owner":"usemoss","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-03T07:29:15.000Z","size":1865,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-03T07:55:09.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://moss-image-search-demo.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/usemoss.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-01T16:16:35.000Z","updated_at":"2026-03-03T07:29:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/usemoss/moss-image-search-demo","commit_stats":null,"previous_names":["usemoss/moss-image-search-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/usemoss/moss-image-search-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usemoss%2Fmoss-image-search-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usemoss%2Fmoss-image-search-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usemoss%2Fmoss-image-search-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usemoss%2Fmoss-image-search-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usemoss","download_url":"https://codeload.github.com/usemoss/moss-image-search-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usemoss%2Fmoss-image-search-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31588039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-09T05:33:47.836Z","status":"ssl_error","status_checked_at":"2026-04-09T05:32:26.579Z","response_time":112,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-09T06:03:35.794Z","updated_at":"2026-04-09T06:03:39.916Z","avatar_url":"https://github.com/usemoss.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable-next-line MD033 --\u003e\n# \u003cimg src=\"https://github.com/user-attachments/assets/c4e39933-40c4-462d-a9a3-135458c6705f\" alt=\"Moss logo\" width=\"48\" style=\"vertical-align: middle; margin-right: 8px;\" /\u003e Moss Demo Project - Image Search\n\nMoss is a high-performance runtime for real-time semantic search. It delivers sub-10 ms lookups, instant index updates, and zero infra overhead. Moss runs where your agent lives - cloud, in-browser, or on-device - so search feels native and users never wait. You connect your data once; Moss handles indexing, packaging, distribution and updates.\n\nThis repo bundles thin, working examples that show how to talk to Moss from Python and JavaScript. Each sample keeps the scaffolding light so you can copy the essentials straight into your own projects.\n\n\u003e **Try out the live deployment of this sample project at https://moss-image-search-demo.vercel.app/**\n\u003e \u003cimg width=\"1512\" height=\"942\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/826715b2-4ea0-4346-b24e-2481b8f1d03a\" /\u003e\n\n## Quick Start\n\n**1. Create a single `.env` at the repo root** — copy `.env.example` and fill in your Moss credentials:\n```bash\ncp .env.example .env\n```\nAll sub-projects read from this one file.\n\n**2. Create the Moss index** (`coco-data-1k.json` is included — no download needed for the 1k tier):\n```bash\ncd setup-js \u0026\u0026 npm install \u0026\u0026 npx tsx createIndex.ts \u0026\u0026 cd ..\n```\n\u003e To use 10k, 50k, or 100k tiers, run `npx tsx downloadCoco.ts` first to generate those files.\n\n**3. Start the Python backend** (in one terminal):\n```bash\ncd backend-py\nuv venv \u0026\u0026 source .venv/bin/activate  # Windows: .venv\\Scripts\\activate\nuv sync\nuvicorn main:app --reload\n```\n\n**4. Start the React app** (in another terminal):\n```bash\ncd react-app \u0026\u0026 npm install \u0026\u0026 npm run dev\n```\n\nOpen [http://localhost:5173](http://localhost:5173) and start searching.\n\n---\n\n## 1. Go to Moss Portal and Get API Keys\n\n- Visit [usemoss.dev](https://usemoss.dev/) to sign up, create an account, confirm your email, and sign in.\n- From the dashboard, open **View secrets** and save the values as `MOSS_PROJECT_ID` and `MOSS_PROJECT_KEY` in the root `.env` file (copy `.env.example` → `.env`).\n\n\u003e ![Moss Portal walkthrough](https://github.com/user-attachments/assets/c3db9d2d-0df5-4cec-99fd-7d49d0a30844)\n\n## 2. Download Dataset\n\nThe demo uses COCO Captions images split into tiers (1k, 10k, 50k, 100k).\n\n`coco-data-1k.json` is included in the repo — no download needed for the 1k tier. To use larger tiers (10k, 50k, 100k), run the download script to generate them:\n\n**JavaScript:**\n```bash\ncd setup-js\nnpm install\nnpx tsx downloadCoco.ts\n```\n\n**Python:**\n```bash\ncd setup-py\nuv venv \u0026\u0026 source .venv/bin/activate\nuv sync\npython download_coco.py\n```\n\nThis generates `coco-data-10k.json`, `coco-data-50k.json`, and `coco-data-100k.json` in the project root.\n\n## 3. Setup - Upload data and create index\n\nAll setup scripts read credentials from the **root `.env`** file (created in step 1). Use either the JS or Python tooling — they produce identical indexes.\n\n### Setup JS\n\n1. Navigate to the `setup-js` folder.\n2. Install Node.js and npm.\n3. Run `npm install` to install dependencies.\n4. `npx tsx createIndex.ts` to create the index for the tier set in the root `.env` (`MOSS_INDEX_TIER`, default `1k`).\n5. `npx tsx createAllIndexes.ts` to create indexes for all tiers.\n6. `npx tsx query.ts` to load the index and run sample queries.\n\n### Setup Python\n\n1. Navigate to the `setup-py` folder.\n2. Install Python 3.10+ and uv.\n3. Create and activate a virtual environment:\n   - `uv venv`\n   - On Windows: `.\\venv\\Scripts\\activate`\n   - On macOS/Linux: `source .venv/bin/activate`\n4. Run `uv sync` to install dependencies.\n5. Run `python create_index.py` to create the index for the tier set in the root `.env` (`MOSS_INDEX_TIER`, default `1k`).\n6. Run `python create_all_indexes.py` to create indexes for all tiers.\n7. Run `python query.py` to load the index and run sample queries.\n\n## 4. Backend\n\nA FastAPI backend is included in the `backend-py` folder. It proxies queries to Moss, keeping your API keys off the client. It reads credentials from the **root `.env`** file.\n\nAll routes are mounted under the `/demo/image-search` prefix:\n- `GET /demo/image-search/search` — semantic search endpoint\n- `GET /demo/image-search/health` — health check\n- `GET /demo/image-search/image-proxy` — secure image proxy (rewrites `http://` COCO URLs to pass through the backend)\n\n**Development server:**\n1. Navigate to the `backend-py` folder.\n2. Install Python 3.10+ and uv.\n3. `uv venv \u0026\u0026 source .venv/bin/activate`\n4. `uv sync` to install dependencies.\n5. Run `uvicorn main:app --reload` to start the server.\n\n**Docker:**\n```bash\ncd backend-py\ndocker build -t moss-backend .\ndocker run -p 8080:8080 --env-file ../.env moss-backend\n```\n\n## 5. React App powered by Moss\n\nA sample React app is included in the `react-app` folder that demonstrates how to integrate Moss for semantic search. It reads `MOSS_PYTHON_API_URL` from the **root `.env`** file via Vite's env loading.\n\n1. Navigate to the `react-app` folder.\n2. Install Node.js and npm.\n3. Run `npm install` to install dependencies.\n4. Run `npm run dev` to start the development server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusemoss%2Fmoss-image-search-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusemoss%2Fmoss-image-search-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusemoss%2Fmoss-image-search-demo/lists"}