Payload 3.88 runs inside the Next app against the existing Postgres, in
its own 'payload' schema so no pipeline operation on public — the app
tables, Airflow's metadata, migrate_csv_to_db.py --drop — can reach blog
content.
Its REST API is mounted at /cms-api. /api is the FastAPI proxy's
catch-all, which would swallow every admin call and forward it to the
backend with no error. The mount points live in lib/payloadRoutes.ts so
there is one definition and a test can assert it without importing
Payload: it is ESM-only, next/jest will not transform it, and appending
transformIgnorePatterns cannot un-ignore a package. Forcing it through
transpilePackages would change how the production build bundles Payload
to serve a test, so the live proof that /api still reaches FastAPI stays
where it belongs — the e2e journeys, which call /api/schools.
The package becomes ESM ("type": "module"), which Payload's CLI requires:
richtext-lexical has top-level await and the config cannot be require()d.
Only two files needed renaming, jest.config.cjs and a build script.
The build is verified to succeed with DATABASE_URL and PAYLOAD_SECRET
both unset, which is how CI builds it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017YmbBhr8s7GusjDE12hrZM
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
/**
|
|
* Root layout for the Payload admin panel.
|
|
*
|
|
* This is a SECOND root layout: it renders its own <html>/<body>, as does
|
|
* app/(frontend)/layout.tsx. Next permits that only while no app/layout.tsx
|
|
* exists — which is why the site's routes were moved into (frontend). Adding
|
|
* an app/layout.tsx would nest the admin panel inside the site's nav, footer
|
|
* and providers and emit nested <html>.
|
|
*/
|
|
import type { ServerFunctionClient } from 'payload';
|
|
import config from '@payload-config';
|
|
import { RootLayout, handleServerFunctions } from '@payloadcms/next/layouts';
|
|
import { importMap } from './admin/importMap.js';
|
|
import '@payloadcms/next/css';
|
|
|
|
const serverFunction: ServerFunctionClient = async function (args) {
|
|
'use server';
|
|
return handleServerFunctions({ ...args, config, importMap });
|
|
};
|
|
|
|
export default function PayloadLayout({ children }: { children: React.ReactNode }) {
|
|
return (
|
|
<RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
|
|
{children}
|
|
</RootLayout>
|
|
);
|
|
}
|