# ajays0011/playwright-automation---api architecture

> Architecture diagram of the GitHub repository ajays0011/playwright-automation---api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ajays0011/playwright-automation---api
- Repository: https://github.com/ajays0011/playwright-automation---api

## Overview

This repository is a Playwright/TypeScript API automation framework for testing the BookStore ToolsQA API. Its main workflow runs account and bookstore test suites through fixtures and service wrappers, sends API requests, then validates responses and contracts. Supporting layers provide environment configuration, token handling, test data, request/response models, custom matchers, and logging. The README documents the test-to-fixture-to-service flow; sampled sources confirm service-to-client calls and client/token-manager HTTP requests. Fixture wiring and several test-to-validation relationships are shown only at the README level.

Main entry points: [`src/client/api-client.ts`](https://github.com/ajays0011/playwright-automation---api/blob/main/src/client/api-client.ts) (API client), [`src/fixtures/api-fixtures.ts`](https://github.com/ajays0011/playwright-automation---api/blob/main/src/fixtures/api-fixtures.ts) (API fixtures), [`src/auth/token-manager.ts`](https://github.com/ajays0011/playwright-automation---api/blob/main/src/auth/token-manager.ts) (Token manager), [`src/services/account.service.ts`](https://github.com/ajays0011/playwright-automation---api/blob/main/src/services/account.service.ts) (Account service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_test["Test workflows"]
  node_account_tests["Account tests"]
  node_bookstore_tests["Bookstore tests"]
  node_fixtures["API fixtures<br/>[api-fixtures.ts]"]
end

subgraph group_service["API services"]
  node_account_service["Account service<br/>[account.service.ts]"]
  node_bookstore_service["Bookstore service"]
end

subgraph group_infra["Request infrastructure"]
  node_api_client["API client<br/>[api-client.ts]"]
  node_token_manager["Token manager<br/>[token-manager.ts]"]
  node_environment["Environment config<br/>[env.config.ts]"]
  node_test_data["Test data<br/>[data-provider.ts]"]
  node_test_helpers["Test helpers<br/>[test-helpers.ts]"]
  node_request_builder["Request builder<br/>[request-builder.ts]"]
  node_logger["Logging<br/>[logger.ts]"]
end

subgraph group_validation["Data and validation"]
  node_request_models["Request models"]
  node_response_models["Response models"]
  node_schemas["Response schemas"]
  node_schema_validator["Schema validator"]
  node_response_validator["Response validator"]
  node_matchers["Custom matchers<br/>[custom-matchers.ts]"]
end

node_runner(("Test runner"))
node_api{{"BookStore API"}}

node_runner -->|"runs"| node_account_tests
node_runner -->|"runs"| node_bookstore_tests
node_account_tests -->|"uses"| node_fixtures
node_bookstore_tests -->|"uses"| node_fixtures
node_fixtures -->|"provides services"| node_account_service
node_fixtures -->|"provides services"| node_bookstore_service
node_account_service -->|"calls"| node_api_client
node_bookstore_service -->|"calls"| node_api_client
node_api_client -->|"sends requests"| node_api
node_token_manager -->|"requests token"| node_api
node_token_manager -->|"reads settings"| node_environment
node_account_service -->|"accepts payloads"| node_request_models
node_bookstore_service -->|"accepts payloads"| node_request_models
node_response_validator -->|"validates schemas"| node_schema_validator
node_matchers -->|"validates schemas"| node_schema_validator
node_matchers -->|"checks responses"| node_api_client
node_schemas -.->|"supplies schemas"| node_schema_validator
node_test_data -->|"selects data"| node_environment
node_api_client -->|"logs traffic"| node_logger
node_response_validator -->|"logs results"| node_logger
node_token_manager -->|"logs activity"| node_logger

click node_account_tests "https://github.com/ajays0011/playwright-automation---api/tree/main/tests/account"
click node_bookstore_tests "https://github.com/ajays0011/playwright-automation---api/tree/main/tests/bookstore"
click node_fixtures "https://github.com/ajays0011/playwright-automation---api/blob/main/src/fixtures/api-fixtures.ts"
click node_account_service "https://github.com/ajays0011/playwright-automation---api/blob/main/src/services/account.service.ts"
click node_bookstore_service "https://github.com/ajays0011/playwright-automation---api/blob/main/src/services/bookstore.service.ts"
click node_api_client "https://github.com/ajays0011/playwright-automation---api/blob/main/src/client/api-client.ts"
click node_token_manager "https://github.com/ajays0011/playwright-automation---api/blob/main/src/auth/token-manager.ts"
click node_environment "https://github.com/ajays0011/playwright-automation---api/blob/main/src/config/env.config.ts"
click node_test_data "https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/data-provider.ts"
click node_test_helpers "https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/test-helpers.ts"
click node_request_builder "https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/request-builder.ts"
click node_logger "https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/logger.ts"
click node_request_models "https://github.com/ajays0011/playwright-automation---api/tree/main/src/models/request"
click node_response_models "https://github.com/ajays0011/playwright-automation---api/tree/main/src/models/response"
click node_schemas "https://github.com/ajays0011/playwright-automation---api/tree/main/src/schemas"
click node_schema_validator "https://github.com/ajays0011/playwright-automation---api/blob/main/src/schemas/schema-validator.ts"
click node_response_validator "https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/response-validator.ts"
click node_matchers "https://github.com/ajays0011/playwright-automation---api/blob/main/src/matchers/custom-matchers.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_account_tests,node_bookstore_tests,node_fixtures toneBlue
class node_account_service,node_bookstore_service toneAmber
class node_api_client,node_token_manager,node_environment,node_test_data,node_test_helpers,node_request_builder,node_logger,node_api toneMint
class node_request_models,node_response_models,node_schemas,node_schema_validator,node_response_validator,node_matchers toneRose
class node_runner toneIndigo
```

## Components

### Test workflows

- [Account tests](https://github.com/ajays0011/playwright-automation---api/tree/main/tests/account): `tests/account`
- [Bookstore tests](https://github.com/ajays0011/playwright-automation---api/tree/main/tests/bookstore): `tests/bookstore`
- [API fixtures](https://github.com/ajays0011/playwright-automation---api/blob/main/src/fixtures/api-fixtures.ts): `src/fixtures/api-fixtures.ts`

### API services

- [Account service](https://github.com/ajays0011/playwright-automation---api/blob/main/src/services/account.service.ts): `src/services/account.service.ts`
- [Bookstore service](https://github.com/ajays0011/playwright-automation---api/blob/main/src/services/bookstore.service.ts): `src/services/bookstore.service.ts`

### Request infrastructure

- [API client](https://github.com/ajays0011/playwright-automation---api/blob/main/src/client/api-client.ts): `src/client/api-client.ts`
- [Token manager](https://github.com/ajays0011/playwright-automation---api/blob/main/src/auth/token-manager.ts): `src/auth/token-manager.ts`
- [Environment config](https://github.com/ajays0011/playwright-automation---api/blob/main/src/config/env.config.ts): `src/config/env.config.ts`
- [Test data](https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/data-provider.ts): `src/utils/data-provider.ts`
- [Test helpers](https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/test-helpers.ts): `src/utils/test-helpers.ts`
- [Request builder](https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/request-builder.ts): `src/utils/request-builder.ts`
- [Logging](https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/logger.ts): `src/utils/logger.ts`

### Data and validation

- [Request models](https://github.com/ajays0011/playwright-automation---api/tree/main/src/models/request): `src/models/request`
- [Response models](https://github.com/ajays0011/playwright-automation---api/tree/main/src/models/response): `src/models/response`
- [Response schemas](https://github.com/ajays0011/playwright-automation---api/tree/main/src/schemas): `src/schemas`
- [Schema validator](https://github.com/ajays0011/playwright-automation---api/blob/main/src/schemas/schema-validator.ts): `src/schemas/schema-validator.ts`
- [Response validator](https://github.com/ajays0011/playwright-automation---api/blob/main/src/utils/response-validator.ts): `src/utils/response-validator.ts`
- [Custom matchers](https://github.com/ajays0011/playwright-automation---api/blob/main/src/matchers/custom-matchers.ts): `src/matchers/custom-matchers.ts`

### Other components

- **Test runner**
- **BookStore API**

## Connections

- Test runner → Account tests: runs (evidence: `README.md`)
- Test runner → Bookstore tests: runs (evidence: `README.md`)
- Account tests → API fixtures: uses (evidence: `README.md`)
- Bookstore tests → API fixtures: uses (evidence: `README.md`)
- API fixtures → Account service: provides services (evidence: `README.md`)
- API fixtures → Bookstore service: provides services (evidence: `README.md`)
- Account service → API client: calls (evidence: `src/services/account.service.ts`)
- Bookstore service → API client: calls (evidence: `src/services/bookstore.service.ts`)
- API client → BookStore API: sends requests (evidence: `src/client/api-client.ts`)
- Token manager → BookStore API: requests token (evidence: `src/auth/token-manager.ts`)
- Token manager → Environment config: reads settings (evidence: `src/auth/token-manager.ts`)
- Account service → Request models: accepts payloads (evidence: `src/services/account.service.ts`)
- Bookstore service → Request models: accepts payloads (evidence: `src/services/bookstore.service.ts`)
- Response validator → Schema validator: validates schemas (evidence: `src/utils/response-validator.ts`)
- Custom matchers → Schema validator: validates schemas (evidence: `src/matchers/custom-matchers.ts`)
- Custom matchers → API client: checks responses (evidence: `src/matchers/custom-matchers.ts`)
- Response schemas → Schema validator: supplies schemas
- Test data → Environment config: selects data (evidence: `src/utils/data-provider.ts`)
- API client → Logging: logs traffic (evidence: `src/client/api-client.ts`)
- Response validator → Logging: logs results (evidence: `src/utils/response-validator.ts`)
- Token manager → Logging: logs activity (evidence: `src/auth/token-manager.ts`)
