Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/docs/content/docs/dev/database/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "Database",
"description": "Learn how to work with databases in VitNode plugins using Drizzle ORM and PostgreSQL.",
"icon": "Database",
"pages": ["..."]
}
2 changes: 2 additions & 0 deletions apps/docs/content/docs/dev/i18n/meta.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"title": "Internationalization (I18n)",
"description": "Learn how to make your VitNode plugins multilingual with our I18n guide.",
"icon": "Globe",
"pages": ["expand-langs", "namespaces", "messages", "..."]
}
210 changes: 0 additions & 210 deletions apps/docs/content/docs/dev/layouts-and-pages.mdx

This file was deleted.

8 changes: 2 additions & 6 deletions apps/docs/content/docs/dev/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,18 @@
"deployments",
"---Framework---",
"plugins",
"api",
"database",
"fetcher",
"working-with-users",
"i18n",
"advanced",
"---Adapters---",
"captcha",
"email",
"sso",
"cron",
"websocket",
"---Frontend---",
"layouts-and-pages",
"admin-page",
"fetcher",
"---UI---",
"i18n",
"not-found",
"..."
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,41 @@ description: Create powerful admin interfaces for your plugins with protected pa

## Pages & Layouts

AdminCP follows the same patterns like from [Layouts and Pages](/docs/plugins/layouts-and-pages) but uses the `src/app_admin` directory.
AdminCP follows the same patterns like from [Layouts and Pages](/docs/dev/plugins/layouts-and-pages) but uses the `src/routes/admin` directory. Like everywhere in VitNode, render text with translations — see [Messages](/docs/dev/i18n/messages).

### Pages

```tsx title="plugins/{plugin_name}/src/app_admin/blog/settings/page.tsx"
export default function Page() {
```tsx title="plugins/{plugin_name}/src/routes/admin/blog/settings/page.tsx"
import { getTranslations } from 'next-intl/server';

export default async function Page() {
const t = await getTranslations('@vitnode/blog.admin.settings'); // [!code highlight]

return (
<div>
<h1>Settings</h1>
<p>Hello from Blog plugin in AdminCP</p>
<h1>{t('title')}</h1>
<p>{t('desc')}</p>
</div>
);
}
```

### Layouts

```tsx title="plugins/{plugin_name}/src/app_admin/blog/settings/layout.tsx"
export default function AdminRootLayout({
```tsx title="plugins/{plugin_name}/src/routes/admin/blog/settings/layout.tsx"
import { getTranslations } from 'next-intl/server';

export default async function AdminRootLayout({
children,
}: {
children: React.ReactNode;
}) {
const t = await getTranslations('@vitnode/blog.admin.settings');

return (
<div className="min-h-screen bg-gray-50">
<header className="border-b bg-white p-4">
<h1 className="text-xl font-semibold">Blog Admin</h1>
<h1 className="text-xl font-semibold">{t('title')}</h1>
</header>
{children}
</div>
Expand All @@ -40,8 +48,8 @@ export default function AdminRootLayout({
```

<Callout>
All pages & layouts in the `app_admin` directory are automatically protected
and require admin authentication.
All pages & layouts in the `src/routes/admin` directory are automatically
protected and require admin authentication.
</Callout>

## Navigation items
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"title": "REST API",
"defaultOpen": true,
"pages": ["modules", "..."]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Modules
description: xxx
description: Learn how to organize your API routes into modules for better structure and maintainability.
---

## Usage
Expand All @@ -15,7 +15,7 @@ import { CONFIG_PLUGIN } from "@/config";
export const categoriesModule = buildModule({
pluginId: CONFIG_PLUGIN.id,
name: "categories",
routes: [] // We'll populate this soon!
routes: [], // We'll populate this soon!
});
```

Expand All @@ -34,7 +34,7 @@ export const categoriesModule = buildModule({
pluginId: CONFIG_PLUGIN.id,
name: "categories",
routes: [],
modules: [postsModule] // [!code ++]
modules: [postsModule], // [!code ++]
});
```

Expand All @@ -52,7 +52,7 @@ import { categoriesModule } from "./api/modules/categories/categories.module"; /
export const blogApiPlugin = () => {
return buildApiPlugin({
pluginId: CONFIG_PLUGIN.pluginId,
modules: [categoriesModule] // [!code ++]
modules: [categoriesModule], // [!code ++]
});
};
```
Loading
Loading