Get started with Yap Community

Community / API Development / Serverless / API Management / API Integration

Yap is the lightweight microservices API gateway shining at the heart of any microservice or serverless architecture, which aims to be a smaller, more expressive and robust foundation for API management and automation workflows with low-code approach and security.

Key features of Yap 🙌

Yap offers powerful, yet lightweight features that allow fine-grained control over your API ecosystem. Yap combines GraphQL, XML policies, and strong functional testing on serverless architecture.

  • Elegant XML Policies The powerful capability of the system that allows the publisher to change API behavior through configuration in elegant XML files.

  • GraphQL as API Gateway GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. Yap uses only GraphQL as API Gateway.

  • YAML Functional testing CI-ready tests for REST APIs configured in YAML.

  • Connectors The integration platform that was built from the ground to support a single design interface for professional (IT developers) and non-professional (citizen users) integrators.

  • Designed for serverless Yap is designed for serverless event functions on AWS, GCP, or Azure.


Install project with Yap-cli, command line Interface package for managing any tasks on
Young App Platform.

With yarm

npx create yap books-project
cd todo-project
yarn start

With npm

npx create-yap books-project
cd todo-project
npm start

For more information, see details on Usage guide.

Create your first application

Inside the current folder, create the directory called books-projects. Inside this directory, generate the initial project structure and install the transitive dependencies:

├── node_modules
├── package.json
├── .gitignore
├── serverless.yml
├── tslint.json
├── tsconfig.json
└── src
    ├── policies.xml
    ├── schema.graphql
    ├── resolvers.ts
    ├── scenarios.yaml
    └── app.ts

Write your first policy

Policies are powerful capabilities of the system that allows the publisher to change API behavior through configuration. Policies are the collection of statements that are being executed sequentially on the API request or response.

The configuration is divided into inbound, outbound, and on-error. The series of specified policy statements are executed in a request-response order.

    <!-- statements to be applied to the request go here -->
    <!-- statements to be applied to the response go here -->
    <!-- statements to be applied if there is an error -->
    <!-- condition go here -->

Create policies.xml file:

touch src/policies.xml

Add your API Authorization policy

      failed-check-error-message="Not authorized"



Create typeDefs.schema

GraphQL is the query language for APIs and a runtime for fulfilling those queries with your existing data. Every GraphQL server uses a schema to define the structure of data requested by clients.

Add the following to the bottom of schema.graphql:

# Comments on GraphQL strings (such as this one) start
# with the hash (#) symbol.

# This "Book" type defines the queryable fields for
#  every book in our data source.

type Book {
  title: String
  author: String

# The "Query" type is special: it lists all of the
# available queries that clients can execute,
# along with the return type for each. In this
# case, the "books" query returns an array of zero
# or more Books (defined above).

type Query {
  books: [Book]

Define your data set

Now that we’ve defined the structure of our data, we can define the data itself. Add the following to the bottom of resolvers.ts:

const books = [
    title: 'Harry Potter and the Chamber of Secrets',
    author: 'J.K. Rowling',
    title: 'Jurassic Park',
    author: 'Michael Crichton',

export books;


Yap application is an object containing the GraphQL schema and policies, which are composed and executed in a stack-like manner upon request.

Add the following to the bottom of src/handler.ts:

The obligatory workflow application:

import { Yap } from "@youngapp/yap";
import typeDefs from "./schema.graphql";
import resolvers from "./resolvers.ts";
import policies from "./policies.xml";

// The Yap constructor requires three parameters: your schema
// definition, policies and your set of resolvers.
const app = new Yap({ typeDefs, resolvers, policies });

// A simple typescript node project for AWS Lambda.
exports.handler = app.handler;

npm start

Start your application with npm start.

Related articles