open-index/open-npm huggingface dataset:
npm package: @multitenant/cli
Description: CLI for working with `@multitenant/*` multi-tenant packages. It exposes a `multitenant` binary (with a deprecated `tenantify` alias) with:
Latest version: 0.5.4

# @multitenant/cli

CLI for working with `@multitenant/*` multi-tenant packages. It exposes a `multitenant` binary (with a deprecated `tenantify` alias) with:

- `multitenant init` – scaffold `tenants.config.json` and optional framework stubs (Next App Router, Next Pages registry, Express example)
- `multitenant check` – validate `tenants.config.json`
- `multitenant print` – print tenants/markets summary
- `multitenant dev` – start a local dev proxy with per-tenant subdomains

## Testing (this repo / contributors)

```bash
npm test -w @multitenant/cli
npm run test:coverage -w @multitenant/cli
```

## Install

The npm package is **`@multitenant/cli`** (binary **`multitenant`**). **`npx multitenant …`** fails with 404 — use **`npx @multitenant/cli …`** or install first.

```bash
npm install -D @multitenant/cli
```

Add a script:

```jsonc
{
  "scripts": {
    "tenant:dev": "multitenant dev --target http://localhost:3000 --port 3100"
  }
}
```

## Commands

### `multitenant init`

```bash
npx @multitenant/cli init [--framework next-app|next-pages|express|none] [--force]
```

Writes a minimal valid `tenants.config.json` at `--cwd` (default: current directory). Full reference: [docs/CLI/init.md](https://github.com/klypalskyi/multitenant/blob/master/docs/CLI/init.md).

### `multitenant check`

```bash
npx @multitenant/cli check
```

Validates `tenants.config.json` in the current working directory and prints any schema or cross-field errors.

### `multitenant dev`

```bash
npx @multitenant/cli dev --target http://localhost:3000 --port 3100
```

- Spins up a proxy on `--port`
- Resolves tenant by `Host` header using your `tenants.config.json`
- Forwards traffic to `--target`

Optional:

- `--run-dev` – automatically run `npm|pnpm|yarn run dev` in your app before starting the proxy.

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/cli)
npm package: @multitenant/config
Description: Node-only helpers for loading and validating `tenants.config.json` used by `@multitenant/core`.
Latest version: 0.4.3

# @multitenant/config

Node-only helpers for loading and validating `tenants.config.json` used by `@multitenant/core`.

It provides:

- `loadTenantsConfig({ cwd? })` → `Promise<TenantsConfig>`
- `validateTenantsConfig(raw)` → `TenantsConfig`
- `resolveConfigPath(cwd?)` → `string | null`

## Install

```bash
npm install @multitenant/config
```

## Usage

```ts
import { loadTenantsConfig } from '@multitenant/config';
import { createTenantRegistry } from '@multitenant/core';

async function bootstrap() {
  const config = await loadTenantsConfig({ cwd: process.cwd() });
  const registry = createTenantRegistry(config);
  // use registry in your app/server
}
```

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/config)
npm package: @multitenant/core
Description: Core multi-tenant / multi-market engine used by all other `@multitenant/*` packages.
Latest version: 0.5.2

# @multitenant/core

Core multi-tenant / multi-market engine used by all other `@multitenant/*` packages.

It provides:

