Apity screenshot

Apity

Author Avatar Theme by Cocreators ee
Updated: 10 Apr 2025
59 Stars

A typed fetch client for openapi-typescript for use with SvelteKit

Overview

The apity is a typed API client for Svelte and SvelteKit. It is a fetch client that works with openapi-typescript and is compatible with SvelteKit’s custom fetch. The apity offers support for JSON request and responses from OpenAPI 3.0, {#await} syntax in Svelte templates, compatibility with SvelteKit’s fetch in load functions, request reloading, and configuration of default fetch options. It also has plans to include caching of subsequent requests with the same URL and parameters in the future.

Features

  • Support of JSON request and responses from OpenAPI 3.0
  • Support of {#await} syntax in Svelte templates
  • Compatibility with SvelteKit’s fetch in load functions
  • Request reloading
  • Configuration of default fetch options
  • On the roadmap:
    • Caching of subsequent requests with the same URL and parameters

Installation

To install the apity theme, you need to generate an API spec using openapi-typescript. Once you have generated the API spec, you can configure the apity instance and generate functions for making API calls. Each API call is represented as a request object with specific properties. The response from each API call is a Svelte store that returns an undefined value or an object. The apity also provides error handling for exceptions that may be thrown during API requests.

Summary

The apity is a typed API client for Svelte and SvelteKit. It offers several features such as support for JSON request and responses, compatibility with SvelteKit’s fetch, and configuration of fetch options. It also has plans to include caching of subsequent requests in the future. The installation process involves generating an API spec and configuring the apity instance. Overall, the apity is a useful tool for working with APIs in Svelte and SvelteKit projects.