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()
.use(query(Post), include('author'))
.run(all());

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

await action()
.use(create(post))
.run(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 accros 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 Foscia CLI

Foscia CLI allow you to quickly setup Foscia on your project. It will automatically detect your environment and install required Foscia packages. Once installed, just run init command with your destination directory.

npm install --save-dev @foscia/cli
npx foscia init