- `TenantsConfig` type describing `tenants.config.json`
- `createTenantRegistry(config?, options?)` → `TenantRegistry`
- Resolution helpers: `resolveByHost`, `resolveByRequest`
- `getTenantConfig(registry, tenantKey)`, `isTenantFeatureEnabled(flags, name)` — server / shared flag checks
- Typed errors: `MultitenantError`, `InvalidTenantsConfigError`, `DomainResolutionError`, `TenantNotFoundError`, `isMultitenantError` — see [errors doc](https://github.com/klypalskyi/multitenant/blob/master/docs/INTERNAL/errors.md)
- Identity types: `Identity`, `EncodedSession`
- Access guards: `canAccessTenant`, `assertAccess`

## Install

```bash
npm install @multitenant/core
```

## Basic usage

```ts
import type { TenantsConfig } from '@multitenant/core';
import { createTenantRegistry } from '@multitenant/core';

const config: TenantsConfig = {
  version: 1,
  markets: { /* ... */ },
  tenants: { /* ... */ },
};

// Manual mode: pass the loaded config
const registry = createTenantRegistry(config);

// Node-only convenience mode:
// const registry = createTenantRegistry();
// (auto-loads `<process.cwd()>/tenants.config.json`; in edge runtimes pass config explicitly)

const resolved = registry.resolveByHost('us.example.com', { environment: 'production' });
```

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/core)
npm package: @multitenant/dev-proxy
Description: Low-level HTTP dev proxy for multi-tenant apps. Used by `@multitenant/cli` but can be consumed directly.
Latest version: 0.4.2

# @multitenant/dev-proxy

Low-level HTTP dev proxy for multi-tenant apps. Used by `@multitenant/cli` but can be consumed directly.

Given a `TenantRegistry`, it:

- Listens on a local port
- Resolves tenant by `Host` header
- Forwards requests to your app’s dev server
- Injects tenant/market headers (e.g. `x-tenant-key`, `x-market-key`)

## Install

```bash
npm install @multitenant/dev-proxy
```

## Usage

```ts
import { startDevProxy } from '@multitenant/dev-proxy';
import { createTenantRegistry } from '@multitenant/core';
import type { TenantsConfig } from '@multitenant/core';

const config: TenantsConfig = /* load from tenants.config.json */;
const registry = createTenantRegistry(config);

async function main() {
  const proxy = await startDevProxy({
    registry,
    environment: 'local',
    host: '0.0.0.0',
    port: 3100,
    targetHost: 'localhost',
    targetPort: 3000,
  });

  console.log(`Dev proxy on http://0.0.0.0:${proxy.port}`);
}

main();
```

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/dev-proxy)
npm package: @multitenant/drizzle
Description: Reference wiring: Drizzle ORM + node-postgres + @multitenant/database (shared DB & per-tenant URL) — Phase 8.7
Latest version: 0.1.0

# @multitenant/drizzle

**Phase 8.7** — reference wiring for **Drizzle ORM** (`drizzle-orm/node-postgres`) + **`pg`**, integrated with **`@multitenant/database`**:

- **`getOrCreateTenantNodePgPool`** — per-tenant DSN + bounded **`BoundedTenantDbResourceCache<Pool>`**
- **`createNodePgDrizzle`** — shared-DB `Pool` → Drizzle (with optional schema map)
- **`getTenantNodePgDrizzle`** — one-liner: resolve URL, cached pool, `drizzle(pool, { schema })`

Peers: **`drizzle-orm`**, **`pg`**.

Docs: [drizzle-postgres.md](https://github.com/klypalskyi/multitenant/blob/master/docs/INTERNAL/drizzle-postgres.md)

---

## Open source

MIT — [github.com/klypalskyi/multitenant](https://github.com/klypalskyi/multitenant)
npm package: @multitenant/express
Description: Express integration for `@multitenant/core`. Adds a `tenant` property to each request based on the Host header.
Latest version: 0.4.2

# @multitenant/express

Express integration for `@multitenant/core`. Adds a `tenant` property to each request based on the Host header.

## Install

```bash
npm install @multitenant/express @multitenant/core
```

Peer dependency:

- `express >= 4`

## Usage

```ts
import express from 'express';
import { loadTenantsConfig } from '@multitenant/config';
import { createTenantRegistry } from '@multitenant/core';
import { multitenantExpress } from '@multitenant/express';

