# AppService

**Kind:** Service

**Source:** [`atloria-monorepo/apps/api-schema-parser/src/app.service.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/api-schema-parser/src/app.service.ts#L13)

`AppService` provides application-level metadata for the API schema parser service. It exposes a health summary for operational checks and a list of supported parser definitions for clients that need to discover available parsing capabilities.

## Methods

| Method | Signature | Returns | Description |
|---|---|---|---|
| `getHealth` | `getHealth()` | `{ status: string; parsers: string[]; version: string }` | Get health status |
| `getSupportedParsers` | `getSupportedParsers()` | `Array<{
    name: string;
    version: string;
    patterns: string[];
  }>` | Get list of supported parsers |

## Diagram

```mermaid
sequenceDiagram
  participant Client
  participant Controller
  participant AppService

  Client->>Controller: GET /health
  Controller->>AppService: getHealth()
  AppService-->>Controller: status, parsers, version
  Controller-->>Client: Health response

  Client->>Controller: GET /parsers
  Controller->>AppService: getSupportedParsers()
  AppService-->>Controller: Parser metadata
  Controller-->>Client: Supported parsers response
```

## Usage

```ts
import { AppService } from './app.service';

const appService = new AppService();

const health = appService.getHealth();
console.log(health);
// {
//   status: 'ok',
//   parsers: ['...'],
//   version: '...'
// }

const parsers = appService.getSupportedParsers();

for (const parser of parsers) {
  console.log(`${parser.name}@${parser.version}`);
  console.log(`Supported patterns: ${parser.patterns.join(', ')}`);
}
```

## AI Coding Instructions

- Keep `getHealth()` lightweight and deterministic; it should return status metadata without performing expensive parser initialization or external network calls.
- Ensure parser names returned by `getHealth().parsers` stay aligned with the parser definitions returned by `getSupportedParsers()`.
- When adding a parser, include its stable `name`, semantic `version`, and all supported file or schema `patterns`.
- Preserve the existing response shapes because health checks, controllers, and API consumers may depend on these fields.
- Add parser discovery changes through this service rather than duplicating parser metadata in controllers or route handlers.
