# Vyriy Preset REST API

Calm cloud-ready REST API application built as a Yarn workspace.

Published: 2026-06-04
Tags: vyriy, preset, rest, api, cli
Source: https://vyriy.dev/examples/vyriy-preset-rest/

---

# Vyriy Preset - REST API

Calm cloud-ready REST API application built as a Yarn workspace.

The repository currently contains a single API workspace that serves a small
HTTP API, publishes an OpenAPI document, and renders the document with Scalar.
The root package owns shared tooling for TypeScript, ESLint, Prettier, Jest,
Storybook, and workspace-level build scripts.

## Create this example

```bash
npm create vyriy@latest
```

Choose the `rest` preset.

## Requirements

- Node.js `>=24.0.0`
- Yarn `4.16.0`

## Workspaces

| Workspace                              | Description                                            |
| -------------------------------------- | ------------------------------------------------------ |
| [`@w/api`](./workspaces/api/README.md) | HTTP API server with OpenAPI and Scalar documentation. |

## Local development

Install dependencies:

```bash
yarn install
```

Start all configured services:

```bash
yarn start
```

Start only the API:

```bash
yarn start:api
```

The API listens on `PORT` through `@vyriy/server`; when `PORT` is not set, the
default port is `3000`.

After the API starts, open:

- `http://localhost:3000/` for the Scalar API reference.
- `http://localhost:3000/openapi.json` for the raw OpenAPI document.
- `http://localhost:3000/api/test` for the test endpoint.

## Documentation

Run Storybook:

```bash
yarn storybook
```

The root `doc.mdx` imports this README for project-level documentation.
`workspaces/api/doc.mdx` imports the API workspace README for API-specific
documentation.

## Validation

Run all checks:

```bash
yarn check
```

Run checks separately:

```bash
yarn lint
yarn build
yarn test
```

Run the focused API test suite:

```bash
yarn jest workspaces/api --runInBand --coverage=false
```

## Build

Build all configured outputs:

```bash
yarn build
```

Build only the API bundle:

```bash
yarn build:api
```

The API build writes a CommonJS server bundle to `dist/api/index.js` and copies
a runtime `package.json` into `dist/api`.

## Project Guidance

These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:

- [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.
- [Calm App Structure for the Vyriy Ecosystem](https://vyriy.dev/blog/vyriy-calm-app-structure/) - a practical project structure for Vyriy applications: shared configs, small packages, thin workspaces, Storybook docs, tests, and deployable entry points.
- [One Handler, Many Runtimes](https://vyriy.dev/examples/one-handler-many-runtimes/) - how @vyriy/handler, @vyriy/router, and @vyriy/server compose a calm Lambda-compatible API that can run locally, in Docker, Fargate-style HTTP runtimes, and AWS Lambda.
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