async function main() {
  const app = express();
  const config = await loadTenantsConfig({ cwd: process.cwd() });
  const registry = createTenantRegistry(config);

  app.use(
    multitenantExpress({
      registry,
      environment: 'local',
      // optional: onMissingTenant: 'throw' → next(TenantNotFoundError); add error middleware
    }),
  );

  app.get('/', (req, res) => {
    if (!req.tenant) return res.status(404).send('no tenant');
    res.send(`Tenant ${req.tenant.tenantKey}, market ${req.tenant.marketKey}`);
  });

  app.listen(3000);
}

main();
```

Framework doc: [express.md](https://github.com/klypalskyi/multitenant/blob/master/docs/FRAMEWORKS/express.md).

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/express)
npm package: @multitenant/identity
Description: Identity utilities for multi-tenant apps built on `@multitenant/core`.
Latest version: 0.5.1

# @multitenant/identity

Identity utilities for multi-tenant apps built on `@multitenant/core`.

It provides:

- `encodeSessionToCookie(session, secret)` → encrypted+signed cookie value
- `decodeSessionFromCookie(value, secret)` → `EncodedSession | null`
- `getSessionFromCookieHeader(...)`, `buildSessionSetCookieHeader(...)` — thin wiring on top of cookie primitives; optional **`CookieConfig.domain`** for `Domain=` (cross-subdomain); **`Domain`** is rejected with **`__Host-`** cookie names
- Re-exports from `@multitenant/core`:
  - `Identity`
  - `EncodedSession`
  - `TenantGuardOptions`
  - `canAccessTenant`
  - `assertAccess`

## Install

```bash
npm install @multitenant/identity
```

## Usage

```ts
import {
  encodeSessionToCookie,
  decodeSessionFromCookie,
  type EncodedSession,
} from '@multitenant/identity';

const secret = process.env.SESSION_SECRET!;

const cookieValue = encodeSessionToCookie(
  {
    identity: { subject: 'user_123', tenantAccess: [] },
    currentTenantKey: 'us-main',
    issuedAt: Date.now(),
    expiresAt: Date.now() + 1000 * 60 * 60,
  },
  secret,
);

const session: EncodedSession | null = decodeSessionFromCookie(cookieValue, secret);
```

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/identity)
npm package: @multitenant/kysely
Description: Reference wiring: Kysely + node-postgres + @multitenant/database (shared DB & per-tenant URL) — Phase 8.7
Latest version: 0.1.0

# @multitenant/kysely

**Optional** reference helpers for **Kysely** + **`pg`** + **`@multitenant/database`**:

- **`createNodePgKysely(pool)`** — shared-DSN `Kysely` over a `Pool`
- **`getOrCreateTenantNodePgPool`**, **`getTenantNodePgKysely`** — per-tenant URL + **`BoundedTenantDbResourceCache<Pool>`**

Peers: **`kysely`**, **`pg`**.

Docs: [kysely-postgres.md](https://github.com/klypalskyi/multitenant/blob/master/docs/INTERNAL/kysely-postgres.md)

---

MIT — [github.com/klypalskyi/multitenant](https://github.com/klypalskyi/multitenant)
npm package: @multitenant/nest
Description: NestJS integration for `@multitenant/core`. Provides:
Latest version: 0.4.2

# @multitenant/nest

NestJS integration for `@multitenant/core`. Provides:

- `MultitenantModuleForRoot({ registry, environment? })` — registers tenant-resolution middleware on all routes
- `createMultitenantNestMiddleware(registry, environment?)` — same handler the module uses; optional for custom `MiddlewareConsumer` paths or tests
- `@Tenant()` param decorator – injects the current `ResolvedTenant | null` into controller handlers

## Install

```bash
npm install @multitenant/nest @multitenant/core
```

Peer dependencies:

- `@nestjs/common >= 10.0.0`
- `@nestjs/core >= 10.0.0`

## Usage

```ts
// app.module.ts
import { Module } from '@nestjs/common';
import { MultitenantModuleForRoot } from '@multitenant/nest';
import { loadTenantsConfig } from '@multitenant/config';
import { createTenantRegistry } from '@multitenant/core';

