Skip to content

Releases: dharayush7/fireclass-react

Release list

v2.0.9

Choose a tag to compare

@dharayush7 dharayush7 released this 10 Jul 16:25

fireclass-react v2.0.9

@dharayush7/fireclass-react v2.0.9 aligns the npm package page with
the complete React setup, realtime API, and application guide.

What changed

  • Added the Fireclass logo and removed npm, license, and type shield badges.
  • Added Firebase Web app environment and client initialization guidance.
  • Documented the app-bound Fireclass entry, validated models, realtime Todo
    workflow, and single-document subscriptions.
  • Added complete useQuery and useDoc state transitions, resubscription and
    cleanup behavior, JSON query-value limitations, and ClientAdapter
    capabilities.
  • Added Firebase Authentication, Security Rules, and App Check boundaries.
  • Expanded npm keywords for React hooks, realtime Firestore, Firebase client
    SDK, typed models, validation, and Firestore ODM.
  • Added changelog and release notes to the published package contents.

Runtime compatibility

No runtime API or behavior changed. The package remains compatible with
@dharayush7/fireclass-core ^2.0.8.

Verify

npm run typecheck
npm test
npm run build
npm pack --dry-run

Documentation: https://fireclass.ayushdhar.com/docs/api/react

v2.0.8

Choose a tag to compare

@dharayush7 dharayush7 released this 09 Jul 12:44

fireclass-react v2.0.8

@dharayush7/fireclass-react — the first public release of the Fireclass suite's firebase client-SDK runtime, with realtime React hooks.

It wraps @dharayush7/fireclass-core with a client-SDK adapter and adds useQuery / useDoc hooks that update live via onSnapshot — so your components re-render on every Firestore change with no manual refetching.

Highlights

  • createFireclass(firestore) — bind Fireclass to a client-SDK Firestore and get back { BaseModel, adapter, useQuery, useDoc }.
  • useQuery(Model, options?) — a live query hook returning hydrated model instances; re-subscribes on change and cleans up on unmount.
  • useDoc(Model, id) — a live single-document hook.
  • ClientAdapter — implements the core FirestoreAdapter over the firebase client SDK, including batchDelete (via writeBatch), aggregate count, and realtime subscribe / subscribeDoc.
  • Re-exports the full core — decorators, QueryOptions, errors, ValidationFailedError.

Install

npm install @dharayush7/fireclass-react firebase react class-validator class-transformer

firebase, react, class-validator, and class-transformer are peer dependencies. @dharayush7/fireclass-core (^2.0.8) is a regular dependency, installed automatically. Enable decorators in tsconfig.json:

{ "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true } }

Quick look

import { getFirestore } from "firebase/firestore";
import { createFireclass, Collection } from "@dharayush7/fireclass-react";
import { IsString, IsBoolean } from "class-validator";

export const { BaseModel, useQuery } = createFireclass(getFirestore(app));

@Collection("todos")
class Todo extends BaseModel<Todo> {
  @IsString() title!: string;
  @IsBoolean() done!: boolean;
  constructor(data?: Partial<Todo>) { super(data); Object.assign(this, data); }
}

function Todos() {
  const { data: todos, loading } = useQuery(Todo, { orderBy: { title: "asc" } });
  // ...re-renders live on every Firestore change
}

A complete Vite + React app is in examples/vite-realtime.

Quality

  • 19 tests (jsdom + Testing Library): client-adapter translation (mocked firebase/firestore) and hook behavior — loading → data, realtime updates on write, where filtering, unmount cleanup.
  • Verified live in the browser against a real Firestore project (add/toggle/delete sync via onSnapshot).
  • Dual ESM + CJS build with type declarations. Core is kept external (a shared dependency), not bundled, so the suite uses a single copy.

Notes for local development

Under pnpm link:, a symlinked copy of firebase can produce two @firebase/app registries ("Service firestore is not available"). Installing from npm avoids this; in a linked monorepo, add resolve.dedupe: ["firebase", "@firebase/app", …] to your Vite config.

The Fireclass suite

Package Runtime For
@dharayush7/fireclass-core none (pure TS) shared modeling core
@dharayush7/fireclass-js firebase-admin Node / Express
@dharayush7/fireclass-ssr firebase-admin Next.js (App Router)
@dharayush7/fireclass-react firebase client SDK React (realtime hooks) — this package

Docs: https://fireclass.ayushdhar.com


Full API and examples: see the README. Changelog: see CHANGELOG.md.