Skip to main content

Foscia

Type safe, modular and intuitive API/data client for JS/TS.

Searching an ORM alike tool
for your APIs interactions?

Foscia is like an ORM, but for APIs consumption. You can easily get started and interact with your standardized APIs without thinking about serialization and error handling complexity.

const posts = await action().run(
query(Post),
include('author'),
all(),
);

const post = fill(new Post(), {
title: 'Hello World!',
});

await action().run(create(post), one());

Readable data models
Type safety with TypeScript

Foscia provides an elegant way to define your data models. It gives your data structure readability and type safety across all your data interactions, even across nested relations.

export default class Post
extends makeModel('posts', {
publishable,
title: attr<string>(),
body: attr<string>(),
author: hasOne(() => User),
tags: hasMany(() => Tag),
}) {
}

Modular, lightweight, and more...

HTTP·REST·JSON:API

Exchange with any HTTP, REST or JSON:API backend.

Modular

Simple configuration and framework-agnostic.

Lightweight

Fully tree-shakable for optimal build size.

Type safe

Strong type your data structure with TS.

Changes tracking

Record changes on data during lifecycle.

Hooks

Register hooks, such as saving or deleting.

Cache

Never re-fetch data thanks to the cache system.

CLI

Get started quickly with the built-in CLI.

Get started now, install the CLI

@foscia/cli provide quick setup and management of Foscia in your project. It detects your environment, installs Foscia packages and provides files generation commands.

npm install -D @foscia/cli && npx foscia init

Discover through examples