# near-me-schema

Shared Zod schemas, enums and the managed category/subcategory taxonomy for the
**Near-Me** local-business directory. Single source of truth (SSOT) consumed by
both `reform-backend` and `jansathi-frontend`.

## What's inside

- **Taxonomy** (`taxonomy.ts`) — `NEAR_ME_CATEGORY` -> `NEAR_ME_SUBCATEGORY` tree
  (`NEAR_ME_CATEGORY_SUBCATEGORIES`) plus `subcategoriesForCategory` /
  `isSubcategoryOfCategory`. Managed + versioned: growing it = a new publish.
- **Enums** (`enums.ts`) — status, managed attribute tags, report reasons, lead
  type/status, day-of-week.
- **Helpers** (`helpers.ts`) — `geoJsonPointSchema`, phone/url/email/time Zod utils.
- **Business** (`business.schema.ts`) — create/update/search bodies + wire types.

## Build & publish (npm-first)

```bash
npm install
npm run build          # tsc -> dist/
npm publish --access public
```

`prepublishOnly` runs `build` + `check` (type-check + biome) as the publish gate.
`--access public` is a CLI flag, not a manifest field.

## Consume

In `reform-backend` and `jansathi-frontend`:

```bash
npm install near-me-schema@<version>
# then delete any nested Zod dup so a single Zod instance is used:
rm -rf node_modules/near-me-schema/node_modules
```

Bump the caret pin in each consumer's `package.json` on every publish (a `0.x`
caret locks to the same minor, so `npm install` won't auto-pick a new minor).

## Convention

Mirrors `marketplace-schema` exactly: pure ESM, `tsc`-only build, Zod is a
**peer** dependency (`^4.4.0`), NodeNext `.js` import specifiers, const-object
enums fed to `z.enum(...)`.