const config = await loadTenantsConfig({ cwd: process.cwd() });
const registry = createTenantRegistry(config);

@Module({
  imports: [
    MultitenantModuleForRoot({
      registry,
      environment: 'local',
    }),
  ],
})
export class AppModule {}
```

```ts
// app.controller.ts
import { Controller, Get } from '@nestjs/common';
import { Tenant } from '@multitenant/nest';
import type { ResolvedTenant } from '@multitenant/core';

@Controller()
export class AppController {
  @Get()
  index(@Tenant() tenant: ResolvedTenant | null) {
    if (!tenant) return 'no tenant';
    return `Tenant ${tenant.tenantKey}`;
  }
}
```

More detail in the repo: [docs/FRAMEWORKS/nestjs.md](https://github.com/klypalskyi/multitenant/blob/master/docs/FRAMEWORKS/nestjs.md).

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/nest)
npm package: @multitenant/next
Description: Meta-package: re-exports @multitenant/core, config, react, next-app for a single install line
Latest version: 0.5.1

# @multitenant/next

Thin **meta-package** that re-exports:

- `@multitenant/core`
- `@multitenant/config`
- `@multitenant/react`
- `@multitenant/next-app`

Install one line plus `next` and `react`:

```bash
npm install @multitenant/next next react
```

Subpaths such as `@multitenant/next-app/auto` are available via this package’s dependencies (import from `@multitenant/next-app/auto` or add a direct dependency if your bundler requires it).

See [docs/FRAMEWORKS/overview.md](https://github.com/klypalskyi/multitenant/blob/master/docs/FRAMEWORKS/overview.md) and [PLAN.md](https://github.com/klypalskyi/multitenant/blob/master/PLAN.md) Phase 2.2.

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/next)
npm package: @multitenant/next-app
Description: Next.js **App Router** integration for `@multitenant/core`.
Latest version: 0.5.1

# @multitenant/next-app

Next.js **App Router** integration for `@multitenant/core`.

It provides:

- `createTenantMiddleware(registry, options)` – Next.js `middleware.ts` factory
- `createTenantMiddlewareFromConfig(config, options)` – **from `@multitenant/next-app/auto`** when you already have a loaded `TenantsConfig` object
- `createNodeTenantMiddlewareFromProjectRoot(options?)` – **from `@multitenant/next-app/auto-node`** (Node only): loads `./tenants.config.json` from `process.cwd()` via `@multitenant/config`
- `getTenantFromHeaders(headers, registry, options?)` – read `ResolvedTenant` in route handlers / server components
- `requireTenant(headers, registry, options?)` – same but throws if missing

**Runtime:** `auto-node` uses `fs` and must not run on Edge. Use `auto` with a static import or bundled JSON if middleware must run on Edge.

## Install

```bash
npm install @multitenant/next-app @multitenant/core
```

## Usage

### `middleware.ts`

```ts
import type { EnvironmentName } from '@multitenant/core';
import { createTenantMiddleware } from '@multitenant/next-app';
import tenantsConfig from './tenants.config.json';
import { createTenantRegistry } from '@multitenant/core';

const registry = createTenantRegistry(tenantsConfig as any);
const env = (process.env.TENANT_ENV ?? 'local') as EnvironmentName;

export const middleware = createTenantMiddleware(registry, {
  environment: env,
});
```

#### Missing tenant behavior
`createTenantMiddleware` resolves the tenant from the incoming request `Host` header (it also respects `x-forwarded-host`).
If the current host doesn't match any tenant domain (common when you run `next dev` directly on `localhost` instead of via `multitenant dev`), tenant resolution will fail.
By default (`onMissingTenant: 'passthrough'`) the middleware will *not* throw; it will `NextResponse.next()` (no tenant headers are added). Your app/server code must still handle `getTenantFromHeaders(...) === null` if you don’t route through `multitenant dev`.
If you want a hard failure (or logs), set `onMissingTenant: 'throw'` (or `'warn'`).

### In route handlers / server components

```ts
import { headers } from 'next/headers';
import { getTenantFromHeaders } from '@multitenant/next-app';
import { tenantRegistry } from './tenant-registry';

