Next.js Folder Structure
The TailAdmin Next.js Template is built on a modern stack using Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS v4, next-intl v4, and Base UI. It follows a modular and scalable architecture, leveraging Next.js features like Server Components, Layouts, and Route Groups.
Root Directory
The root directory organizes the source code and configuration.
| File / Folder | Description |
|---|---|
src/ | Contains application source code. |
public/ | Contains static files served directly (images/, maplibre/). |
package.json | Manages scripts and dependencies. |
next.config.ts | Next.js configuration with SVGR webpack setup, Turbopack rules, and route redirects. |
tsconfig.json | TypeScript configuration with @/* path alias mapping. |
eslint.config.mjs | ESLint flat configuration for Next.js. |
postcss.config.mjs | PostCSS configuration loading @tailwindcss/postcss. |
.prettierrc | Prettier code formatting rules with prettier-plugin-tailwindcss. |
README.md | Project overview, prerequisites, and getting started instructions. |
AGENTS.md | Authoritative architecture, patterns, and guidelines for AI coding assistants. |
Source Directory (src)
Inside src/, the codebase is organized into route specific groups.
Key Directories Explained
src/app/
The core directory for the Next.js App Router tree:
[locale]/: Dynamic route segment powering localized routing without prefixing URLs (localePrefix: "never").(admin-layout)/: Routes wrapped in the main dashboard shell (sidebar and header), grouped into(main),(others), and(support).(full-width-pages)/: Standalone pages rendered without the dashboard shell (authentication, error pages, coming soon).(layouts)/: Standalone alternative layout demonstrations (layout-onethroughlayout-six).
Adding a Page: To add a new page:
- Create a
page.tsxfile undersrc/app/[locale]/(admin-layout)/(main)/(or the relevant route group), - Add message files (
messages/*.json), - Add navigation entries to
src/layout/app-layout/sidebar/data.tsx.
src/components/
The component library is split into layout shells, shared widgets, and atom-level UI primitives:
ui/: Flat, headless-style primitive components built on Base UI.common/: Cross-route widgets reused across multiple pages (component-card.tsx,page-breadcrumb.tsx,vector-map.tsx).main/,others/,support/: Domain-specific components and widgets organized by feature.
src/layout/
Application layout shells including the default app-layout (header and sidebar) and six alternative layout configurations (layout-one through layout-six).
src/i18n/ & src/messages/
Built-in internationalization powered by next-intl:
- Translations: Organized in modular JSON dictionary files under
src/messages/{en,ar,de,es}.jsonsupporting ICU interpolation and plural syntax. - Supported Locales: English (
en), Arabic (arwith automatic Right-to-Left RTL layout switching), German (de), and Spanish (es). - Translation Hooks: Access translated strings in components using
useTranslations("namespace")on the client, orgetTranslations("namespace")on the server.
src/context/ & src/hooks/
context/: Clean global state management (ThemeProvideranduseTheme).hooks/: Reusable custom hooks (useIsMobile).