Tutorial sa a se premye a nan yon gid konplè pou kreye yon sistèm ki baze sou yo kreye paj entènèt otomatikman lè l sèvi avèk React 19 ak Next.js 15. Koncentrasyon nou an se pa sèlman sou vitès la, men sou elegans arsitekturèl ak konsistan, sou-mark konsepsyon. Lojisyèl Open Source: (https://github.com/aifa-agi/aifa) nan peyi Zend Isit la se Roadmap la: Pwodwi 1 (Ou se isit la): Arkitektur debaz diving - capch-all routes, PageHtmlTransformer konpozan, ak konfigirasyon paj ki te fòme. Pandan 2: Tip paj avanse—automatize paj dokiman ak tutoryèl entèaktif. Pati 3: Entegre motè AI - konekte modèl ekstèn (ChatGPT, Claude) ak ajan aifa enteryè nou an pou kontinyèl, otonòm jenerasyon kontni. Bonus: Casestudy - deplwaye, monetize, ak skalasyon nan yon SaaS AI-klas pwodiksyon ak enskripsyon itilizatè ak peman Stripe. Sa a etap-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa-pa nan Teknoloji Stack: React 19 · Next.js 15 · Vercel · Prisma · Stripe · AI SDK · ChatGPT Platfòm nou an konbine estabilite enterprise-grade ak inovasyon bleedingedge: React 19 & Next.js 15 ak App Router livrezon sub-100ms rendè ak vwayaj paralèl verite. Vercel pèmèt deplwaman zèz-downtime ak Global Edge Scaling. Prisma & Neon asire kalite-sèf ak vitès flash done aksè. Stripe trete imedyatman, PCI-kompatib peman soti nan bwat la. AI SDK + ChatGPT layer nan entelijan jeneratif, se konsa AIFA Dev Starter ka ranplase UI konplè, modil kontni, ak prototip nan minit - konplè ak entegre otantifikasyon ak multilingual AI chat. Ki jan li travay Prompt: voye yon sèl demann lang natirèl nan ChatGPT. Jwenn yon PageConfig ki baze sou JSON ki defini seksyon, metadata, ak layout nan paj ou. Build: Drop dosye a konfig nan Next.js app ou ak kouri npm kouri bati. Imedyatman ou gen yon paj konplètman style, SEO-prepare, konplètman ak auth ak AI-powered chat. Èske ou bezwen entegre antrepriz? Senpleman chanje sou "v0 Corporate Mode" nou an nan [upcoming aifa.dev(https://aifa.dev)] pou avanse otomatik, aksè ki baze sou wòl, ak arsitektur microservices skalab. Èske ou bezwen entegre antrepriz? Senpleman chanje sou "v0 Corporate Mode" nou an nan [upcoming aifa.dev(https://aifa.dev)] pou avanse otomatik, aksè ki baze sou wòl, ak arsitektur microservices skalab. Ki genyen ak yon AI-powered sit jeneratè? Studio, Enterprises, Startups, ak Freelancers Next-Generation Design Agency: soti nan Mockup nan pwodiksyon mas nan minit Imajine yon ajans ki enstiti ekosistèm teknoloji skalab, pa jis mockups estatique. Yon sèl envestisman anvan an nan yon livrezon konpozan pwopriyete louvri kapasite yo kreye ak deplwaye plis pase 50 sit wèb klas pwodiksyon pou chak èdtan. Li se yon nouvo paradigm operasyonèl kote kapital kreyatif satisfè egzekisyon otomatik. Epi ak entegre Stripe entegre, ou ka monetize sa a nouvo vitès soti nan jou a premye. Nou pral eksplore sa a pi plis nan yon pòs pi lwen. Implemantasyon Enterprise: Konsistans mak ak radikalize Scalability Yon klasik antrepriz itilizasyon ka: yon solisyon QR men klavye pou yon franchis restoran nasyonal. Ou bati yon sistèm konsepsyon mèt pou eksperyans itilizatè prensipal - tankou kat pwodwi oswa men - jis yon sèl fwa. Sa a devlope yon solisyon blan-label ou ka deplwaye nan dè santèn de franchisè oswa kote. Chak kote Customize mak li yo ak kontni atravè yon entèfas senp, pandan y ap core UX, pèfòmans, ak konsepsyon entegrite rete bloke ak konsistan. Sa a se trifecta nan mache antrepriz mande nan 2025: nan E . radical scalability bulletproof brand consistency unmatched speed-to-market Motè a debaz la: JSON-to-React Transformer Architecture nou an Tout sistèm sa a se kondwi pa de konpozan kritik: Intelligent Prompt Engineering We use highly-tuned instructions that command the AI to pull battle-tested section templates from a vector database and tailor them to your specific request. The Component Transformer Architecture Our React components are engineered to interpret these JSON configs, instantly transforming them into fully-rendered, interactive pages. Pandan ke modèl ekstèn tankou ChatGPT ak Claude sove kreyasyon kontni, konpozan transformatè pwopriyete nou yo se motè a kòrèk nan sistèm la - pati nou bati pou garanti pèfòmans ak konsepsyon fidèl. Dokiman AI-Native: Sèvi ak Tutorial sa a kòm yon baz konesans viv Stop nan Dokiman. kòmanse Li nan. Li nan Komandè se pouvwa a reyèl nan gid sa a pa nan li nan kouvèti-a-kouvèti. Li fèt yo dwe pwojè ou a prive, baz konesans ekspè. Ki jan yo travay: Feed dokiman sa a tout antye nan ChatGPT. Kite kesyon spesifik, kontekstual: "Ki jan mwen aplike yon seksyon Custom?", "Ki jan se objektif la nan FullScreenWrapper?", "Montre m 'kòd la pou eleman an DoublePresentation." Receive presizyon, pwodiksyon-zanmitay repons ak koutim koòd konplè. Li pa sèlman dokiman; li se yon playbook aksyonab. Teste metòd sa a, epi ou pral konprann poukisa tout dokiman teknik nan 2025 bezwen yo AI-native. 1. Entwodiksyon: Filozofi nou an - Konsistans Trump vitès Raw Guid sa a se pa sou kreyasyon nan pi vit AI paj jeneratè posib. Pandan ke zouti AI tankou v0 priorite vitès jenerasyon an brik, metòd nou an konsantre sou yon metrik biznis plis kritik: Objektif prensipal nou an se livrezon konsepsyon konsepsyon bulletproof ak harmoni achitekti atravè tout anpeche dijital ou. Total Cost of Ownership (TCO) Malgre ke jenerasyon an inisyal nan yon sèl paj ka pran yon ti kras plis tan, envestisman ki anba a nan devlopman, manman, ak jesyon mak yo eksponansyèl. Isit la se poukisa kompromis sa a bay ROI siperyè: Bulletproof Brand Konsistans: Tout paj ki te kreye pa AI se otomatikman konpatib ak sistèm konsepsyon etabli ou. Pa gen konpozan rogue, pa gen styling soti nan mak la. Konplèks Eksperyans itilizatè: Arkitektur la asire yon vwayaj harmoni ak koze pou itilizatè a, elimine inkonsistan yo enkyetid ki komen nan sit yo byen vit-genere. Radikally Reduced Rework: Pa egzekite estanda nan pwen la nan kreyasyon, nou minimize ankouraje manyen chè ak tan-consommant ki tipikman mande pou post-gen. True Architectural Scalability: Pwosesis nou an devlope plis efikasite lè ou skalè. Pandan ke plis paj ou kreye, pi gwo revni nan vitès ak konsistans. The result isn't just a collection of pages; it's a cohesive, professional-grade digital asset that scales gracefully with minimal maintenance overhead. Plis pase fondamantal yo: Handling reyèl mond konplèksite Tutorial sa a orijinal konsantre sou bati paj estanda ak koutim nou an nan E konpozan. Sepandan, baz la kòd louvri bay avanse, solisyon soti nan bwat la pou kondisyon ki pi konplèks: Header Body Footer Paj dokimantasyon ak avanse, navigasyon enkli. Interactive Tutorial Pages ak stateful, etap-pa-etap eleman. Architecture nou an fèt pou ekstansibilite. Pou karakteristik inik, segondè-interaktif - tankou prezantasyon anime, tablo done tan reyèl, oswa konpozan ak jesyon estati konplèks - ou ka enjecte dirèkteman nan pipeline a Rendering. Sa a bay ou fleksibilite nan implemantasyon fonksyonèl Customized san yo pa janm kompromèt entegre sistèm la. Custom Components Your Next Step: Hands-On with Custom Components Pou reyèlman pwopriyete sistèm sa a, travay pratik ou a se eksplore pwosesis la nan kreye ak entegre yon nouvo konpozan Custom. Sa a pral solidifye konprann ou nan pouvwa ak fleksibilite nan arsitektur la. Konsep la: AI kòm Brand Steward ou, pa jis yon motè kontni Operasyon dijital modèn mande pou vitès, entegrite mak, ak agility mache. Arkitektur nou an reyalize sa a pa trete sistèm konsepsyon ou kòm yon estrikti, baz konesans entelijan. Formalized, pre-apwouve definisyon pou chak seksyon kritik mak (Hero, CTA, FAQ, Karakteristik, elatriye) yo anpeche pa AI. Pa manje AI a estanda UI / UX ou egzak, li vin plis pase yon jeneratè kontni - li vin administratè a ultim nan idantite mak ou, aplike konsistans nan chak etap nan sik la lavi kreyasyon paj. 1.2. Workflow nan 5 etap: soti nan konsepsyon sistèm nan SEO optimize bati Ingest sistèm konsepsyon ou: Nou chaje baz la konesans AI a ak modèl eleman ou ak enstriksyon eksplisit sou ki jan yo aplike yo vizyèlman ak estriktirèlman, asire 100% alignment mak. Defini objektif la ak yon Prompt: Yon itilizatè, yon manadjè pwojè, oswa yon devlopè soumèt yon pwopriyete tèks senp ki dekri paj la vle oswa eleman li yo. AI Interpretation & Structuring: Ajan an AI analize demann la, kreye kontni semantik la, ak entelijan maps li nan modèl apwopriye, anvan apwouve soti nan baz la konesans. Genere yon Deklaratif PageConfig: Dapre modèl yo chwazi, sistèm la pwodui yon PageConfig ki te tipize byen - yon deskripsyon JSON deklaratif nan paj final la. Sa a garanti konpatibilite mak ak senplize devlopman downstream. Automated Build & Deployment: Konfig la se konsomasyon pa eleman rendu nou an pandan pwosesis la konstriksyon. pwodiksyon an se yon pwodiksyon pare, SEO optimize paj ki vizyèlman ak teknikman konpatib ak estanda antrepriz ou. 1.3. Impact biznis la: Drive konvèsyon ak Slash TCO Accelerated Go-to-Market: Lanse nouvo destinasyon ak paj pwodwi ak yon sèl prompt, lè l sèvi avèk modèl ki pre-apwouve pou vitès inik. Ironclad Brand Integrity: Konsistans mak ak kontwòl bon jan kalite yo otomatikman, asire chak paj nouvo pafè refleksyon sistèm konsepsyon ou. Reduced Manual Overhead & Scalable A / B Tès: Pèmèt ekip marketing yo skalè varyasyon paj ak A / B tès kontni san yo pa enplike devlopè nan pwosesis la layout. Te bati pou Global Scale: Tout eleman tèks ak UI yo santralize, fè lokalizasyon ak adaptasyon mache san danje. Architectural fleksibilite: fèt pou entegre byen nan modèn CI / CD pipelines, platfòm hosting, ak lòt flux travay AI-done. 1.4. Roadmap ou nan seri sa a Nan tutorial sa a konplè, nou pral gid ou nan: Dekonstriksyon an nan Architecture Core: Yon dyamèt nan PageHtmlTransformer, sistèm Wrapper / FullScreenWrapper, ak ki jan eleman seksyon entèraksyon. Mastering Rendering Pipeline: Konpreyansyon an nan logik la ki anba a seksyon rendering, konfigirasyon typing, ak relasyon an ant dosye konfig ak konpozan React, se konsa ou ka pwolonje sistèm an tèt ou. Aprann enstriksyon nan AI: Aprann ki jan yo kreye enstriksyon estrikti pou metadata, header, ak footer, ak defini espesifikasyon pou jere kontni kò kòm yon fragman JSX. Generating Pages on Demand: Aplike konesans ou yo kreye dosye konfig ke AI a sèvi ak yo kreye paj ki konplètman konpatib ak estanda enstriktè ou ak konsepsyon. 2. Anatomi a nan Architecture AI-powered nou an Pwojè nou an se òganize pou maksimize skalabilite, mantal, ak vitès devlopman. Nou itilize Next.js 15 konvansyon App Router, ki gen ladan wout paralèl ( ) ak dosye prive ( ), yo kreye yon estrikti limyè ak fò. @right _folder Pwojè Directory Tree app/@right/ ├── public/ │ ├── (_routing)/ │ │ └── [[...slug]]/ │ │ └── page.tsx # 1. Dynamic Catch-All Route Handler │ └── (_service)/ │ ├── (_config)/ │ │ └── public-pages-config.ts # 6. AI-Generated Page Configurations │ └── (_libs)/ │ └── utils.ts # 7. Configuration Utilities └── (_service)/ ├── (_types) │ └── page-wrapper-types.ts # 5. The TypeScript Data Contract (AI <-> UI) └── (_components)/ └── page-transformer-components/ ├── page-html-transformer.tsx # 2. The Core Page Transformer Engine ├── custom-sections/ # Directory for complex, interactive components ├── wrappers/ │ ├── full-screen-wrapper.tsx # 3. Immersive Full-Screen Wrapper │ └── wrapper.tsx # 4. Standard Content Section Wrapper ├── header-sections-components/ │ ├── header-section.tsx # 8. Standardized Header Component │ ├── page-header-elements.tsx # 9. Atomic Header Elements (H1/H2) │ └── announcement.tsx # 10. Announcement Banner Component ├── body-sections-components/ │ └── body-section.tsx # 12. Flexible Body Content Container └── footer-sections-components/ └── footer-section.tsx # 11. Standardized Footer Component Enter mòd Ekran plen Exit mòd Ekran plen Key Component Paths nan 1. @/app/@right/public/(_routing)/[[...slug]]/page.tsx 2. @/app/@right/(_service)/(_components)/page-transformer-components/page-html-transformer.tsx 3. @/app/@right/(_service)/(_components)/page-transformer-components/wrappers/full-screen-wrapper.tsx 4. @/app/@right/(_service)/(_components)/page-transformer-components/wrappers/wrapper.tsx 5. @/app/@right/(_service)/(_types)/page-wrapper-types.ts 6. @/app/@right/public/(_service)/(_config)/public-pages-config.ts 7. @/app/@right/public/(_service)/(_libs)/utils.ts 8. @/app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/header-section.tsx 9. @/app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/page-header-elements.tsx 10. @/app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/announcement.tsx 11. @/app/@right/(_service)/(_components)/page-transformer-components/footer-sections-components/footer-section.tsx 12. @/app/@right/(_service)/(_components)/page-transformer-components/body-sections-components/body-section.tsx Enter mòd Ekran plen Exit mòd Ekran plen The Core Component Toolkit: Production-Ready paj soti nan bwat la Objektif Bibliyotèk konpozan estanda nou an bay fondasyon an konstriksyon pou kreyasyon sit wèb ki gen gwo tip, mak aliye nan gwosè. Koleksyon sa a konpoze pilar yo arsitèktirèl nan sistèm nou an: routaj dinamik, yon motè transformateur santral, envètisè kontni varyab, seksyon header ak footer inifòmèl, ak dosye konfigirasyon yo ak kontra done ki kondwi yo. Prensip ki pi enpòtan nan Architecture: Bulletproof UI Konsistans: Chak konpozan adheres a yon sistèm konsepsyon inifòm ak modèl pèfòmans, asire yon eksperyans itilizatè san danje ak prediktif. AI-Native by Design: Arkitektur la se optimisé pou generasyon otonòm, ki pèmèt AI a bati paj konplèks san yo pa entèdi manyen. SEO-Optimized soti nan Ground Up: Pi bon pratik pou optimizasyon motè rechèch ak semantik HTML yo bak nan, pa bolt sou. Type-Safe & Predictable: Nou sèvi ak typing estrikti nan TypeScript pou egzekite yon kontra done serye ant AI a ak UI a, asire estabilite nan sistèm. Modilè & Composable: Chak konpozan se yon inite pwòp tèt li ki solisyon yon pwoblèm espesifik, ki fèt pou maksimòm re-usabilite ak extensibilite. Konbine, sa yo konpozan yo fòme fondasyon an nan sistèm la, garanti ke chak paj ki te kreye pa AI se pa sèlman vizyèlman koze, men tou teknikman robust ak enterprise-ready. 2.1.1 nan Konpozan: Universal Catch-All Route pou URL dinamik [[...slug]]/page.tsx 2.1.1.1. Valè a estratejik nan Catch-All Routes: Agility ak vitès nan deplwaman Yon rout tout-pwopriye se yon modèl dinamik routaj nan Next.js ki pèmèt yon sèl paj konpozan pou travay ak yon kantite infinite segman URL. Konvansyon an, nan paramèt devlope yon matris ki gen chak pati nan chemen URL a, pa gen pwoblèm ki jan profondman li se nòt. [[...slug]] slug Soti nan yon perspektif biznis, chwa sa a arsitektyèl se yon gwo avantaj konpetitif. Isit la se poukisa: Yon URL tankou /public/category/nike/sneakers/black/12345 se manipile pa eksakteman menm konpozan a kòm /public/test. Sa a debloke kapasite a yo bati kataloz pwodwi ki byen hierarki, sit dokimantasyon, oswa bibliyotèk kontni san yo pa mande pou nenpòt chanjman nan baz la kòd. Navigasyon Frictionless ak Instant Pages Launches: Devlope yon paj nouvo se menm jan senp tankou ajoute konfigirasyon li yo nan yon dosye santral. Paj la ap viv imedyatman san yo pa kreye nouvo konpozan oswa navige nan yon sistèm dosye konplèks. Sa a retire estrateji kontni soti nan syèk enjenyè, pèmèt marketing ak ekip pwodwi yo deplase pi vit. Built-in Automation: Arkitektur sa a se fondasyon an pou yon ekosistèm kontni konplètman otomatik. Yon sidebar oswa men otomatikman kreye ka pwograme yo li konfigirasyon paj ak bati navigasyon an dinamikman. Lè ou ajoute yon nouvo konfig paj, navigasyon an mete ajou otomatikman, asire yon eksperyans itilizatè konsistan ak pa gen okenn efò manyen. 2.1.1.2. Valè a nan URL dinamik pou Asistans AI: Infinite Content Scalability Nan peyizaj la konpetitif jodi a, platfòm SaaS ak AI modèn mande pou agilite yo kreye paj nouvo sou vòl la. Si initiated pa yon itilizatè, yon administratè, oswa yon ajan AI otonòm, kontni ta dwe aritekti pou kreye ak deplwaye imedyatman. Nou an aritèktrik routaj capch-all se motè a ki kondwi kapasite sa a. Strategic Business Advantages: Elimine Restrictions Architectural: Li elimine tout limitasyon sou estrikti kontni ak profondite nòt, ki pèmèt prezans dijital ou pou konplètman konplete san yo pa mande pou chanjman kòd. Unlocks Incomparable Agility: Kreye hierarchi kontni konplèks pou nenpòt ka itilizasyon. Navigasyon an se dirab pa logik biznis ou a, pa limite pa yon sistèm dosye rigid. Sa a dekoupe estrateji kontni ou soti nan syèk enjenyè, pèmèt pwodwi ak ekip maketing yo egzekite pi vit. Pèmèt automatisation AI-powered: Arkitektur sa a fèt pou yon mond AI-premye. Li bay yon fondasyon estab pou ajan AI yo otonòmman kreye, konfigirasyon, ak deplwaye seksyon tout antye nan sit ou, soti nan kataloz pwodwi nan baz konesans. 2.1.1.3 Reyèl mond itilizasyon ka nan mas Arkitektur sa a se pa teyori; li se yon modèl batay-teste pou deplwaye valè segondè, profondman enkli estrikti kontni ki kondwi kwasans biznis: Turnkey QR Menu Sistèm: Devlope yon solisyon blan-label pou yon franchis restoran nasyonal. Chak kote ka gen yon men inik, byen kategori (pwa /public/menu/dallas-tx/dinner/mains/pasta-dishes), tout pandan y ap kenbe konsistans mak pafè ak integrite UX. Yon URL tankou /public/shop/apparel/mens/jackets/leather/fall-2025/black/sku-12345 vin trivial yo kreye ak jesyon, pèmèt rapid ekspansyon mache ak granular òganizasyon pwodwi. Portal antrepriz & edikasyon: Bati gwo baz konesans oswa platfòm tutoryal kote kontni ka òganize logikman, pa gen pwoblèm ki jan profòch sa a hierarji bezwen ale (pwa, /public/tutorials/enterprise-ai/onboarding/module-3/advanced-prompting). #### 2.1.1.4. Kouman Li Fonksyone: Motè a nan kontni sou demann At its core, the process is elegantly simple yet powerful: it dynamically translates any URL path into a corresponding page configuration, which is then rendered on the fly. This is the technical foundation that unlocks the business agility described earlier. Task prensipal yo nan eleman an yo: It captures the incoming URL path as an array of segments (e.g., ). Receive the URL: ["category", "nike", "sneakers"] The function proactively reads your file. It informs Next.js of all valid page routes defined in your configuration. For the business, this translates to comprehensive Static Site Generation (SSG), ensuring every page is pre-built for lightning-fast load times and optimal SEO. Generate Static Paths: generateStaticParams public-pages-config.ts export async function generateStaticParams() { const pages: PageConfig[] = getAllPublicPages(); return pages.map((page: PageConfig) => ({ slug: page.metadata.slug ? page.metadata.slug.slice(1) : [], })); } When a user requests a URL, the component receives the array. It then uses the utility to perform a high-speed lookup against the configuration array (prepending for an accurate match). If a match is found, the configuration is passed to our universal component for rendering. Fetch and Render: slug getPageBySlug "public" PageHtmlTransformer export default async function PublicDynamicSlugPage({ params }: Props) { const resolvedParams = await params; const slugArr = resolvedParams.slug ?? []; const pageConfig = getPageBySlug(["public", ...slugArr]); if (!pageConfig) { return Page not found; } return ; } Pandan ke can be of any length and the lookup is a direct match, this system provides infinite nesting depth with zero risk of route collisions. slugArr 2.1.5. fonksyon prensipal yo ak enpak biznis yo generateStaticParams: Drives pèfòmans & SEO pa di Next.js ki 2.1.1.7. konpozan an: motè a nan egzekisyon This component is the engine that brings our AI-powered architecture to life. It's a single, powerful Next.js Server Component that acts as a universal handler for every dynamically generated public page. It is responsible for fetching the correct page configuration based on the URL and orchestrating the final render, ensuring both maximum performance and out-of-the-box SEO compliance. // @/app/@right/public/(_routing)/[[...slug]]/page.tsx import { PageHtmlTransformer } from "@/app/@right/(_service)/(_components)/page-transformer-components/page-html-transformer"; import { getPageBySlug } from "@/app/@right/(_service)/(_config)/pages-config"; import { constructMetadata } from "@/lib/construct-metadata"; import type { PageConfig } from "@/app/@right/(_service)/(_types)/page-wrapper-types"; import { getAllPublicPages } from "../../(_servise)/(_libs)/get-all-public-pages"; interface Props { params: Promise<{ slug?: string[] }>; } export async function generateStaticParams() { const pages: PageConfig[] = getAllPublicPages(); return pages.map((page: PageConfig) => ({ slug: page.metadata.slug || [], })); } export async function generateMetadata({ params }: Props) { const resolvedParams = await params; const slugArr = resolvedParams.slug ?? []; const pageConfig = getPageBySlug(["public", ...slugArr]); if (!pageConfig) return {}; return constructMetadata(pageConfig.metadata); } export default async function PublicDynamicSlugPage({ params }: Props) { const resolvedParams = await params; const slugArr = resolvedParams.slug ?? []; const publicPageConfig = getPageBySlug(["public", ...slugArr]); if (!publicPageConfig) { return <div>Page not found</div>; } return <PageHtmlTransformer data={publicPageConfig} />; } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.1.7. The Bottom Line: Catch-All Routes as Your AI Content Engine Yon konbinezon nan ranpli tout wout ak yon konfigirasyon paj santralize kreye yon estrikti ki se maksimòm fleksib, extensible, ak objektif bati pou òkestrasyon kontni ki baze sou AI. Sa a apwòch se amizman pou tou de devlopè yo ak ajan AI, kreye yon kouri travay san danje soti nan konsèp la nan deplwaman. Prensip prensipal la se senp, men transformatif: No new code files, no complex folder structures. The navigation and rendering systems adapt automatically, making this the cornerstone of a truly agile and scalable AI-powered platform. A new page is just a new entry in a configuration file. 2.1.3. FullScreenWrapper vs. Wrapper: Crafting Imersive eksperyans plen-ekran 2.1.3.1 Objektif prensipal The se espesyalman devlope pou seksyon ki mande pou yon prezantasyon immersif, plen ekran ak background videyo oswa imaj sipò. Li sèvi kòm konte a fondasyon pou "jè" seksyon, kote kontni se elegantman kouvri sou tèt eleman medya rich. FullScreenWrapper 2.1.3.2 Architecture nan katye The component uses a sophisticated layered structure to ensure content remains legible and visually distinct from the background. Technical Highlights: : Guarantees the section fills the entire viewport height, creating a captivating, full-bleed effect. min-h-screen Positioning: Enables precise control for stacking elements. relative z-index / ): Positioned with and to sit behind all other content. Background Elements ( video img absolute z-0 : Uses positioning with to ensure it always appears above the background. Content Container relative z-10 <section className="relative flex min-h-screen flex-col py-10 lg:py-14 bg-background"> {backgroundElement} // z-0 <div className="relative z-10 flex flex-col flex-1"> {children} // Header → Body → Footer </div> </section> Enter mòd Ekran plen Exit mòd Ekran plen 2.1.3.3 Customization ak ekstansibilite The se fèt pou Customization fasil. Ou ka ajoute efè vizyèl konplèks dirèkteman atravè Pwodwi pou FullScreenWrapper className <FullScreenWrapper className="bg-gradient-to-br from-blue-900 to-purple-900"> Enter mòd Ekran plen Exit mòd Ekran plen : Background videos automatically receive an class to improve text readability, but this can be easily overridden. Opacity Control opacity-40 : A class is built-in to ensure smooth changes to background properties. Smooth Transitions transition-all duration-500 2.1.3.4. Advanced Styling and Reusable Templates Kòm ou bezwen divizyon seksyon, limit, efè glise, oswa blòk background, bay fondasyon an ideyal pou implemantasyon style sa yo. Sa a fè li pafè pou kreye modèl trè estilize, re-userable. FullScreenWrapper typescript <FullScreenWrapper className="border-t-4 border-gradient bg-blur-effect"> Enter fullscreen mode Exit fullscreen mode 2.1.3.5. The Component // @/app/@right/(_service)/(_components)/page-transformer-components/wrappers/full-screen-wrapper.tsx import React, { HTMLAttributes } from "react"; import { cn } from "@/lib/utils"; interface FullScreenWrapperProps extends HTMLAttributes<HTMLDivElement> { videoUrl?: string; imageUrl?: string; className?: string; children: React.ReactNode; } export function FullScreenWrapper({ videoUrl, imageUrl, className, children, ...props }: FullScreenWrapperProps) { let backgroundElement: React.ReactNode = null; if (videoUrl) { backgroundElement = ( <video className="absolute inset-0 size-full object-cover z-0 opacity-40 transition-all duration-500" autoPlay loop muted playsInline src={videoUrl} /> ); } else if (imageUrl) { backgroundElement = ( <img className="absolute inset-0 size-full object-cover z-0" src={imageUrl || "/placeholder.svg"} alt="Background" /> ); } return ( <section className={cn( "relative flex min-h-screen flex-col py-10 lg:py-14 bg-background", className )} {...props} > {backgroundElement} <div className="relative z-10 flex flex-col flex-1">{children}</div> </section> ); } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.4. Wrapper: The Standard Sectional Container 2.1.4.1. Primary Use Case The se default, go-to container pou pifò seksyon kontni. Li fèt yo bay estanda padding, santre kontni, ak yon konsepsyon konsistan, previzib pou blòk enfòmasyon. Wrapper 2.1.4.2 Estrikti ak estrikti nan typescript <section className="py-10 lg:py-14 bg-background"> <div className="container mx-auto px-4"> {children} // Header → Body → Footer </div> </section> Enter fullscreen mode Exit fullscreen mode The component's structure is simple and optimized for performance, relying on a few key Tailwind CSS classes: py-10 lg:py-14: Sèvi ak responsive vertical padding pou konsistans espasyon atravè aparèy. : Creates a centered, max-width container with horizontal padding, ensuring content is well-aligned and readable. container mx-auto px-4 : Utilizes the current theme's CSS variable for the background color, ensuring seamless integration with light/dark modes. bg-background 2.1.4.3. Customization Points Malgre ke minimalist pa konsepsyon, is a flexible foundation for custom styling via the prop. It's the perfect base for adding: Wrapper className Custom background colors or gradient effects. Borders or dividers between sections. Subtle visual enhancements like blur or glow effects. 2.1.4.4. Building Reusable Templates typescript // Пример для pricing-секций <Wrapper className="bg-gradient-to-br from-green-50 to-green-100 border-2 border-green-200"> <HeaderSection /> <PricingTable /> <FooterSection /> </Wrapper> Enter fullscreen mode Exit fullscreen mode When your design calls for a template with unique styling but a standard, centered content structure, se chwa a ideyal. Li bay eskalye a estrikti, ki pèmèt ou konsantre sou estil yo spesifik nan modèl la. Wrapper 2.1.4.5 Konpozan nan // app/@right/(_service)/(_components)/page-transformer-components/wrappers/wrapper.tsx import React, { HTMLAttributes } from "react"; import { cn } from "@/lib/utils"; interface WrapperProps extends HTMLAttributes<HTMLDivElement> { className?: string; children: React.ReactNode; } export function Wrapper({ className, children, ...props }: WrapperProps) { return ( <section className={cn("py-10 lg:py-14 bg-background", className)} {...props} > <div className="container mx-auto px-4">{children}</div> </section> ); } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.5. page-wrapper-types.ts: Kontrat la nan AI-to-UI TypeScript 2.1.5.1. Kontrat la Kòz: Bridging AI Generation ak UI Rendering The file establishes a formal, strictly-typed contract between our AI content generator and the UI rendering system. This contract is fundamental to our architecture, defining the structure of all possible page components and the rules governing their interactions to ensure seamless integration and predictability. page-wrapper-types.ts 2.1.5.2. SectionType Categories and AI-Driven Generation The AI's operational model is centered around the enum. First, the AI analyzes the available section types defined within this enum. Then, based on the user's request, it strategically selects which sections to assemble for a given page. To facilitate fully autonomous and high-quality content generation, the AI's knowledge base must be populated with comprehensive instructions and diverse examples for each of the 25+ section types. SectionType typescript export type SectionType = | "hero-section" | "cta-section" | "faq-section" | "features-section" | "testimonials-section" | "pricing-section" Enter fullscreen mode Exit fullscreen mode 2.1.5.3. SEO Optimization and Metadata The interface ensures the standards-compliant generation of meta tags, which is critical for search engine optimization (SEO). Meta tags are generated automatically via the function. This function retrieves data from the page configuration and passes it to the sèvis piblik, ki nan chemen an konstrike tèt HTML byen fòme. PageMetadata generateMetadata() constructMetadata() typescript export interface PageMetadata { id: string; // Уникальный идентификатор title: string; // <title> тег для SEO description: string; // <meta description> для сниппетов image?: string; // Open Graph изображение slug?: string[]; // URL-структура страницы type: SectionType; // Тип основной секции } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.5.4. HeaderContentConfig: Managing SEO Hierarchy Managing the heading hierarchy is critical for on-page SEO. The seksyon se opsyonèl. Sa a se yon seleksyon konsepsyon entansyonèl paske sèten kalite seksyon ka enkli / Tags dirèkteman nan yo . While this provides flexibility, it introduces a potential risk to UI consistency, which is a primary objective of this architecture. Careful implementation is required to maintain a logical and SEO-friendly document structure. A note of caution: Header H1 H2 bodyContent typescript interface HeaderContentConfig { heading: string; headingLevel?: 1 | 2; // H1/H2 для поисковой иерархии description?: string; showBorder?: boolean; } Enter fullscreen mode Exit fullscreen mode 2.1.5.5. BodySection: Enabling Maximum Design Freedom typescript bodyContent?: React.ReactNode; Enter fullscreen mode Exit fullscreen mode Pa konsepsyon, kò a nan yon seksyon se bay libète konplè nan implemantasyon nenpòt layout oswa konsepsyon. Sa a chwa arsitektyèl pèmèt maksimòm fleksibilite kreyatif, ki pèmèt AI yo kreye kontni rich ak varyete. Sa a apwòch delibere kontraste ak and , ki yo estanda yo kenbe yon aparans konsistan ak santi nan tout aplikasyon an. Header Footer typescript interface FooterContentConfig { actions?: { label: string; href: string; variant?: "default" | "secondary" | "outline" | "ghost" | "link"; }[]; } Enter fullscreen mode Exit fullscreen mode 2.1.5.6. FooterContentConfig: Yon apwòch minimalis Retounen kounye a nan footer a se intentionally minimalist. Li sipòte sèlman bouton opsyonèl apèl-a-aksyon. Pa gen okenn eleman adisyonèl yo enkli, yon desizyon te fè pou priorite senplisite, vitès, ak uniformite nan tout paj yo kreye. 2.1.5.7. Principles for Extending Type Definitions Yo prezante yon nouvo , the following steps must be taken: SectionType The AI's knowledge base must be updated with comprehensive instructions and examples for the new section type. Update AI Knowledge: Extend Enum: Nouvo kalite a dwe ajoute nan enum la SectionType. If the new section requires unique configuration parameters, the corresponding configuration interface must be extended. Expand Interfaces: This process strikes a crucial architectural balance: the and yo estriktirèlman tipize pou egzekite pi bon pratik SEO ak konsistans UI, pandan y ap offers maximum flexibility for innovative, AI-driven design solutions. Header Footer Body 2.1.5.8 Konpozan nan // app/@right/(_service)/(_types)/page-wrapper-types.ts export interface MetadataConfig { title?: string; description?: string; } export interface PageMetadata { id: string; title: string; description: string; image?: string; slug?: string[]; type: SectionType; } export type SectionType = | "hero-section" | "cta-section" | "faq-section" | "features-section" | "testimonials-section" | "pricing-section" | "contact-section" | "blog-posts-section" | "product-grid-section" | "image-gallery-section" | "text-block-section" | "video-section" | "team-section" | "about-us-section" | "newsletter-section" | "social-proof-section" | "comparison-table-section" | "map-section" | "custom-html-section" | "changelog-section" | "comparison-two-column-section" | "comparison-three-column-section" | "feature-showcase-section"; export interface BaseSection { id: string; type: SectionType; className?: string; } export interface HeaderContentConfig { announcement?: { badgeText?: string; descriptionText?: string; href?: string; }; heading: string; headingLevel?: 1 | 2; description?: string; showBorder?: boolean; } export interface FooterContentConfig { actions?: { label: string; href: string; variant?: | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link"; }[]; } export interface SectionConfig extends BaseSection { type: SectionType; headerContent: HeaderContentConfig; bodyContent?: React.ReactNode; footerContent?: FooterContentConfig; videoUrl?: string; imageUrl?: string; sectionClassName?: string; contentWrapperClassName?: string; customComponentsAnyTypeData?: any; } export type Section = SectionConfig; export interface PageConfig { metadata: PageMetadata; sections: Section[]; } export type SlugType = string[]; Enter mòd Ekran plen Exit mòd Ekran plen 2.1.5.9. customComponentsAnyTypeData: Supporting Arbitrary Custom Components The field within Sèvi kòm yon fòs "escape hatch." Li fèt pou pase done estriktirèl nan seksyon ki sèvi ak konplèks oswa inik konpozan Custom ki pa konpatib ak interfaces estanda nou an. customComponentsAnyTypeData?: any; SectionConfig To maintain architectural integrity, the type and structure of this data must be rigorously defined and documented . This design choice provides the necessary flexibility to integrate highly interactive, dynamic, and advanced user-facing sections without compromising the core typing contract of the main page architecture. within the custom component itself 2.1.6. public-pages-config.ts: The Public Page and Slug Route Registry 2.1.6.1. Role in System Architecture The file is an AI-generated registry of all public-facing pages within the application. This configuration is automatically generated by our AI based on system instructions and user prompts. Its structure is directly influenced by the available components in our knowledge base examples and the enumerations within the definitions. public-pages-config.ts SectionType The resulting configuration acts as a bridge, translating the AI's analysis of user requirements into a structure that our page rendering system can interpret and display. 2.1.6.2. When to Use This File-Based Configuration This approach is ideal for: Projects with a limited number of pages (typically 10-15). Websites with static content that requires infrequent updates. Rapid prototyping and Minimum Viable Products (MVPs), allowing for a quick start without database setup. Landing pages with a fixed, predefined structure. When to Transition to a Database: For large-scale production applications, a file-based approach is only practical for a small set of pages. Most scenarios will benefit from storing this information in a database to enable dynamic content management and scalability. 2.1.6.3. Configuration Structure typescript export const PublicPagesConfig = { pages: [ { metadata: { id: "public", title: "Enterprise-Grade AI Next.js starter", description: "Free Open-Source starter kit...", slug: ["public", "test"], type: "hero-section", }, sections: [ { id: "test-block", type: "hero-section", headerContent: { /* SEO-заголовки */ }, bodyContent: {}, footerContent: { /* Кнопки действий */ }, videoUrl: "/_static/video/ai-loop.mp4", contentWrapperClassName: "text-white", } as SectionConfig, ], }, ] as PageConfig[], }; Enter fullscreen mode Exit fullscreen mode 2.1.6.4 Prensip kategori konfigirasyon Placing the configuration file in the directory signifies its role in managing public-facing pages. Key Architectural Decision: public/(_service)/(_config)/ Scaling by Category: Our architecture supports scaling by categorizing configurations, ensuring a clean and organized structure: public-pages-config.ts - pou paj piblik (pou egzanp, destinasyon, sou, kontak). — for documentation sites with advanced navigation. docs-pages-config.ts admin-pages-config.ts — pou tablo administrasyon. — for blog posts and articles. blog-pages-config.ts Each category is designed to have its own: Dedicated configuration file. Espesyalize seksyon kalite. Unique fè logik. 2.1.6.5. Interaction with the AI Generation System Pou sistèm AI nou an, sa a dosye konfigirasyon sèvi kòm: Defining how objects should be formed. A structural template: PageConfig Yon egzanp done: bay valè referans pou pwosesis la jenerasyon. Yon estrikti validasyon kalite: Enforced pa TypeScript pou sekirite kalite estrikti. The workflow is as follows: AI analize dosye a konfigirasyon ki egziste. Li genere yon nouvo objè PageConfig ki baze sou itilizatè a. A developer then adds the new configuration to the array. pages The system automatically recognizes and registers the new routes. 2.1.6.6. Advantages and Limitations Advantages of the File-Based Approach: Vèsyon kontwòl: Fasil jesyon ak vèsyon atravè Git. Benefits from compile-time type safety with TypeScript. Type Safety: No database queries result in faster page loads. Zero Latency: Simplified Deployment: Funci sansib ak statik sit jenerasyon (SSG). Limitations: Pa gen ajou dinamik: Manke kapasite administrasyon kontni dinamik. Requires Redeployment: Nenpòt chanjman mande pou yon nouvo konstriksyon ak deplwaman. Pa pou UGC: Pa apwopriye pou kontni kreye pa itilizatè. Objè Scalability: Li devlope difisil yo jere plis pase 20-30 paj. 2.1.6.7 Konpozan nan // @/app/@right/public/(_servise)/(_config)/public-pages-config.ts import { PageConfig, SectionConfig, } from "@/app/@right/(_service)/(_types)/page-wrapper-types"; export const PublicPagesConfig = { pages: [ { metadata: { id: "public", title: "Enterprise-Grade AI Next.js starter", description: "Free Open-Source starter kit...", slug: ["public", "test"], type: "hero-section", }, sections: [ { id: "test-block", type: "hero-section", headerContent: { announcement: { badgeText: "Thanks", descriptionText: "AI-SDK V5 & Vercel AI", href: "https://github.com/aifa-agi/aifa", }, heading: "Enterprise-Grade AI Next.js starter", description: "Free Open-Source starter kit to build, deploy, and scale intelligent AI applications. Artifacts Feature, features secure multi-provider auth, Stripe payments, vector knowledge bases, deep-research agents, and a unique fractal architecture designed for the future of AI.", showBorder: false, headingLevel: 1, }, bodyContent: {}, footerContent: { actions: [ { label: "Get Started", href: "/https://github.com/aifa-agi/aifa", variant: "default", }, { label: "Browse Docs", href: "/docs", variant: "ghost" }, ], }, videoUrl: "/_static/video/ai-loop.mp4", contentWrapperClassName: "text-white", } as SectionConfig, ], }, ] as PageConfig[], }; Enter mòd Ekran plen Exit mòd Ekran plen 2.1.6.8 Konklizyon nan se yon solisyon pratik pou pwojè ti-a-mwayen, ofri yon balans ant fasilite nan jesyon ak fonksyonèlite. Pou aplikasyon ki pi gwo, li sèvi kòm yon pwen kòmanse ekselan anvan tranzisyon nan yon plis robust, baz done-pwopriye arsitektur. public-pages-config.ts 2.1.7. utils.ts: Konfigirasyon fonksyon Utility Modil sa a bay fonksyon utilite pou jesyon konfigirasyon paj. Li gen ladan de fonksyon prensipal: , ki filtre tout paj ak prefiks la "piblik" pou jenerasyon estatik, ak , which locates a specific page by an exact, case-sensitive match of its slug array. getAllPublicPages() getPageBySlug() // @app/@right/public/(_servise)/(_libs)/utils.ts import { PageConfig, SlugType, } from "@/app/@right/(_service)/(_types)/page-wrapper-types"; import { PublicPagesConfig } from "../(_config)/public-pages-config"; export function getAllPublicPages(): PageConfig[] { return PublicPagesConfig.pages.filter( (page: PageConfig) => page.metadata.slug?.[0] === "public" ); } export function getPageBySlug(slug: SlugType): PageConfig | undefined { return PublicPagesConfig.pages.find( (page: PageConfig) => JSON.stringify( page.metadata.slug?.map((s: string) => s.toLowerCase()) ) === JSON.stringify(slug.map((s: string) => s.toLowerCase())) ); } Enter fullscreen mode Exit fullscreen mode 2.1.8. header-section.tsx: Unified Section Header nan yon sèl This standardized component serves as a universal header for all section types, ensuring consistency across the application. It offers optional elements such as an announcement, an H1/H2 heading, and a description. This component plays a crucial role in SEO optimization and maintaining visual consistency for AI-generated pages. // @/app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/header-section.tsx import React from "react"; import { cn } from "@/lib/utils"; import { PageHeaderDescription, PageHeaderHeading, } from "./page-header-elements"; import { Announcement } from "./announcement"; import { HeaderContentConfig } from "../../../(_types)/page-wrapper-types"; export type HeaderSectionProps = { headerContent: HeaderContentConfig; } & React.HTMLAttributes<HTMLDivElement>; export function HeaderSection({ headerContent, className, ...props }: HeaderSectionProps) { if (!headerContent) return null; const { announcement, heading, headingLevel = 1, description, showBorder = false, } = headerContent; return ( <section className={cn( showBorder && "border-t-4 border-b-4 border-primary", className )} {...props} > <div className="container mx-auto px-4"> <div className="flex flex-col items-center gap-1 py-8 md:py-10 lg:py-12"> {announcement && ( <Announcement badgeText={announcement.badgeText} descriptionText={announcement.descriptionText} href={announcement.href} /> )} <PageHeaderHeading level={headingLevel}>{heading}</PageHeaderHeading> {description && ( <PageHeaderDescription>{description}</PageHeaderDescription> )} </div> </div> </section> ); } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.9. header-section.tsx: Unified Section Header (Atomic Components) Seksyon sa a detaye eleman atomik ki te itilize nan konstriksyon an nan tèt: (ki sipòte H1 / H2) for subheadings, and for placing buttons. These components leverage pou dinamik HTML tag jenerasyon, asire sa ki kòrèk hierarchi SEO. PageHeaderHeading PageHeaderDescription PageActions createElement // @app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/page-header-elements.tsx import { HTMLAttributes, createElement } from "react"; import { cn } from "@/lib/utils"; type HeadingTag = "h1" | "h2"; interface PageHeaderHeadingProps extends HTMLAttributes<HTMLHeadingElement> { level?: 1 | 2; } function PageHeaderHeading({ className, level = 1, ...props }: PageHeaderHeadingProps) { const Heading: HeadingTag = level === 1 ? "h1" : "h2"; const h1Classes = "text-2xl sm:text-3xl md:text-6xl lg:text-7xl"; const h2Classes = "text-lg sm:text-xl md:text-3xl lg:text-4xl"; return createElement(Heading, { className: cn( "text-center font-bold leading-tight tracking-tighter font-serif", level === 1 ? h1Classes : h2Classes, className ), ...props, }); } function PageHeaderDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>) { return ( <p className={cn( "max-w-2xl text-balance text-center text-base font-light text-muted-foreground sm:text-lg", className )} {...props} /> ); } function PageActions({ className, ...props }: HTMLAttributes<HTMLDivElement>) { return ( <div className={cn( "flex w-full items-center justify-center gap-2 pt-2", className )} {...props} /> ); } export { PageActions, PageHeaderDescription, PageHeaderHeading }; Enter fullscreen mode Exit fullscreen mode 2.1.10. anons.tsx: Anons konpozan Sa a konpozan interaktif badj te fèt pou anons ak anons. Li sipòte navigasyon, kontwòl klavye, ak rendisyon kondisyon, otomatikman kache lè pa gen okenn kontni prezan. Li se itilize yo atann atansyon sou ajou enpòtan oswa lyen. // @app/@right/(_service)/(_components)/page-transformer-components/header-sections-components/announcement.tsx "use client"; import { useRouter } from "next/navigation"; import { Badge } from "@/components/ui/badge"; import { ArrowRight } from "lucide-react"; import { cn } from "@/lib/utils"; interface AnnouncementProps { badgeText?: string; descriptionText?: string; href?: string; className?: string; } export function Announcement({ badgeText, descriptionText, href, className, }: AnnouncementProps) { const router = useRouter(); const handleOnClick = () => { if (href) { router.push(href); } }; // Если нет текста для бейджа, описания или ссылки, возвращаем null if (!badgeText && !descriptionText && !href) { return null; } return ( <div className={cn( "flex cursor-pointer items-center gap-2 rounded-full border border-primary bg-muted px-3 py-1 text-sm transition-colors hover:bg-muted/80", className )} onClick={handleOnClick} role="link" tabIndex={0} onKeyDown={(e) => { if (e.key === "Enter" || e.key === " ") { handleOnClick(); } }} > {badgeText && ( <Badge variant="secondary" className="text-xs"> {badgeText} </Badge> )} {descriptionText && ( <span className="text-muted-foreground">{descriptionText}</span> )} {href && <ArrowRight className=" h-3 w-3 text-muted-foreground" />} </div> ); } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.11. footer-section.tsx: Yonifikasyon aksyon seksyon Sa a estanda konpozan footer gen bouton aksyon. Li sipòte plizyè bouton ak diferan opsyon style, asire uniformite nan eleman Call-to-Action (CTA) nan tout seksyon yo. Li otomatikman kache lè pa gen okenn aksyon definye. // @app/@right/(_service)/(_components)/page-transformer-components/footer-sections-components/footer-section.tsx "use client"; import { useRouter } from "next/navigation"; import type { HTMLAttributes } from "react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { PageActions } from "../header-sections-components/page-header-elements"; interface FooterAction { label: string; href: string; variant?: | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link"; } interface FooterSectionProps extends HTMLAttributes<HTMLDivElement> { actions?: FooterAction[]; } export function FooterSection({ actions, className, ...props }: FooterSectionProps) { const router = useRouter(); if (!actions || actions.length === 0) { return null; } return ( <section className={cn("py-4 md:py-6 lg:py-8", className)} {...props}> <div className="container mx-auto px-4"> <PageActions> {actions.map((action) => ( <Button key={action.href} // href должен быть уникальным! size="sm" variant={action.variant || "default"} onClick={() => router.push(action.href)} > {action.label} </Button> ))} </PageActions> </div> </section> ); } Enter fullscreen mode Exit fullscreen mode 2.1.12. body-section.tsx: Arbitrary Content Container 2.1.12.1 Objektif ak Filozofi serves as a highly flexible container for the main content within sections. Unlike the strictly standardized Header and Footer components, bay konplètman libète pou mete nenpòt kontni React. BodySection BodySection 2.1.12.2. Content Generation Principles Kontenan nan must be generated as plain TSX without using eleman, kote tout eleman yo prezante nan yon fòma agrandi. Crucially: bodyContent .map() typescript // ✅ bodyContent: ( <> <div className="grid grid-cols-1 md:grid-cols-3 gap-6"> <div className="feature-card"> <h3>Feature 1</h3> <p>Description 1</p> </div> <div className="feature-card"> <h3>Feature 2</h3> <p>Description 2</p> </div> <div className="feature-card"> <h3>Feature 3</h3> <p>Description 3</p> </div> </div> </> ) Enter mòd Ekran plen Exit mòd Ekran plen // ❌ bodyContent: ( <div className="grid"> {features.map(feature => <FeatureCard key={feature.id} {...feature} />)} </div> ) Enter fullscreen mode Exit fullscreen mode 2.1.12.3. lè yo sèvi ak eleman Custom Si yon seksyon mande pou yon logik konplèks (stan, efè, interaktivite), kreye yon konpozan separe epi ajoute li nan Kòm yon entite separe. PageHtmlTransformer typescript // @/app/@right/(_service)/(_components)/page-transformer-components/body-sections-components/body-section.tsx export function BodySection({ children, className, ...props }: BodySectionProps) { const hasChildren = children !== null && children !== undefined && !(Array.isArray(children) && children.length === 0) && !(typeof children === "string" && children === ""); if (!hasChildren) return null; return ( <div className={cn(className)} {...props}> {children} </div> ); } Enter mòd Ekran plen Exit mòd Ekran plen 2.1.12.4. Component // @app/@right/(_service)/(_components)/page-transformer-components/body-sections-components/body-section.tsx import type { HTMLAttributes, ReactNode } from "react"; import { cn } from "@/lib/utils"; import { SectionType } from "../../../(_types)/page-wrapper-types"; interface BodySectionProps extends HTMLAttributes<HTMLDivElement> { children?: ReactNode | null; type: SectionType; } export function BodySection({ children, className, ...props }: BodySectionProps) { const defaultHeightRem = 0; const hasChildren = children !== null && children !== undefined && // Covers case when children = [] or "" !(Array.isArray(children) && children.length === 0) && !(typeof children === "string" && children === ""); if (!hasChildren && defaultHeightRem) { return ( <div className={cn(className)} style={{ height: `${defaultHeightRem}rem` }} {...props} > {/* Empty section with default height */} </div> ); } if (!hasChildren) { return null; } return ( <div className={cn(className)} {...props}> {children} </div> ); } Enter fullscreen mode Exit fullscreen mode 2.1.12.5 Konklizyon nan se yon jaden ant arsitèks la estanda nan sistèm la ak libète kreyatif nan jenerasyon AI, frape yon balans ant kontwòl ak fleksibilite. BodySection 2.2. Avanse Custom konpozan Avanse Custom Components yo devlope bay fonksyonalite konplèks, entèaktif ki ale soti nan kapasite yo nan modèl estanda nou an. Sa yo konpozan yo resève pou senaryo ki mande pou jesyon eta, animasyon sofistike, manipilasyon done tan reyèl, oswa logik biznis inik. Ki jan yo sèvi ak Custom Components: Eleman entèaktif: Fòm ak validasyon, kalkil, konfigirasyon pwodwi. Anime Prezantasyon: tranzisyon konplèks, efè parallax, otomatik glise. Fonctionnalités nan tan reyèl: Chats, notifications, liv done feeds. Adaptive Logic: Konpozan ak fonksyonèlman diferan konpòtman sou Desktop vs. mobil. Modèl UI inik: eleman entèfas ki pa estanda espesifik pou pwojè a. Architectural Entegre: Custom eleman yo entegre nan kòm diferan Deklarasyon nan a blòk. Sa a apwòch pèmèt yo jwenn aksè nan kontexte sistèm tout antye, tankou tèm ak enfòmasyon aparèy, pandan y ap kenbe yon gade konsistan ak santi atravè klas CSS pataje ak token konsepsyon. Malgre ke yo adere nan lang vizyèl la nan sistèm la, yo kenbe konplètman libète nan logik enteryè yo ak implemantasyon. Sa a estrateji bay yon balans ant estanda majorite a nan kontni ak pèmèt pou libète kreyatif nan implemantasyon eleman entèaktif konplèks. PageHtmlTransformer case switch 2.2.1. Guidelines for Implementing Custom Components 2.2.1.1 Politi nan Wrapper : Custom components must be returned directly without being enclosed in ou Yo responsab pou jesyon pwòp yo layout, padding, ak laying asire kontwòl konplè sou prezantasyon yo. No External Wrappers Wrapper FullScreenWrapper 2.2.1.2 Pwodwi pou Telefòn Konpayi : Interface prop pou yon konpozan Custom dwe deklare nan tèt la nan dosye a konpozan an menm. Tout done se pase soti nan konfigirasyon paj la nan konpozan an atravè jaden nan seksyon an config. Local Prop Interfaces customComponentsAnyTypeData 2.2.1.3 Extension nan SectionType SectionType : Chak konpozan koutim mande pou yon kalite inik yo ajoute nan Enum nan . This ensures proper type-checking and enables the deklarasyon nan transformatè a pou koresponn identifye ak retrete eleman an. Add a New Section Type SectionType page-wrapper-types.ts switch typescript // @/app/@right/(_service)/(_types)/page-wrapper-types.ts // ... export type SectionType ="hero-section" | “new-custom-section”; Enter mòd Ekran plen Exit mòd Ekran plen 2.2.1.4. Update ka nan ageHtmlTransformer Custom case processingUn nouvo cas se ajoute nan PageHtmlTransformer yo sèvi ak yon kalite seksyon Custom ak yon dirèkteman // В PageHtmlTransformer: case "new-custom-section": return ( <NewCustomSection key={config.id} customData={section.customComponentsAnyTypeData.customData} /> ); Enter mòd Ekran plen Exit mòd Ekran plen 2.2.1.5. Custom Konfig estrikti : Sa a se yon egzanp nan yon konfigirasyon paj ki gen ladan yon seksyon Custom. Tout done konpozan espesifik yo mete nan object, which can have any structure required by the component. Configuration Structure customComponentsAnyTypeData export const PublicPagesConfig = { pages: [ { metadata: { id: "CIUD", title: "1", description: "2", slug: ["public", "name"], type: "new-custom-section", }, sections: [ { id: "new-custom-section", type: "new-custom-section", customComponentsAnyTypeData: { metaData: { metaTitle: "1", metaDescription: "2", }, customData: { mediaUrl: "/_static/illustrations/3.png", title: "4", description: "5", }, }, } as SectionConfig, ], }, ] as PageConfig[], Enter mòd Ekran plen Exit mòd Ekran plen 2.2.2 Custom konpozan egzanp Pwodwi pou Telefòn DoublePresentation Double prezantasyon nan 2.2.2.1.1 Ajou Tip Core Premye, ajoute nouvo kalite seksyon nan enum. SectionType typescript // @/app/@right/(_service)/(_types)/page-wrapper-types.ts export type SectionType = | "hero-section" | "cta-section" | "double-presentation-section" Enter mòd Ekran plen Exit mòd Ekran plen 2.2.2.1.2 Ajoute yon nouvo ka nan PageHtmlTransformer Pwodwi pou Telefòn Apre sa, ajoute korespondan nan Pou fè konpozan an. case PageHtmlTransformer case "double-presentation-section": return ( <DoublePresentation key={section.id} metaData={section.customComponentsAnyTypeData.metaData} leftItem={section.customComponentsAnyTypeData.leftItem} rightItem={section.customComponentsAnyTypeData.rightItem} /> ); Enter mòd Ekran plen Exit mòd Ekran plen 2.2.2.1.4 Konfig egzanp Isit la se yon egzanp nan ki jan yo konfigirasyon Konpozan nan . DoublePresentation public-pages-config.ts // app/@right/(_service)/(_types)/page-wrapper-types.ts export interface MetadataConfig { title?: string; description?: string; } export type CuidString = string; export interface PageMetadata { id: CuidString; title: string; description: string; image?: string; slug?: string[]; type: SectionType; } export type SectionType = | "hero-section" | "cta-section" | "faq-section" | "features-section" | "testimonials-section" | "pricing-section" | "contact-section" | "blog-posts-section" | "product-grid-section" | "image-gallery-section" | "text-block-section" | "video-section" | "team-section" | "about-us-section" | "newsletter-section" | "social-proof-section" | "comparison-table-section" | "map-section" | "custom-html-section" | "changelog-section" | "comparison-two-column-section" | "comparison-three-column-section" | "feature-showcase-section" | "double-presentation-section"; export interface BaseSection { id: string; type: SectionType; className?: string; } export interface HeaderContentConfig { announcement?: { badgeText?: string; descriptionText?: string; href?: string; }; heading: string; headingLevel?: 1 | 2; description?: string; showBorder?: boolean; } export interface FooterContentConfig { actions?: { label: string; href: string; variant?: | "default" | "secondary" | "destructive" | "outline" | "ghost" | "link"; }[]; } export interface SectionConfig extends BaseSection { type: SectionType; headerContent: HeaderContentConfig; bodyContent?: React.ReactNode; footerContent?: FooterContentConfig; videoUrl?: string; imageUrl?: string; sectionClassName?: string; contentWrapperClassName?: string; customComponentsAnyTypeData?: any; } export type Section = SectionConfig; export interface PageConfig { metadata: PageMetadata; sections: Section[]; } export type SlugType = string[]; Enter mòd Ekran plen Exit mòd Ekran plen 2.2.2.5. konpozan nan Kòd la konplè pou konpozan an. DoublePresentation // @/app/@right/public/(_servise)/(_config)/public-pages-config.ts import { PageConfig, SectionConfig, } from "@/app/@right/(_service)/(_types)/page-wrapper-types"; export const PublicPagesConfig = { pages: [ { metadata: { id: "public", title: "Enterprise-Grade AI Next.js starter", description: "Free Open-Source starter kit...", slug: ["public", "test"], type: "hero-section", }, sections: [ { id: "test-block", type: "hero-section", headerContent: { announcement: { badgeText: "Thanks", descriptionText: "AI-SDK V5 & Vercel AI", href: "https://github.com/aifa-agi/aifa", }, heading: "Enterprise-Grade AI Next.js starter", description: "Free Open-Source starter kit to build, deploy, and scale intelligent AI applications. Artifacts Feature, features secure multi-provider auth, Stripe payments, vector knowledge bases, deep-research agents, and a unique fractal architecture designed for the future of AI.", showBorder: false, headingLevel: 1, }, bodyContent: {}, footerContent: { actions: [ { label: "Get Started", href: "/https://github.com/aifa-agi/aifa", variant: "default", }, { label: "Browse Docs", href: "/docs", variant: "ghost" }, ], }, videoUrl: "/_static/video/ai-loop.mp4", contentWrapperClassName: "text-white", } as SectionConfig, ], }, { metadata: { id: "interactive-ai", title: "Interactive AI Demo", description: "Demo: DoublePresentation custom case", slug: ["public", "example"], type: "double-presentation-section", }, sections: [ { id: "double-presentation-demo", type: "double-presentation-section", customComponentsAnyTypeData: { metaData: { metaTitle: "Interactive AI: Where Conversation Builds the UI", metaDescription: "Discover what makes AIFA revolutionary...", }, leftItem: { mediaUrl: "/_static/illustrations/ai-chat.png", title: "Ai Artifacts Chatbot", description: "As the AI chatbot speaks, it highlights elements...", }, rightItem: { mediaUrl: "/_static/illustrations/ai-web.png", title: "Related Pages", description: "Click any UI element, and the AI provides instant context...", }, }, } as SectionConfig, ], }, ] as PageConfig[], }; Enter mòd Ekran plen Exit mòd Ekran plen Pwodwi pou Telefòn Pwodwi pou Telefòn Pwodwi pou Telefòn Isit la se yon konplè dosye ak nouvo kalite ki gen ladan. page-wrapper-types.ts // @/app/@right/(_service)/(_components)/page-transformer-components/custom-sections/custom-double-prsentation.tsx "use client"; import React, { useState, useEffect } from "react"; import { motion } from "framer-motion"; import Image from "next/image"; import { cn } from "@/lib/utils"; import { useMediaQuery } from "@/hooks/use-media-query"; interface PresentationMeta { metaTitle: string; metaDescription: string; } interface PresentationItem { mediaUrl: string; title: string; description: string; } interface DoublePresentationProps { metaData: PresentationMeta; leftItem: PresentationItem; rightItem: PresentationItem; } export default function DoublePresentation({ metaData, leftItem, rightItem, }: DoublePresentationProps) { const { isMobile } = useMediaQuery(); // Desktop animation state const [activeContainer, setActiveContainer] = useState<"left" | "right">( "left" ); const [sliderKey, setSliderKey] = useState(0); // Desktop auto-switching effect useEffect(() => { // Only run animation cycle on desktop if (isMobile) return; let sliderTimer: NodeJS.Timeout; let transitionTimer: NodeJS.Timeout; const startAnimationCycle = () => { setSliderKey((prev) => prev + 1); sliderTimer = setTimeout(() => { setActiveContainer((prev) => (prev === "left" ? "right" : "left")); transitionTimer = setTimeout(() => { startAnimationCycle(); }, 500); }, 9000); }; startAnimationCycle(); return () => { clearTimeout(sliderTimer); clearTimeout(transitionTimer); }; }, [isMobile]); // Return null while determining screen size if (isMobile === null) { return null; } // Common CSS classes const metaBlockClass = "text-center max-w-3xl flex flex-col items-center"; const descriptionClass = "mb-12 max-w-xl text-base text-muted-foreground text-center"; const desktopTitleClass = "mb-6 max-w-3xl font-serif font-bold leading-tight md:text-2xl lg:text-4xl"; const desktopDescriptionClass = "mb-12 max-w-xl text-lg text-muted-foreground md:text-xl text-center"; // Mobile card renderer const renderMobileCard = (item: PresentationItem) => ( <div className="relative flex flex-col rounded-xl bg-gray-900 text-white shadow-lg mb-6 overflow-hidden"> <div className="w-full relative" style={{ paddingTop: "56.25%" }}> <Image src={item.mediaUrl} alt={item.title} fill className="object-cover rounded-t-xl" sizes="100vw" priority /> </div> <div className="flex flex-col p-4"> <h2 className="text-xl font-bold mb-2">{item.title}</h2> <p className="text-gray-300 mb-2 text-base min-h-16"> {item.description} </p> </div> </div> ); // Desktop card renderer const renderDesktopCard = (item: PresentationItem, isActive: boolean) => ( <motion.div layout animate={{ flex: isActive ? "7 1 0%" : "3 1 0%" }} transition={{ duration: 0.5 }} className="relative flex flex-col rounded-lg overflow-hidden bg-transparent text-white p-0 shadow-lg h-[30rem] flex-shrink-0" > <div className="relative w-full h-60 mb-4 rounded-xl overflow-hidden border-4 border-gray-700"> <Image src={item.mediaUrl} alt={item.title} fill className="object-cover" priority sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw" /> </div> <div className="flex flex-col pt-6"> <h2 className="text-2xl font-bold mb-2 whitespace-nowrap overflow-hidden text-ellipsis"> {item.title} </h2> <div className="relative w-full h-px bg-gray-700 mb-4"> <motion.div key={`slider-${item.title}-${sliderKey}`} className={cn( "absolute top-0 left-0 h-full", isActive ? "bg-primary" : "bg-gray-700" )} initial={{ width: 0 }} animate={{ width: isActive ? "100%" : "0%" }} transition={ isActive ? { duration: 9, ease: "linear" } : { duration: 0 } } /> </div> <p className="text-gray-300 mb-4 text-sm line-clamp-4 min-h-[4rem]"> {item.description} </p> </div> </motion.div> ); // Mobile layout if (isMobile) { return ( <section className="w-full pt-20"> <div className="container mx-auto px-4 flex flex-col items-center"> <div className={metaBlockClass}> <h2 className="text-xl font-bold mb-4">{metaData.metaTitle}</h2> <p className={descriptionClass}>{metaData.metaDescription}</p> </div> <div className="w-full flex flex-col"> {renderMobileCard(leftItem)} {renderMobileCard(rightItem)} </div> </div> </section> ); } // Desktop layout return ( <section className="w-full pt-28"> <div className="container mx-auto px-4 flex flex-col items-center gap-12"> <div className={metaBlockClass}> <h2 className={desktopTitleClass}>{metaData.metaTitle}</h2> <p className={desktopDescriptionClass}>{metaData.metaDescription}</p> </div> <div className="flex gap-6 w-full max-w-6xl"> {renderDesktopCard(leftItem, activeContainer === "left")} {renderDesktopCard(rightItem, activeContainer === "right")} </div> </div> </section> ); } Enter mòd Ekran plen Exit mòd Ekran plen Konklizyon: Ki jan yo jwenn maksimòm soti nan dokiman sa a Nou konprann ke enstriksyon yo ak konpozan yo prezante isit la ka sanble extensive pou yon sèl pòs. Ou ka menm santi ke sa a se pa ki pi enteresan li, epi ou ta dwe dwa. Sa a se pa amizman; li se yon manadjè teknik detaye ki fèt yo ba ou konplè kontwòl sou yon sistèm pouvwa. Pou konvèti etid la nan sistèm sa a konplèks nan yon pwosesis entèaktif ak pwodiktif, nou rekòmande apwòch sa a. Sèvi ak AI pou aprantisaj Instead of passively reading, use this documentation as the "brain" for your AI assistant. Your Action Plan: Kopye tout kontni a nan atik sa a, soti nan entwodiksyon a nan seksyon sa a. Sèvi ak li kòm yon pwopòsyon sistèm pou ChatGPT. Sa a pral bay AI a ak kontexte plen nan arsitektur la nou diskite. You can now have a dialogue with an AI that "understands" our rules and conventions. For example: Ask questions about the source code. "Based on the provided documentation, explain how to create a new custom component to display customer testimonials." and ." "Show me a configuration example for a page that uses both DoublePresentation HeroSection Metòd sa a pral ede ou konprann prensip yo nan aplikasyon an pi vit. Ou ka jwenn kod la sous konplè pou pwojè sa a sou . Repository nan GitHub Ki sa ki pwochen? Nan atik sa a, nou te bati youn nan de pati kritik nan sistèm jenerasyon sit nou an: dosye nan konpozan React ki pare yo itilize. Sa a pavye wout la pou kreyasyon paj otomatik, kote yon AI ka kreye konfigirasyon an, ak nou an Li fè li yon interface bèl. a tool that transforms a Config Transformer Pou wè pwojè nou an nan aksyon, ale nan live demo a nan . Pwodwi pou Telefòn Pwodwi pou Telefòn A Glimpse into Future Posts: pati 2: Magic nan Markdown. atik pwochen pral konsantre sou teknoloji a dezyèm kle: kreye paj (dokumentasyon, tutorials, paj pwodwi) soti nan dosye Markdown. Pwen 3: Soti nan Config nan UI. Nou pral revize tèm a nan atik sa a ak plonje pi byen nan ki jan yon konfigirasyon ChatGPT-genere se transforme nan konpozan React ak ki jan pwosesis sa a ka espand. Nan tutorial a pwochen, nou pral kòmanse pa reponn a yon kesyon kle: Reste nan tuned! Why was Markdown chosen for content management?