Releases: dharayush7/fireclass-ssr
Release list
v2.0.9
fireclass-ssr v2.0.9
@dharayush7/fireclass-ssr v2.0.9 brings the complete Next.js App
Router documentation to the npm package page.
What changed
- Added the Fireclass logo and removed npm, license, and type shield badges.
- Documented root and client entry points, server-only boundaries, credential
precedence, private-key newline handling, and memoized Admin initialization. - Added complete server model, Server Component, Client Component, RSC
serialization, date revival, and Server Action examples. - Documented action results, initialization cache behavior, and serialization
limitations. - Expanded npm keywords for App Router, Firebase Admin, React Server
Components, Server Actions, serverless runtimes, 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-js ^2.0.8.
Verify
npm run typecheck
npm test
npm run build
npm pack --dry-runDocumentation: https://fireclass.ayushdhar.com/docs/api/ssr
v2.0.8
fireclass-ssr v2.0.8
@dharayush7/fireclass-ssr — the first public release of the Fireclass suite's Next.js (App Router) runtime.
It builds on @dharayush7/fireclass-js and adds the pieces a Next.js app needs to use firebase-admin models safely and ergonomically.
Highlights
getFireclass(options?)— a memoized{ BaseModel, adapter }bound to aglobalThis-cached firebase-admin singleton that survives HMR and warm lambda invocations (no "app already exists" crash).initFireclassAdmin(options?)— the underlying admin singleton, resolving credentials from an explicit service account (object or JSON string), env vars (FIREBASE_*/PROJECT_ID·CLIENT_EMAIL·PRIVATE_KEY, with\nunescaping), or Application Default Credentials.- RSC serialization bridge —
serialize/serializeList/reviveDates(Dates ↔ ISO strings), exported from both.and a dependency-free./cliententry so Client Components pull no admin/firebase code. runAction(fn)— a Server Action wrapper that turns Fireclass errors into a typedActionResult(ideal foruseActionState).server-onlyboundary on the main entry, so an accidental client import is a build error. Re-exports the fullfireclass-js(and core) API.
Why it's optimized for Next.js
server-onlykeeps admin models out of client bundles.- The admin app is a
globalThissingleton — one Firestore instance across HMR / route segments / warm starts. - Client Components import the dependency-free
/cliententry, sofirebase-adminnever enters the browser bundle.
Install
npm install @dharayush7/fireclass-ssr firebase-admin class-validator class-transformerfirebase-admin, class-validator, class-transformer, and next are peers. @dharayush7/fireclass-js (^2.0.8, which pulls in core) is a regular dependency. Enable decorators in tsconfig.json:
{ "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true } }Quick look
// lib/fireclass.server.ts
import "server-only";
import "reflect-metadata";
import { getFireclass, Collection } from "@dharayush7/fireclass-ssr";
import { IsString, Length } from "class-validator";
const { BaseModel } = getFireclass();
@Collection("posts")
export class Post extends BaseModel<Post> {
@IsString() @Length(1, 120) title!: string;
createdAt?: Date;
constructor(data?: Partial<Post>) { super(data); Object.assign(this, data); }
}// app/page.tsx — Server Component
import { serializeList } from "@dharayush7/fireclass-ssr";
import { Post } from "@/lib/fireclass.server";
import { PostList } from "./post-list"; // Client Component using "@dharayush7/fireclass-ssr/client"
export const dynamic = "force-dynamic";
export default async function Page() {
const posts = await Post.findMany({ orderBy: { createdAt: "desc" } });
return <PostList initial={serializeList(posts)} />;
}A complete App Router app is in examples/next-app.
Import rule
Server Components / Route Handlers / Server Actions import from @dharayush7/fireclass-ssr (guarded by server-only). Client Components import from @dharayush7/fireclass-ssr/client (no admin/firebase code).
Quality
- 18 tests: serialization round-trips, admin memoization + every credential path, and the action wrapper.
- The App Router example
next builds cleanly — route dynamic, ~102 kB First Load JS with nofirebase-adminin the client bundle. - Dual ESM + CJS build with type declarations for both
.and./client.fireclass-jsis kept external (single shared copy across the suite).
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) — this package |
@dharayush7/fireclass-react |
firebase client SDK | React (realtime hooks) |
Docs: https://fireclass.ayushdhar.com
Full API and examples: see the README. Changelog: see CHANGELOG.md.