export async function GET() {
  const h = headers();
  const tenant = getTenantFromHeaders(h, tenantRegistry, { environment: 'local' });
  // ...
}
```

Full App Router checklist: [next-app-router.md](https://github.com/klypalskyi/multitenant/blob/master/docs/FRAMEWORKS/next-app-router.md).

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/next-app)
npm package: @multitenant/next-pages
Description: Next.js **Pages Router** integration for `@multitenant/core`.
Latest version: 0.4.2

# @multitenant/next-pages

Next.js **Pages Router** integration for `@multitenant/core`.

It provides:

- `withTenantGSSP(gssp, { registry, environment? })` – wraps `getServerSideProps` and injects `tenant` into props
- `withTenantApi(handler, { registry, environment? })` – wraps API route handlers and attaches `req.tenant`. If the host does not resolve, responds **404** with JSON `{ error: string, code: 'MULTITENANT_TENANT_NOT_FOUND' }` (same stable code as `TenantNotFoundError` in `@multitenant/core`).

## Install

```bash
npm install @multitenant/next-pages @multitenant/core
```

## Usage

### `pages/index.tsx`

```tsx
import React from 'react';
import type { GetServerSideProps } from 'next';
import { withTenantGSSP } from '@multitenant/next-pages';
import { tenantRegistry } from '../tenant-registry';
import type { ResolvedTenant } from '@multitenant/core';

interface Props {
  tenant: ResolvedTenant;
}

export const getServerSideProps: GetServerSideProps<Props> = withTenantGSSP(
  async ({ tenant }) => {
    return { props: { tenant } };
  },
  { registry: tenantRegistry, environment: 'local' },
);

export default function Page({ tenant }: Props) {
  return <div>Tenant: {tenant.tenantKey}</div>;
}
```

### API routes

```ts
// pages/api/example.ts
import type { NextApiResponse } from 'next';
import { withTenantApi, type NextApiRequestWithTenant } from '@multitenant/next-pages';
import { tenantRegistry } from '../../tenant-registry';

export default withTenantApi(
  (req: NextApiRequestWithTenant, res: NextApiResponse) => {
    res.json({ tenant: req.tenant.tenantKey });
  },
  { registry: tenantRegistry, environment: 'local' },
);
```

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/next-pages)
npm package: @multitenant/prisma
Description: Reference wiring: Prisma + @multitenant/database (shared DB & per-tenant URL) — optional ORM peer
Latest version: 0.1.0

# @multitenant/prisma

**Optional** reference helpers for **Prisma** + **`@multitenant/database`**:

- **`createSharedPrismaClient(databaseUrl, prismaOptions?)`** — single shared DSN
- **`getOrCreateTenantPrismaClient(cache, resolved, tenants, options?)`** — per-tenant URL + **`BoundedTenantDbResourceCache<PrismaClient>`**

Peer: **`@prisma/client`** (your generated app client; use the same major you run in production).

Docs: [prisma-postgres.md](https://github.com/klypalskyi/multitenant/blob/master/docs/INTERNAL/prisma-postgres.md)

---

MIT — [github.com/klypalskyi/multitenant](https://github.com/klypalskyi/multitenant)
npm package: @multitenant/react
Description: React bindings for `@multitenant/core`. Provides a `TenantProvider` and hooks for accessing the current tenant/market in React components.
Latest version: 0.5.2

# @multitenant/react

React bindings for `@multitenant/core`. Provides a `TenantProvider` and hooks for accessing the current tenant/market in React components.

## Install

```bash
npm install @multitenant/react @multitenant/core
```

## Usage

```tsx
import React from 'react';
import { TenantProvider, useTenant, useMarket } from '@multitenant/react';
import { createTenantRegistry, type TenantsConfig } from '@multitenant/core';

