Skip to content

Next.js Guide To Create AI Websites

Master your Siteplay.ai generated Next.js export —- built with the App Router, Reuseable Components, and optimized SEO.

For those who need production-grade performance out of the box, the Next.js export delivers a full-stack React environment. We leverage the App Router and React Server Components (RSC) to ensure your site is SEO-friendly and incredibly fast.

The project uses:

  • Next.js App Router for layouts, routes, and page rendering.
  • React + TypeScript for generated components.
  • Tailwind CSS v4 for styling.
  • Shadcn for interactive UI elements.
  • SVG files & Lucide React for icons.
  • Motion for generated animations.
  • next-themes for light and dark mode support.

A freshly exported Siteplay.ai Next.js project follows this structure:

  • Directory

    public

    • Directoryimages/ ------------------- all images here
    • robots.txt
  • Directory

    src

    • Directory

      app/ ------------------------ all pages here

    • Directory

      assets/

    • Directory

      components/

      • Directorysections/ ------------ all sections here
        • Directoryglobal/
          • Navbar.tsx
          • Footer.tsx
        • Directoryhome/
          • Hero.tsx
        • Directorypage-1/
      • Directoryui/
        • Directoryicons/ ------------ svg icons here
        • button.tsx
    • Directory

      types/ --------------------- all types here

      • index.ts
      • page.types.ts
      • section.types.ts
      • site.types.ts
    • utils.ts

    • constants.ts ------------ all site defaults here

  • .env.local

  • .env.production

  • .gitignore

  • .prettierignore

  • .prettierrc

  • components.json

  • next.config.ts

  • package.json

  • postcss.config.mjs

  • tailwind.config.ts

  • tsconfig.json

  • README.md

Your downloaded project may include more generated files in src/components/sections and src/app folders than this starter structure.

File: /src/app/layout.tsx

This is the root layout for the whole website. It imports the global stylesheet, sets the default language and direction, connects Google Fonts preconnect tags, and wraps the app in a theme provider.

Use this file when you want to:

  • Add scripts or analytics.
  • Change the root <html> language or text direction.
  • Add providers that should wrap every page.
  • Change global theme behavior.

File: /src/app/*/page.tsx

Siteplay.ai creates Next.js page route files from the pages in your sitemap. Each page usually loads a page object, exports metadata for SEO, and renders a container component.

Use generated page files when you want to:

  • Adjust page-level SEO metadata.
  • Add custom page logic.
  • Connect a page to dynamic data.
  • Change route-specific behavior.

File: /src/app/*/container.tsx

Page containers assemble sections in the order you created inside Siteplay.ai. They usually import the generated section components and render them inside a page wrapper.

Use containers when you want to:

  • Reorder sections manually in code.
  • Add custom React state around a page.
  • Insert a hand-written component between generated sections.

