# @faststore/api

> FastStore API GraphQL API layer

Latest version **4.9.2** (published 2026-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @faststore/api
pnpm add @faststore/api
yarn add @faststore/api
bun add @faststore/api
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.9.2 |
| Published | 2026-10-02 |
| First published | 2021-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20 |
| Dependencies | 10 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 219 |
| Maintainers | emersonlaurentino, guieevc, marcos_vtex, lariciamota, eduardo.formiga, hellofanny |

## Links

- npm: https://www.npmjs.com/package/@faststore/api
- Repository: https://github.com/vtex/faststore
- Homepage: https://github.com/vtex/faststore#readme
- Issues: https://github.com/vtex/faststore/issues
- npm.io page: https://npm.io/package/@faststore/api

## Dependencies (10)

- [cookie](https://npm.io/package/cookie.md) ^0.7.0
- [p-limit](https://npm.io/package/p-limit.md) ^3.1.0
- [dataloader](https://npm.io/package/dataloader.md) ^2.1.0
- [sanitize-html](https://npm.io/package/sanitize-html.md) ^2.11.0
- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^3.1.3
- [isomorphic-unfetch](https://npm.io/package/isomorphic-unfetch.md) ^3.1.0
- [@graphql-tools/merge](https://npm.io/package/@graphql-tools/merge.md) 9.1.1
- [@graphql-tools/utils](https://npm.io/package/@graphql-tools/utils.md) 10.10.1
- [@graphql-tools/schema](https://npm.io/package/@graphql-tools/schema.md) 10.0.25
- [@graphql-tools/load-files](https://npm.io/package/@graphql-tools/load-files.md) ^7.0.0

## Recent versions

- 4.9.2 (latest) — 2026-10-02
- 4.9.1-dev.0 (dev) — 2026-09-30
- 3.99.4 (v3-latest) — 2026-05-14
- 2.2.80 (stable-v2) — 2024-09-13
- 3.0.65-alpha.0 (alpha) — 2024-06-03
- 4.9.1 — 2026-10-02
- 4.9.0 — 2026-09-30
- 4.9.0-dev.8 — 2026-09-30
- 4.9.0-dev.7 — 2026-09-29
- 4.9.0-dev.6 — 2026-09-29
- 4.9.0-dev.5 — 2026-09-29
- 4.9.0-dev.4 — 2026-09-28
- 4.9.0-dev.3 — 2026-09-28
- 4.9.0-dev.2 — 2026-09-28
- 4.9.0-dev.1 — 2026-09-28
- … 676 more at https://npm.io/package/@faststore/api/versions

## README

<p align="center">
  <a href="https://developers.vtex.com/docs/guides/faststore">
    <img alt="Faststore" src="../ui/static/logo.png" width="60" />
  </a>
</p>
<h1 align="center">
  FastStore API
</h1>
<p align="center">
  <strong>
    GraphQL API layer for FastStore storefronts
  </strong>
</p>
<p align="center">
  <a href="https://www.npmjs.com/package/@faststore/api">
    <img src="https://badge.fury.io/js/%40faststore%2Fapi.svg" alt="npm version" />
  </a>
</p>


`@faststore/api` owns the GraphQL schema, resolvers, directives, and platform integration for FastStore storefronts. It defines the data contract between the storefront and e-commerce backends — currently the VTEX platform.

This package is consumed internally by `@faststore/core`. You will work here when adding or modifying GraphQL queries, mutations, resolvers, or types.

## Package structure

```
src/
├── platforms/
│   └── vtex/
│       ├── resolvers/   # GraphQL resolvers (query.ts, mutation.ts, product.ts, etc.)
│       ├── typeDefs/    # GraphQL schema definitions (.graphql files)
│       ├── clients/     # VTEX API clients
│       ├── loaders/     # DataLoader instances for batching
│       └── utils/       # Platform utilities
├── directives/          # Custom GraphQL directives (auth, cacheControl)
├── observability/       # OpenTelemetry tracing
└── index.ts             # Public exports
```

## How to run

### Prerequisites

- Node.js ≥ 20
- Access to a VTEX account (the local dev server defaults to the `storeframework` account)

### Local setup

```bash
# 1. Install dependencies (from the repo root)
pnpm install

# 2. Start the local GraphQL server with file watching
pnpm dev
```

This runs the build in watch mode and starts a local GraphQL server at `http://localhost:4000/graphql`. You can use it to run queries and test changes directly.

## How to use

`@faststore/api` is consumed as an npm package by `@faststore/core`, which sets up the full GraphQL layer.

## How to develop

### Adding or modifying a resolver

1. Edit or create the resolver file in `src/platforms/vtex/resolvers/`
2. If adding a new type, create the corresponding `.graphql` file in `src/platforms/vtex/typeDefs/`
3. Run `pnpm generate` to regenerate TypeScript types from the updated schema
4. Run `pnpm test` to verify nothing broke

### Modifying the GraphQL schema

After editing any `.graphql` file in `typeDefs/`, always regenerate the schema types:

```bash
pnpm generate
```

> The generated output lives in `src/__generated__/` — do not edit those files manually.

## How to test

```bash
# Unit tests
pnpm test:unit

# Integration tests
pnpm test:int

# All tests
pnpm test
```

## How to publish

Versioning and publishing are managed at the monorepo root by Lerna. Do not publish this package independently. Refer to the [Contributing guidelines](../../CONTRIBUTING.MD) for the full release workflow.

## Documentation

- **FastStore API reference:** [developers.vtex.com/docs/guides/faststore/faststore-api](https://developers.vtex.com/docs/guides/faststore/faststore-api)
- **GraphQL schema:** [`src/platforms/vtex/typeDefs/`](./src/platforms/vtex/typeDefs/)

---
_Source: https://npm.io/package/@faststore/api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