const config: TenantsConfig = /* your tenants.config.json loaded somehow */;
const registry = createTenantRegistry(config);

function AppInner() {
  const tenant = useTenant();
  const market = useMarket();

  return (
    <div>
      <p>Tenant: {tenant.tenantKey}</p>
      <p>Market: {market.key}</p>
    </div>
  );
}

export function App() {
  const dummyTenant = registry.resolveByHost('us.localhost', { environment: 'local' })!;

  return (
    <TenantProvider registry={registry} tenant={dummyTenant}>
      <AppInner />
    </TenantProvider>
  );
}
```

Available hooks:

- `useTenant()` – current `ResolvedTenant`
- `useMarket()` – `NormalizedMarket`
- `useTenantFlag(name)` – boolean flag
- `useTenantTheme()` – theme config (if configured)
- `useExperiment(key)` – experiment variant
- `useTenantConfig<T>()` – typed arbitrary config blob per tenant

SSR, RSC boundary & Next.js examples: [react-ssr.md](https://github.com/klypalskyi/multitenant/blob/master/docs/FRAMEWORKS/react-ssr.md).

---

## Open source

MIT licensed — [**github.com/klypalskyi/multitenant**](https://github.com/klypalskyi/multitenant) · [Issues](https://github.com/klypalskyi/multitenant/issues) · [npm](https://www.npmjs.com/package/@multitenant/react)
npm package: @multitenant/typeorm
Description: Reference wiring: TypeORM DataSource + Postgres + @multitenant/database (shared DB & per-tenant URL) — Phase 8.7
Latest version: 0.1.0

# @multitenant/typeorm

**Optional** reference helpers for **TypeORM** **`DataSource`** (Postgres) + **`@multitenant/database`**:

- **`createSharedPostgresDataSource(url, dataSourceOptions?)`** — shared DSN
- **`getOrCreateTenantPostgresDataSource(cache, resolved, tenants, options?)`** — per-tenant URL + **`BoundedTenantDbResourceCache<DataSource>`**

Peer: **`typeorm`**. You must **`await dataSource.initialize()`** before use; on cache eviction call **`dataSource.destroy()`** (see doc).

Docs: [typeorm-postgres.md](https://github.com/klypalskyi/multitenant/blob/master/docs/INTERNAL/typeorm-postgres.md)

---

MIT — [github.com/klypalskyi/multitenant](https://github.com/klypalskyi/multitenant)
npm package: @multitenantkit/adapter-system-crypto-uuid
Description: Crypto UUID adapter using Node.js crypto module
Latest version: 0.2.0

# multitenantkit/adapter-system-crypto-uuid

System adapter that implements UUID generation using Node.js crypto module.

## Overview

This package provides a concrete implementation of the `UuidPort` interface from `multitenantkit/domain-contracts`, using Node.js built-in `crypto.randomUUID()` function.

## Installation

This package is part of the MultiTenantKit monorepo and is installed automatically via workspace dependencies.

## Usage

```typescript
import { CryptoUuid } from '@multitenantkit/adapter-system-crypto-uuid';