File: /src/components/sections/[page]/*.tsx

This folder contains the section components generated from the Siteplay.ai editor. A hero, pricing block, feature grid or FAQ section will typically live here.

Section files are organized based on the pages in the sitemap. Example : /src/components/sections/home/Hero.tsx

Use this folder when you want to customize one specific visual section without changing the rest of the site.

File: /src/components/common/*.tsx

This folder contains shared wrappers and elements used across generated pages and sections, such as page wrappers, theme providers, buttons, images, links, rich content, and background rendering helpers.

Use this folder when you want a change to apply consistently across many generated sections.

File: /src/components/ui/*.tsx

This folder is reserved for lower-level UI primitives. Siteplay.ai uses these for interactive components such as accordions, dialogs, selects, navigation menus, form controls, and other reusable building blocks.

Most users should customize sections and common components first, and only edit UI primitives when changing the behavior of a shared control.

File: /src/utils.ts

This file contains shared helper functions used by generated components. Common examples include:

  • cn() for merging Tailwind class names.
  • Form submission helpers.
  • Animation helpers.
  • Color shade utilities.
  • Small formatting helpers such as kebab-case conversion.

Use this file for reusable logic that should stay framework-local and shared across components.

File: /src/constants.ts

This file serves as the central configuration layer for the application. It defines shared defaults, reusable UI settings, and predefined animation presets that are used throughout the project.

By keeping these values in a single location, the application maintains consistency across themes, components, layouts, pages, sections and motion behaviors while making customization significantly easier.

This file primarily handles:

  • Default application settings
  • Shared component styling classes
  • Localization and layout defaults
  • Animation configuration and reusable presets
  • Background and visual configuration

The animation system included in this file is highly extensible and supports multiple motion styles such as slide, fade, zoom, flip, reveal, and micro-interactions. These presets help developers create consistent, production-ready UI animations without rewriting configuration objects repeatedly.

Overall, this file acts as the foundation for maintaining a scalable and configurable design system across the entire Next.js application.

File: /next.config.ts

This is the main Next.js configuration file. It controls framework-level behavior such as build settings, image configuration, redirects, rewrites, and other Next-specific options.

Use this file when you want to:

  • Add or change Next.js configuration.
  • Configure image handling.
  • Add redirects or rewrites.
  • Adjust framework-level build behavior.

File: /public/*

Static assets live in public. Files placed here are served from the site root. For example, public/images/p.svg is available at /images/p.svg.

Use this folder for images, downloadable files, icons, robots.txt, and other static assets.

The exported project follows the same mental model as the Siteplay.ai builder:

Siteplay.ai conceptNext.js output
SiteA complete Next.js project
PageA route under src/app
SitemapThe set of generated routes and page relationships
SectionA React component under src/components/sections
Global sectionA reused component or repeated section data
Design systemTailwind classes, CSS variables, theme constants, and wrappers
SEO settingsNext.js page metadata
Images and uploadsStatic assets in public

This makes it easier to move between the visual builder and the exported code. If you know where something lived in Siteplay.ai, you can usually find the matching code by looking for the page, section label, or component name.

  1. Install dependencies

    Terminal window
    npm install
  2. Run the code in local development

    Terminal window
    npm run dev
  3. Build for production

    Terminal window
    npm run build
  4. Preview production in local

    Terminal window
    npm run serve

Files: src/app/global.css and src/app/theme.css

Use src/app/global.css and src/app/theme.css to make site level changes. Siteplay.ai generates Tailwind v4 based components. Most visual changes can be made by editing class names directly in the generated page/section react components.

Start with these areas:

  • Section-level layout and spacing in src/components/sections.
  • Shared element styling in src/components/common.
  • Project-wide Tailwind settings in tailwind.config.ts.
  • Global styles in the stylesheet imported by src/app/layout.tsx.

Because the editor already applies a design system, keep broad changes in shared components or theme files. Use section files for one-off edits.

File: src/app/*/page.tsx

Siteplay.ai page SEO settings are exported into Next.js metadata. In most generated page files, you will see a metadata export that Next.js uses for titles, descriptions, and other SEO fields.

const page = {
seo: {
title: 'About Us Page',
description: 'lorem ipsum dolor sit...',
...
},
} as Page;

After export, review:

  • Page title and description.
  • Open Graph or social metadata if included.
  • Canonical URLs after you know the final production domain.
  • public/robots.txt.

Generated forms use the form settings configured in Siteplay.ai. The Next.js export includes a helper for submitting form payloads with the configured method and action.

After export, check:

  • The form action URL.
  • The HTTP method.
  • Required fields and validation behavior.
  • Whether you want to handle submissions through a Next.js API route, a third-party form backend, or your own server.

Images used by the generated site are referenced from the exported project. Keep assets in public when they should be served directly by URL.

When replacing images:

  • Keep filenames stable if you do not want to update component references.
  • Add useful alt text in the generated image components.
  • Optimize large images before deploying.

The exported Next.js project can be deployed anywhere that supports Next.js. The easiest path is usually Vercel, but Node-based hosting providers also work.

Before deploying:

  • Run npm run build.
  • Confirm environment variables in .env.local or your host settings.
  • Review final SEO metadata and domain-specific URLs.
  • Test key forms and links.
  • Check light and dark mode if both are enabled.

Use this checklist after downloading a Next.js project from Siteplay.ai:

  • Run the project locally.
  • Review every generated route.
  • Replace placeholder images and copy.
  • Check page titles and descriptions.
  • Verify buttons, links, and forms.
  • Update theme, colors, and typography if needed.
  • Remove unused generated sections or components.
  • Run a production build before deployment.

Run npm install, then npm run dev again. If the issue continues, confirm you are using a Node.js version supported by the exported Next.js version.

Check that the global stylesheet is imported from src/app/layout.tsx and that the generated components are inside the paths covered by Tailwind.

Make sure referenced files exist in public and that paths start from the site root, such as /images/example.webp.

Check the generated form action, method, and any required environment variables. If you want server-side handling, connect the form to a Next.js route handler or your backend API.

Build works locally but fails in deployment

Section titled “Build works locally but fails in deployment”

Compare the deployed environment variables with your local .env.local, then run npm run build locally before pushing again.