> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wyrly.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> Wyrly DI を学ぶための実行可能なサンプル。

Wyrly のリポジトリには実行可能なサンプルが含まれています。それぞれのサンプルは、1 つのシナリオと 1 つの学習目標に絞っています。

## おすすめの学習順

1. コアサンプルから始める。
2. グラフ検査と検証を学ぶ。
3. 自分のフレームワークに合うアダプターへ進む。

## コアサンプル

| Folder                       | Topic                                          | Run                                   |
| ---------------------------- | ---------------------------------------------- | ------------------------------------- |
| `examples/basic-ddd`         | tokens、`@Injectable`、scoped lifetimes、disposal | `deno task example:basic-ddd`         |
| `examples/explicit-deps`     | decorators なしの explicit `register({ deps })`   | `deno task example:explicit-deps`     |
| `examples/provider-patterns` | `useValue`、`useFactory`、`useExisting`          | `deno task example:provider-patterns` |
| `examples/dependency-graph`  | `inspect()` と `validate()`                     | `deno task example:dependency-graph`  |

すべてのコアサンプルを実行する:

```sh theme={null}
deno task examples:core
```

## アダプターサンプル

| Folder                            | Package                                | Run                                        |
| --------------------------------- | -------------------------------------- | ------------------------------------------ |
| `examples/hono-api`               | `@wyrly/hono`                          | `deno task example:hono-api`               |
| `examples/express-api`            | `@wyrly/express`                       | `deno task example:express-api`            |
| `examples/graphql-request`        | scoped DataLoader 付きの `@wyrly/graphql` | `deno task example:graphql-request`        |
| `examples/express-graphql`        | Express and GraphQL                    | `deno task example:express-graphql`        |
| `examples/fresh-routes`           | `@wyrly/fresh`                         | `deno task example:fresh-routes`           |
| `examples/next-ddd`               | `@wyrly/next`                          | `deno task example:next-ddd`               |
| `examples/fastify-api`            | `@wyrly/fastify`                       | `deno task example:fastify-api`            |
| `examples/yoga-graphql`           | `@wyrly/yoga`                          | `deno task example:yoga-graphql`           |
| `examples/apollo-graphql`         | `@wyrly/apollo`                        | `deno task example:apollo-graphql`         |
| `examples/apollo-express-graphql` | `@wyrly/express` + `@wyrly/apollo`     | `deno task example:apollo-express-graphql` |

すべてのアダプターサンプルを実行する（上記を含む）:

```sh theme={null}
deno task examples:adapters
```

## すべて実行する

```sh theme={null}
deno task examples
```

Express、Fastify、Apollo のサンプルには `net` パーミッションが必要です。

## サンプルを composition root の参考にする

サンプルは意図的に小さく作られています。プロバイダーの登録をどこに置くべきか、リクエストスコープをどう作るか、フレームワークのコードからアプリケーションの use case にどう処理を渡すかを確認するために使ってください。