const uuidGenerator = new CryptoUuid();
const newId = uuidGenerator.generate(); // Returns a UUID v4 string
```

## Architecture

This adapter follows the **Hexagonal Architecture** (Ports & Adapters) pattern:

- **Port**: `UuidPort` interface defined in `multitenantkit/domain-contracts`
- **Adapter**: `CryptoUuid` class that implements the port using Node.js crypto

## Features

- ✅ UUID v4 generation using `crypto.randomUUID()`
- ✅ Type-safe implementation of `UuidPort`
- ✅ Zero external dependencies (uses Node.js built-in crypto)
- ✅ Suitable for production use

## Why Separate Package?

This adapter is extracted into its own package to:

1. **Separation of Concerns**: System utilities are independent from persistence logic
2. **Reusability**: Can be used by any adapter (JSON, Postgres, etc.) without coupling
3. **Testability**: Easy to mock or replace with alternative implementations
4. **Clean Architecture**: Respects dependency inversion principle

## Related Packages

- `multitenantkit/domain-contracts` - Defines the `UuidPort` interface
- `multitenantkit/adapter-system-system-clock` - System clock adapter
npm package: @multitenantkit/adapter-system-system-clock
Description: System Clock adapter using real system time
Latest version: 0.2.0

# multitenantkit/adapter-system-system-clock

System adapter that implements clock functionality using real system time.

## Overview

This package provides a concrete implementation of the `ClockPort` interface from `multitenantkit/domain-contracts`, using JavaScript's built-in `Date` object.

## Installation

This package is part of the MultiTenantKit monorepo and is installed automatically via workspace dependencies.

## Usage

```typescript
import { SystemClock } from '@multitenantkit/adapter-system-system-clock';

const clock = new SystemClock();
const currentTime = clock.now(); // Returns current Date
```

## Architecture

This adapter follows the **Hexagonal Architecture** (Ports & Adapters) pattern:

- **Port**: `ClockPort` interface defined in `multitenantkit/domain-contracts`
- **Adapter**: `SystemClock` class that implements the port using JavaScript Date

## Features

- ✅ Real system time using `new Date()`
- ✅ Type-safe implementation of `ClockPort`
- ✅ Zero external dependencies (uses JavaScript built-in Date)
- ✅ Suitable for production use

## Why Separate Package?

This adapter is extracted into its own package to:

1. **Separation of Concerns**: System utilities are independent from persistence logic
2. **Reusability**: Can be used by any adapter (JSON, Postgres, etc.) without coupling
3. **Testability**: Easy to mock with fixed time for deterministic tests
4. **Clean Architecture**: Respects dependency inversion principle

## Testing

For testing purposes, you can easily create a mock clock:

```typescript
class MockClock implements ClockPort {
    constructor(private fixedTime: Date) {}

    now(): Date {
        return this.fixedTime;
    }
}

// Use in tests
const fixedDate = new Date('2024-01-01T00:00:00Z');
const mockClock = new MockClock(fixedDate);
```

## Related Packages

- `multitenantkit/domain-contracts` - Defines the `ClockPort` interface
- `multitenantkit/adapter-system-crypto-uuid` - UUID generation adapter
npm package: @multitheftauto/starlight-theme-mtasa
Description: Starlight theme for Multi Theft Auto
Author: Multi Theft Auto team and contributors
Latest version: 1.4.1

# Starlight theme for Multi Theft Auto

This repository contains the [Starlight](https://starlight.astro.build/) theme used by [Multi Theft Auto](https://multitheftauto.com/).

## Installation

1. Install the package
    ```
    npm i @multitheftauto/starlight-theme-mtasa
    ```

2. Edit your `astro.config.mjs`
    ```diff
      import starlight from '@astrojs/starlight'
      import { defineConfig } from 'astro/config'
      import starlightVersions from 'starlight-versions'
    + import mtasaStarlightThemePlugin from '@multitheftauto/starlight-theme-mtasa';

      export default defineConfig({
          integrations: [
              starlight({
                  title: 'My Docs',
    +             plugins: [mtasaStarlightThemePlugin()],
              }),
          ],
      })
    ```

## License

Copyright (c) 2025 Multi Theft Auto team and contributors.

Permission is granted to copy, distribute and/or modify these source files under the terms of the [MIT License](LICENSE). A copy of the [license](LICENSE) is included in the root directory of the repository.