npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kodeme-io/next-core-client

v0.8.4

Published

Backend-agnostic client interfaces for next-core with caching, retry, and performance monitoring

Readme

@kodeme-io/next-core-client

Backend-agnostic client interfaces for next-core.

Overview

This package provides generic interfaces that enable next-core to work with any backend:

  • ✅ Odoo (JSON-RPC) - Current
  • ✅ FastAPI (REST) - Future
  • ✅ GraphQL - Future
  • ✅ Custom backends - Anytime

Core Interfaces

IDataClient

Generic interface for data operations (CRUD, search, etc.):

import { IDataClient, SearchParams } from '@kodeme-io/next-core-client'

// Works with ANY backend implementing IDataClient
const partners = await dataClient.searchRead({
  model: 'res.partner',
  filters: [
    { field: 'is_company', operator: 'eq', value: true }
  ],
  fields: ['id', 'name', 'email'],
  limit: 20
})

IAuthClient

Generic interface for authentication:

import { IAuthClient } from '@kodeme-io/next-core-client'

// Works with ANY backend implementing IAuthClient
const result = await authClient.login('user', 'password')
console.log(result.user.name)

const isValid = await authClient.checkSession()

Implementations

Odoo Adapter

npm install @kodeme-io/next-core-odoo-api
import { OdooAdapter } from '@kodeme-io/next-core-odoo-api'

const client = new OdooAdapter({
  url: 'https://odoo.example.com',
  database: 'production'
})

// Implements both IDataClient and IAuthClient

FastAPI Adapter (Future)

npm install @kodeme-io/next-core-fastapi-api
import { FastAPIAdapter } from '@kodeme-io/next-core-fastapi-api'

const client = new FastAPIAdapter({
  url: 'https://api.example.com'
})

// Same interface, different backend!

Usage

1. Choose Backend

// app/lib/backend-client.ts
import { OdooAdapter } from '@kodeme-io/next-core-odoo-api'
// import { FastAPIAdapter } from '@kodeme-io/next-core-fastapi-api'

// Switch backend via env variable
const BACKEND = process.env.NEXT_PUBLIC_BACKEND || 'odoo'

export const dataClient = BACKEND === 'odoo'
  ? new OdooAdapter({
      url: process.env.NEXT_PUBLIC_ODOO_URL!,
      database: process.env.NEXT_PUBLIC_ODOO_DB!,
    })
  : new FastAPIAdapter({
      url: process.env.NEXT_PUBLIC_API_URL!,
    })

2. Use in Components

// app/components/PartnerList.tsx
import { dataClient } from '@/lib/backend-client'

export function PartnerList() {
  const [partners, setPartners] = useState([])

  useEffect(() => {
    // Works with both Odoo and FastAPI!
    dataClient.searchRead({
      model: 'res.partner',
      filters: [{ field: 'is_company', operator: 'eq', value: true }],
      fields: ['id', 'name', 'email'],
    }).then(setPartners)
  }, [])

  return <ul>{partners.map(p => <li key={p.id}>{p.name}</li>)}</ul>
}

3. Switching Backends

Just change environment variable:

# .env (Odoo)
NEXT_PUBLIC_BACKEND=odoo
NEXT_PUBLIC_ODOO_URL=https://odoo.example.com
NEXT_PUBLIC_ODOO_DB=production

# .env (FastAPI)
NEXT_PUBLIC_BACKEND=fastapi
NEXT_PUBLIC_API_URL=https://api.example.com

No code changes needed! 🎉

Generic Types

Filters

import type { Filter } from '@kodeme-io/next-core-client'

const filters: Filter[] = [
  { field: 'name', operator: 'like', value: 'John%' },
  { field: 'age', operator: 'gte', value: 18 },
  { field: 'country', operator: 'in', value: ['US', 'UK', 'CA'] }
]

Complex Filters

import type { FilterGroup } from '@kodeme-io/next-core-client'

const complexFilters: FilterGroup = {
  operator: 'AND',
  conditions: [
    { field: 'is_company', operator: 'eq', value: true },
    {
      operator: 'OR',
      conditions: [
        { field: 'country', operator: 'eq', value: 'US' },
        { field: 'country', operator: 'eq', value: 'UK' }
      ]
    }
  ]
}

Pagination

const { data, pagination } = await client.searchPaginated({
  model: 'res.partner',
  limit: 20,
  offset: 0
})

console.log(pagination.total) // Total records
console.log(pagination.hasMore) // More records available?

Creating Custom Adapters

Implement IDataClient and/or IAuthClient:

import {
  IDataClient,
  IAuthClient,
  SearchParams,
  AuthResult
} from '@kodeme-io/next-core-client'

export class MyCustomAdapter implements IDataClient, IAuthClient {
  async searchRead<T>(params: SearchParams): Promise<T[]> {
    // Convert generic params to your backend's format
    const response = await fetch(`/api/${params.model}`, {
      method: 'POST',
      body: JSON.stringify({
        filters: params.filters,
        limit: params.limit
      })
    })
    return response.json()
  }

  async login(username: string, password: string): Promise<AuthResult> {
    const response = await fetch('/auth/login', {
      method: 'POST',
      body: JSON.stringify({ username, password })
    })
    const data = await response.json()
    return {
      userId: data.id,
      sessionId: data.token,
      user: data.user
    }
  }

  // ... implement other methods
}

Benefits

  1. Backend Flexibility - Switch backends without changing app code
  2. Type Safety - Full TypeScript support
  3. Future Proof - Easy to add new backends
  4. Testable - Mock adapters for testing
  5. Clean Architecture - Separation of concerns

License

MIT © ABC Food Development Team