
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
@djangocfg/layouts
Advanced tools
Simple, straightforward layout components for Next.js - import and use with props
Layout components and providers for Next.js apps.
Part of DjangoCFG — modern Django framework for production-ready SaaS applications.
pnpm add @djangocfg/layouts
Add to globals.css (before @import "tailwindcss"):
@import "@djangocfg/ui-nextjs/styles";
@import "@djangocfg/layouts/styles";
@import "@djangocfg/ui-tools/styles";
@import "@djangocfg/debuger/styles";
@import "tailwindcss";
Core providers wrapper. Use directly when you don't need route-based layout switching.
import { BaseApp } from '@djangocfg/layouts';
export default function RootLayout({ children }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<BaseApp
project="my-app"
theme={{ defaultTheme: 'dark', storageKey: 'my-theme' }}
auth={{ apiUrl: process.env.NEXT_PUBLIC_API_URL }}
analytics={{ googleTrackingId: 'G-XXXXXXXXXX' }}
>
{children}
</BaseApp>
</body>
</html>
);
}
Props:
| Prop | Type | Default | Description |
|---|---|---|---|
project | string | — | App name — auto-passed to MonitorProvider and debug panel |
theme | ThemeConfig | — | Theme config (defaultTheme, storageKey) |
auth | AuthConfig | — | Auth provider config |
analytics | AnalyticsConfig | — | Google Analytics config |
centrifugo | CentrifugoConfig | — | WebSocket real-time config |
errorTracking | ErrorTrackingConfig | — | Validation/CORS/network error capture |
errorBoundary | ErrorBoundaryConfig | enabled | React error boundary |
swr | SWRConfigOptions | — | SWR data fetching config |
pwaInstall | PwaInstallConfig | — | PWA install prompt |
mcpChat | McpChatConfig | — | AI chat widget |
monitor | MonitorConfig | — | Override monitor config (project/environment come from project prop by default) |
debug | DebugConfig | enabled | Debug panel config — see below |
Included automatically:
project prop)@djangocfg/debugerSmart layout router — selects layout based on current route. Wraps BaseApp, accepts all its props.
import { AppLayout } from '@djangocfg/layouts';
import { PublicLayout } from './_layouts/PublicLayout';
import { PrivateLayout } from './_layouts/PrivateLayout';
import { AdminLayout } from './_layouts/AdminLayout';
export default function RootLayout({ children }) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<AppLayout
project="my-app"
theme={{ defaultTheme: 'system' }}
auth={{ apiUrl: process.env.NEXT_PUBLIC_API_URL }}
publicLayout={{ component: PublicLayout, enabledPath: ['/', '/legal', '/contact'] }}
privateLayout={{ component: PrivateLayout, enabledPath: ['/dashboard', '/profile'] }}
adminLayout={{ component: AdminLayout, enabledPath: '/admin' }}
noLayoutPaths={['/private/terminal', '/embed']}
>
{children}
</AppLayout>
</body>
</html>
);
}
Layout priority: Admin → Private → Public → Fallback
noLayoutPaths — render without layout wrapper (providers still active). Useful for fullscreen pages.
import { useLocaleSwitcher } from '@djangocfg/nextjs/i18n/client';
const { locale, locales, changeLocale } = useLocaleSwitcher();
<AppLayout
i18n={{ locale, locales, onLocaleChange: changeLocale }}
>
{children}
</AppLayout>
import { PublicLayout, PrivateLayout, AuthLayout, AdminLayout, ProfileLayout } from '@djangocfg/layouts';
| Layout | Description |
|---|---|
PublicLayout | Public pages with nav (home, docs, contact, legal) |
PrivateLayout | Authenticated pages with sidebar |
AuthLayout | OTP + OAuth + 2FA authentication flow |
AdminLayout | Admin panel |
ProfileLayout | User profile with 2FA management |
<AuthLayout
sourceUrl="https://example.com"
redirectUrl="/dashboard"
logoUrl="/logo.svg"
enableGithubAuth={true}
termsUrl="/terms"
privacyUrl="/privacy"
/>
<ProfileLayout
enable2FA={true}
showMemberSince={true}
/>
Both auto-enabled via project prop — no extra config needed.
// window.monitor available in DevTools:
window.monitor.error('Something broke', { context: 'checkout' })
window.monitor.warn('Slow response', { ms: 2500 })
window.monitor.flush() // send buffer immediately
window.monitor.status() // show current state
Override monitor defaults:
<BaseApp
project="my-app"
monitor={{ baseUrl: 'https://api.example.com', captureConsole: false }}
>
Cmd+D or ?debug=1 in URL to open.
// enabled by default (omit or pass empty object)
<BaseApp project="my-app">
// disable
<BaseApp debug={{ enabled: false }}>
// custom tabs (e.g. Zustand store viewer)
import type { CustomDebugTab } from '@djangocfg/debuger';
const myTabs: CustomDebugTab[] = [
{ id: 'store', label: 'Stores', icon: Database, panel: StoreTab },
];
<AppLayout debug={{ panel: { tabs: myTabs } }}>
import { useErrorEmitter, emitRuntimeError } from '@djangocfg/layouts';
// In components
const { emitError } = useErrorEmitter('MyComponent');
emitError('Something failed', error);
// Outside React
emitRuntimeError('MyUtil', 'Operation failed', error);
import { ErrorLayout } from '@djangocfg/layouts/components/errors';
// app/not-found.tsx
export default function NotFound() {
return <ErrorLayout code={404} supportEmail="support@example.com" />;
}
<BaseApp
pwaInstall={{
enabled: true,
showInstallHint: true,
logo: '/logo192.png',
delayMs: 3000,
resetAfterDays: 7,
resumeLastPage: true,
}}
>
import { RedirectPage } from '@djangocfg/layouts/components/RedirectPage';
export default function Page() {
return <RedirectPage authenticatedPath="/dashboard" unauthenticatedPath="/auth" />;
}
import { PrivacyPage, TermsPage, CookiesPage, SecurityPage } from '@djangocfg/layouts/pages/legal';
export default PrivacyPage;
| Path | Content |
|---|---|
@djangocfg/layouts | All exports |
@djangocfg/layouts/layouts | Layout components |
@djangocfg/layouts/snippets | Reusable components |
@djangocfg/layouts/components | Utility components |
@djangocfg/layouts/pages/legal | Legal pages |
@djangocfg/layouts/utils | OG image utils |
@djangocfg/layouts/styles | CSS |
@djangocfg/layouts/styles/dashboard | Dashboard CSS |
| Package | Description |
|---|---|
@djangocfg/ext-newsletter | Newsletter subscription |
@djangocfg/ext-knowbase | Knowledge base + AI chat |
@djangocfg/ext-leads | Lead capture forms |
@djangocfg/ext-payments | Payments & subscriptions |
@djangocfg/ext-support | Support tickets |
FAQs
Simple, straightforward layout components for Next.js - import and use with props
The npm package @djangocfg/layouts receives a total of 2,346 weekly downloads. As such, @djangocfg/layouts popularity was classified as popular.
We found that @djangocfg/layouts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.