@themodcraft/nextramice-next
v0.1.0
Published
Next.js server helpers and client hooks for Nextramice authentication.
Readme
@themodcraft/nextramice-next
Next.js server-session helper plus the Nextramice React client API.
Install
npm install @themodcraft/nextramice-next @themodcraft/nextramice-core @themodcraft/nextramice-react next reactServer Component or Route Handler
import { headers } from "next/headers";
import { getNextramiceSession } from "@themodcraft/nextramice-next/server";
export async function GET() {
const requestHeaders = await headers();
const session = await getNextramiceSession({
baseUrl: process.env.NEXTRAMICE_BFF_URL!,
cookie: requestHeaders.get("cookie") ?? "",
});
return Response.json(session);
}The helper forwards the incoming cookie and disables fetch caching.
Client Component
"use client";
import { NextramiceProvider, useUser } from "@themodcraft/nextramice-next/client";The client entry point re-exports the React provider and hooks. Place the
provider in a Client Component; keep getNextramiceSession in server-only code.
