Catalog npm
Back to packageRELEASE DETAILS

0.2.1

npm

@01edu/api-client

Type-safe HTTP API Client

Published1 Apr 2026
Direct dependencies2
Transitive dependenciesNot calculated

README

Current package documentation

api-client

Tiny, type-safe HTTP API client meant to be used alongside the @01edu/api router (see @01edu/api/router). It builds a strongly-typed client from your server route definitions.

Install

  • deno add jsr:@01edu/api-client

How it fits

  • Define routes on the server with @01edu/api/router and export their type.
  • Use that type on the client with createClient for end-to-end typing.

Server (types export)

import { route } from '@01edu/api/router'
import { STR } from '@01edu/api/validator'

export const routes = {
  'GET/hello': route({
    input: { name: STR() },
    output: { message: STR() },
    fn: (_, { name }) => ({ message: `Hello, ${name}!` }),
  }),
}

export type RoutesDefinitions = typeof routes

Client

import { createClient } from '@01edu/api-client'
import type { RoutesDefinitions } from '/api/routes.ts' // types-only import from your backend

const api = createClient<RoutesDefinitions>('/api')

// One-shot call
const res = await api['GET/hello'].fetch({ name: 'Ada' })

// Reactive usage
const hello = api['GET/hello'].signal()
hello.fetch({ name: 'Ada' })
hello.$.subscribe((v) => console.log(v.pending, v.data, v.error))

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
picocolors
Environment
{
  "local_name": "picocolors",
  "alias": false,
  "peer_metadata": null
}
^1.0.0development
@preact/signals
Environment
{
  "local_name": "@preact/signals",
  "alias": false,
  "peer_metadata": null
}
^2.9.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "046e05f6a899edced872d20b76065e13f36f5531",
  "tarball": "https://registry.npmjs.org/@01edu/api-client/-/api-client-0.2.1.tgz",
  "fileCount": 7,
  "integrity": "sha512-3bwC80f421igzLSAOifsQWzE0LVki1GQC41FbJvymtuqfIxaNe7VU/9+Av8L5iQhWcpL4tcs9yOfCR4RWZoCdQ==",
  "signatures": [
    {
      "sig": "MEQCIFVPc7eKFJNqzRaMskkiuIYOZ2+PExCIKBFOToroZRSGAiA82ThYVzpf9dxk17Qz7zikxoqls+TFJN/3S5zaIrZZ/g==",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "attestations": {
    "url": "https://registry.npmjs.org/-/npm/v1/attestations/@01edu%2fapi-client@0.2.1",
    "provenance": {
      "predicateType": "https://slsa.dev/provenance/v1"
    }
  },
  "unpackedSize": 17518
}

Repository

PENDING
01-edu/framework

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:57 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:b761cfbf38f99d68f264e1b448622880bb9d428f8b2746bb1c5732630854e5a8

Other collected versions

0.2.65 May0.2.55 May0.2.32 Apr0.2.21 Apr0.1.712 Feb0.1.512 JanView all collected versions →