Alapinstalláció a Payload CMS-re való áttéréshez (EPIC MITHOME-85): - payload@3.88.0, @payloadcms/next, @payloadcms/db-mongodb, @payloadcms/richtext-lexical, graphql, sharp telepítve - src/payload.config.ts: mongooseAdapter a meglévő MONGODB_URI-ra (ugyanaz az adatbázis, mint a Mongoose/mongodb rétegnek), lexical editor, PAYLOAD_SECRET env-ből - src/collections/Users.ts: minimális auth collection — Payload nem tud admin felületet renderelni auth collection nélkül. Ez csak a bootstraphez kell; a valódi access control/jelszó-politika MITHOME-90 feladata. - App Router route group (src/app/(payload)/): admin UI ([[...segments]]), REST (api/[...slug]), GraphQL + playground route-ok, root layout — a szokásos Payload v3 Next.js integrációs minta szerint - next.config.ts: withPayload() wrapper a route handler bundling-hoz - tsconfig.json: @payload-config path alias -> src/payload.config.ts (ez oldja fel a webpack/turbopack importot is, nem csak a type-checket) - PAYLOAD_SECRET env var: generált dev érték a .env.local-ban (gitignore-olt), changeme placeholder + generálási megjegyzés a staging/production .env példafájlokban, dokumentálva a CLAUDE.md env-lista részében Ismert, még nem javított biztonsági advisory a felvett payload@3.88.0-ban (GHSA-jg8r-5jh2-v2xj, moderate, CWE-307: az admin account-unlock alapból más fiókok lockoutját is felold hitelesített usernek) — nincs újabb patch-elt verzió jelenleg, nyomon követve MITHOME-90 alatt. Ellenőrizve ezen a commiton: npm run build, npm run lint, tsc --noEmit, npm test (58 passed) — mind zöld. Az admin bejelentkezés/DB-kapcsolat élő tesztje MongoDB-t igényel (jelen környezetben Docker daemon nem fut, ez lokálisan `docker compose -f docker-compose.dev.yml up -d mongodb` után `npm run dev` + http://localhost:3000/admin-mal ellenőrizhető). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
79 lines
2.3 KiB
TypeScript
Executable File
79 lines
2.3 KiB
TypeScript
Executable File
import type { NextConfig } from "next";
|
|
import { withPayload } from "@payloadcms/next/withPayload";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Enable standalone output for Docker deployment
|
|
output: 'standalone',
|
|
|
|
// NOTE (Next.js 16): `eslint.ignoreDuringBuilds` was removed — `next build`
|
|
// no longer runs ESLint itself (lint is now only `next lint` / `npm run lint`),
|
|
// so there is nothing left to ignore here.
|
|
|
|
// Skip TypeScript checking during build (for faster Docker builds)
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
|
|
// Optimize for production builds — Turbopack rules moved from the deprecated
|
|
// experimental.turbo to the top-level turbopack key (Next 15.5).
|
|
turbopack: {
|
|
rules: {
|
|
'*.svg': {
|
|
loaders: ['@svgr/webpack'],
|
|
as: '*.js',
|
|
},
|
|
},
|
|
},
|
|
|
|
// Image optimization
|
|
images: {
|
|
formats: ['image/webp', 'image/avif'],
|
|
minimumCacheTTL: 60 * 60 * 24 * 30, // 30 days
|
|
},
|
|
|
|
// Security headers
|
|
async headers() {
|
|
return [
|
|
{
|
|
// Security headers apply to every route, including static assets.
|
|
source: '/:path*',
|
|
headers: [
|
|
{
|
|
key: 'X-Frame-Options',
|
|
value: 'DENY',
|
|
},
|
|
{
|
|
key: 'X-Content-Type-Options',
|
|
value: 'nosniff',
|
|
},
|
|
{
|
|
key: 'Referrer-Policy',
|
|
value: 'origin-when-cross-origin',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
// WHY: no-cache must not hit hashed build assets (_next/static) or
|
|
// optimized images (_next/image); they are content-addressed and rely on
|
|
// long-lived caching. Overriding them would re-download the bundle on
|
|
// every page load.
|
|
source: '/((?!_next/static|_next/image).*)',
|
|
headers: [
|
|
{
|
|
key: 'Cache-Control',
|
|
value: 'private, no-cache, must-revalidate, max-age=0',
|
|
},
|
|
{ key: 'Pragma', value: 'no-cache' },
|
|
{ key: 'Expires', value: '0' },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
// MITHOME-86: bundles the admin UI's route handlers correctly under
|
|
// Turbopack/webpack. `@payload-config` itself resolves via the `paths`
|
|
// alias in tsconfig.json (./src/payload.config.ts) — this wrapper's
|
|
// installed version has no separate configPath option.
|
|
export default withPayload(nextConfig);
|