@plutocms/supabase 0.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/nuxt/GENERATION.md +5 -0
- package/.agents/skills/nuxt/SKILL.md +55 -0
- package/.agents/skills/nuxt/references/advanced-hooks.md +289 -0
- package/.agents/skills/nuxt/references/advanced-layers.md +299 -0
- package/.agents/skills/nuxt/references/advanced-module-authoring.md +554 -0
- package/.agents/skills/nuxt/references/best-practices-data-fetching.md +357 -0
- package/.agents/skills/nuxt/references/best-practices-ssr.md +355 -0
- package/.agents/skills/nuxt/references/core-cli.md +263 -0
- package/.agents/skills/nuxt/references/core-config.md +162 -0
- package/.agents/skills/nuxt/references/core-data-fetching.md +236 -0
- package/.agents/skills/nuxt/references/core-deployment.md +224 -0
- package/.agents/skills/nuxt/references/core-directory-structure.md +269 -0
- package/.agents/skills/nuxt/references/core-modules.md +292 -0
- package/.agents/skills/nuxt/references/core-routing.md +226 -0
- package/.agents/skills/nuxt/references/features-components-autoimport.md +328 -0
- package/.agents/skills/nuxt/references/features-components.md +264 -0
- package/.agents/skills/nuxt/references/features-composables.md +276 -0
- package/.agents/skills/nuxt/references/features-server.md +265 -0
- package/.agents/skills/nuxt/references/features-state.md +194 -0
- package/.agents/skills/nuxt/references/rendering-modes.md +237 -0
- package/.agents/skills/nuxt-ui/SKILL.md +334 -0
- package/.agents/skills/nuxt-ui/references/components.md +377 -0
- package/.agents/skills/nuxt-ui/references/composables.md +127 -0
- package/.agents/skills/nuxt-ui/references/layouts/chat.md +195 -0
- package/.agents/skills/nuxt-ui/references/layouts/dashboard.md +220 -0
- package/.agents/skills/nuxt-ui/references/layouts/docs.md +141 -0
- package/.agents/skills/nuxt-ui/references/layouts/editor.md +167 -0
- package/.agents/skills/nuxt-ui/references/layouts/page.md +260 -0
- package/.agents/skills/nuxt-ui/references/theming.md +427 -0
- package/.agents/skills/supabase-postgres-best-practices/AGENTS.md +68 -0
- package/.agents/skills/supabase-postgres-best-practices/CLAUDE.md +1 -0
- package/.agents/skills/supabase-postgres-best-practices/README.md +116 -0
- package/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +57 -0
- package/.editorconfig +12 -0
- package/.env.example +2 -0
- package/.eslintignore +1 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +10 -0
- package/.vscode/settings.json +61 -0
- package/README.md +62 -0
- package/app/components/navbar/NavbarAdmin.vue +169 -0
- package/app/composables/auth.ts +81 -0
- package/app/layouts/setup.vue +13 -0
- package/app/middleware/auth.ts +27 -0
- package/app/middleware/setup-check.ts +25 -0
- package/app/pages/admin/(auth)/login.vue +84 -0
- package/app/pages/admin/(auth)/signup.vue +128 -0
- package/app/pages/admin/settings.vue +116 -0
- package/app/pages/admin/setup.vue +300 -0
- package/app/pages/admin.vue +38 -0
- package/bun.lock +2685 -0
- package/eslint.config.mjs +88 -0
- package/nuxt.config.ts +55 -0
- package/package.json +44 -0
- package/public/schema.sql +103 -0
- package/scripts/supabase-typegen.ts +36 -0
- package/server/api/category/list.get.ts +9 -0
- package/server/api/category/new.post.ts +31 -0
- package/server/api/settings/first_setup.get.ts +39 -0
- package/server/api/settings/index.get.ts +27 -0
- package/server/api/settings/update.post.ts +36 -0
- package/server/api/setup/create.post.ts +58 -0
- package/server/api/signup.post.ts +28 -0
- package/server/api/users/[id].get.ts +21 -0
- package/server/api/users/index.get.ts +16 -0
- package/shared/types/supabase.ts +406 -0
- package/skills-lock.json +20 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment
|
|
3
|
+
description: Deploying Nuxt applications to various hosting platforms
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deployment
|
|
7
|
+
|
|
8
|
+
Nuxt is platform-agnostic thanks to [Nitro](https://nitro.build), its server engine. You can deploy to almost any platform with minimal configuration—Node.js servers, static hosting, serverless functions, or edge networks.
|
|
9
|
+
|
|
10
|
+
> **Full list of supported platforms:** https://nitro.build/deploy
|
|
11
|
+
|
|
12
|
+
## Deployment Modes
|
|
13
|
+
|
|
14
|
+
### Node.js Server
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Build for Node.js
|
|
18
|
+
nuxt build
|
|
19
|
+
|
|
20
|
+
# Run production server
|
|
21
|
+
node .output/server/index.mjs
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Environment variables:
|
|
25
|
+
- `PORT` or `NITRO_PORT` (default: 3000)
|
|
26
|
+
- `HOST` or `NITRO_HOST` (default: 0.0.0.0)
|
|
27
|
+
|
|
28
|
+
### Static Generation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Generate static site
|
|
32
|
+
nuxt generate
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Output in `.output/public/` - deploy to any static host.
|
|
36
|
+
|
|
37
|
+
### Preset Configuration
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
// nuxt.config.ts
|
|
41
|
+
export default defineNuxtConfig({
|
|
42
|
+
nitro: {
|
|
43
|
+
preset: 'vercel', // or 'netlify', 'cloudflare-pages', etc.
|
|
44
|
+
},
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or via environment variable:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
NITRO_PRESET=vercel nuxt build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Recommended Platforms
|
|
57
|
+
|
|
58
|
+
When helping users choose a deployment platform, consider their needs:
|
|
59
|
+
|
|
60
|
+
### Vercel
|
|
61
|
+
|
|
62
|
+
**Best for:** Projects wanting zero-config deployment with excellent DX
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Install Vercel CLI
|
|
66
|
+
npm i -g vercel
|
|
67
|
+
|
|
68
|
+
# Deploy
|
|
69
|
+
vercel
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Pros:**
|
|
73
|
+
- Zero configuration for Nuxt (auto-detects)
|
|
74
|
+
- Excellent preview deployments for PRs
|
|
75
|
+
- Built-in analytics and speed insights
|
|
76
|
+
- Edge Functions support
|
|
77
|
+
- Great free tier for personal projects
|
|
78
|
+
|
|
79
|
+
**Cons:**
|
|
80
|
+
- Can get expensive at scale (bandwidth costs)
|
|
81
|
+
- Vendor lock-in concerns
|
|
82
|
+
- Limited build minutes on free tier
|
|
83
|
+
|
|
84
|
+
**Recommended when:** User wants fastest setup, values DX, building SaaS or marketing sites.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### Netlify
|
|
89
|
+
|
|
90
|
+
**Best for:** JAMstack sites, static-heavy apps, teams needing forms/identity
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Install Netlify CLI
|
|
94
|
+
npm i -g netlify-cli
|
|
95
|
+
|
|
96
|
+
# Deploy
|
|
97
|
+
netlify deploy --prod
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Pros:**
|
|
101
|
+
- Great free tier with generous bandwidth
|
|
102
|
+
- Built-in forms, identity, and functions
|
|
103
|
+
- Excellent for static sites with some dynamic features
|
|
104
|
+
- Good preview deployments
|
|
105
|
+
- Split testing built-in
|
|
106
|
+
|
|
107
|
+
**Cons:**
|
|
108
|
+
- SSR/serverless functions can be slower than Vercel
|
|
109
|
+
- Less optimized for full SSR apps
|
|
110
|
+
- Build minutes can run out on free tier
|
|
111
|
+
|
|
112
|
+
**Recommended when:** User has static-heavy site, needs built-in forms/auth, or prefers Netlify ecosystem.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Cloudflare Pages
|
|
117
|
+
|
|
118
|
+
**Best for:** Global performance, edge computing, cost-conscious projects
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Build with Cloudflare preset
|
|
122
|
+
NITRO_PRESET=cloudflare-pages nuxt build
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Pros:**
|
|
126
|
+
- Unlimited bandwidth on free tier
|
|
127
|
+
- Excellent global edge network (fastest TTFB)
|
|
128
|
+
- Workers for edge computing
|
|
129
|
+
- Very cost-effective at scale
|
|
130
|
+
- D1, KV, R2 for data storage
|
|
131
|
+
|
|
132
|
+
**Cons:**
|
|
133
|
+
- Workers have execution limits (CPU time)
|
|
134
|
+
- Some Node.js APIs not available in Workers
|
|
135
|
+
- Less mature than Vercel/Netlify for frameworks
|
|
136
|
+
|
|
137
|
+
**Recommended when:** User prioritizes performance, global reach, or cost at scale.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
### GitHub Actions + Self-hosted/VPS
|
|
142
|
+
|
|
143
|
+
**Best for:** Full control, existing infrastructure, CI/CD customization
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
# .github/workflows/deploy.yml
|
|
147
|
+
name: Deploy
|
|
148
|
+
on:
|
|
149
|
+
push:
|
|
150
|
+
branches: [main]
|
|
151
|
+
|
|
152
|
+
jobs:
|
|
153
|
+
deploy:
|
|
154
|
+
runs-on: ubuntu-latest
|
|
155
|
+
steps:
|
|
156
|
+
- uses: actions/checkout@v4
|
|
157
|
+
- uses: actions/setup-node@v4
|
|
158
|
+
with:
|
|
159
|
+
node-version: 20
|
|
160
|
+
|
|
161
|
+
- run: npm ci
|
|
162
|
+
- run: npm run build
|
|
163
|
+
|
|
164
|
+
# Deploy to your server (example: rsync to VPS)
|
|
165
|
+
- name: Deploy to server
|
|
166
|
+
run: rsync -avz .output/ user@server:/app/
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Pros:**
|
|
170
|
+
- Full control over build and deployment
|
|
171
|
+
- No vendor lock-in
|
|
172
|
+
- Can deploy anywhere (VPS, Docker, Kubernetes)
|
|
173
|
+
- Free CI/CD minutes for public repos
|
|
174
|
+
- Customizable workflows
|
|
175
|
+
|
|
176
|
+
**Cons:**
|
|
177
|
+
- Requires more setup and maintenance
|
|
178
|
+
- Need to manage your own infrastructure
|
|
179
|
+
- No built-in preview deployments
|
|
180
|
+
- SSL, scaling, monitoring are your responsibility
|
|
181
|
+
|
|
182
|
+
**Recommended when:** User has existing infrastructure, needs full control, or deploying to private/enterprise environments.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Quick Decision Guide
|
|
187
|
+
|
|
188
|
+
| Need | Recommendation |
|
|
189
|
+
|------|----------------|
|
|
190
|
+
| Fastest setup, small team | **Vercel** |
|
|
191
|
+
| Static site with forms | **Netlify** |
|
|
192
|
+
| Cost-sensitive at scale | **Cloudflare Pages** |
|
|
193
|
+
| Full control / enterprise | **GitHub Actions + VPS** |
|
|
194
|
+
| Docker/Kubernetes | **GitHub Actions + Container Registry** |
|
|
195
|
+
| Serverless APIs | **Vercel** or **AWS Lambda** |
|
|
196
|
+
|
|
197
|
+
## Docker Deployment
|
|
198
|
+
|
|
199
|
+
```dockerfile
|
|
200
|
+
FROM node:20-alpine AS builder
|
|
201
|
+
WORKDIR /app
|
|
202
|
+
COPY package*.json ./
|
|
203
|
+
RUN npm ci
|
|
204
|
+
COPY . .
|
|
205
|
+
RUN npm run build
|
|
206
|
+
|
|
207
|
+
FROM node:20-alpine
|
|
208
|
+
WORKDIR /app
|
|
209
|
+
COPY --from=builder /app/.output .output
|
|
210
|
+
ENV PORT=3000
|
|
211
|
+
EXPOSE 3000
|
|
212
|
+
CMD ["node", ".output/server/index.mjs"]
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
docker build -t my-nuxt-app .
|
|
217
|
+
docker run -p 3000:3000 my-nuxt-app
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
<!--
|
|
221
|
+
Source references:
|
|
222
|
+
- https://nuxt.com/docs/getting-started/deployment
|
|
223
|
+
- https://nitro.build/deploy
|
|
224
|
+
-->
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: directory-structure
|
|
3
|
+
description: Nuxt project folder structure, conventions, and file organization
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Directory Structure
|
|
7
|
+
|
|
8
|
+
Nuxt uses conventions-based directory structure. Understanding it is key to effective development.
|
|
9
|
+
|
|
10
|
+
## Standard Project Structure
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
my-nuxt-app/
|
|
14
|
+
├── app/ # Application source (can be at root level)
|
|
15
|
+
│ ├── app.vue # Root component
|
|
16
|
+
│ ├── app.config.ts # App configuration (runtime)
|
|
17
|
+
│ ├── error.vue # Error page
|
|
18
|
+
│ ├── components/ # Auto-imported Vue components
|
|
19
|
+
│ ├── composables/ # Auto-imported composables
|
|
20
|
+
│ ├── layouts/ # Layout components
|
|
21
|
+
│ ├── middleware/ # Route middleware
|
|
22
|
+
│ ├── pages/ # File-based routing
|
|
23
|
+
│ ├── plugins/ # Vue plugins
|
|
24
|
+
│ └── utils/ # Auto-imported utilities
|
|
25
|
+
├── assets/ # Build-processed assets (CSS, images)
|
|
26
|
+
├── public/ # Static assets (served as-is)
|
|
27
|
+
├── server/ # Server-side code
|
|
28
|
+
│ ├── api/ # API routes (/api/*)
|
|
29
|
+
│ ├── routes/ # Server routes
|
|
30
|
+
│ ├── middleware/ # Server middleware
|
|
31
|
+
│ ├── plugins/ # Nitro plugins
|
|
32
|
+
│ └── utils/ # Server utilities (auto-imported)
|
|
33
|
+
├── content/ # Content files (@nuxt/content)
|
|
34
|
+
├── layers/ # Local layers (auto-scanned)
|
|
35
|
+
├── modules/ # Local modules
|
|
36
|
+
├── nuxt.config.ts # Nuxt configuration
|
|
37
|
+
├── package.json
|
|
38
|
+
└── tsconfig.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Key Directories
|
|
42
|
+
|
|
43
|
+
### `app/` Directory
|
|
44
|
+
|
|
45
|
+
Contains all application code. Can also be at root level (without `app/` folder).
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
// nuxt.config.ts - customize source directory
|
|
49
|
+
export default defineNuxtConfig({
|
|
50
|
+
srcDir: 'src/', // Change from 'app/' to 'src/'
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `app/components/`
|
|
55
|
+
|
|
56
|
+
Vue components auto-imported by name:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
components/
|
|
60
|
+
├── Button.vue → <Button />
|
|
61
|
+
├── Card.vue → <Card />
|
|
62
|
+
├── base/
|
|
63
|
+
│ └── Button.vue → <BaseButton />
|
|
64
|
+
├── ui/
|
|
65
|
+
│ ├── Input.vue → <UiInput />
|
|
66
|
+
│ └── Modal.vue → <UiModal />
|
|
67
|
+
└── TheHeader.vue → <TheHeader />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Lazy loading**: Prefix with `Lazy` for dynamic import:
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<LazyHeavyChart v-if="showChart" />
|
|
75
|
+
</template>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Client/Server only**:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
components/
|
|
82
|
+
├── Comments.client.vue → Only rendered on client
|
|
83
|
+
└── ServerData.server.vue → Only rendered on server
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `app/composables/`
|
|
87
|
+
|
|
88
|
+
Vue composables auto-imported (top-level files only):
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
composables/
|
|
92
|
+
├── useAuth.ts → useAuth()
|
|
93
|
+
├── useFoo.ts → useFoo()
|
|
94
|
+
└── nested/
|
|
95
|
+
└── utils.ts → NOT auto-imported
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Re-export nested composables:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// composables/index.ts
|
|
102
|
+
export { useHelper } from './nested/utils'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### `app/pages/`
|
|
106
|
+
|
|
107
|
+
File-based routing:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
pages/
|
|
111
|
+
├── index.vue → /
|
|
112
|
+
├── about.vue → /about
|
|
113
|
+
├── blog/
|
|
114
|
+
│ ├── index.vue → /blog
|
|
115
|
+
│ └── [slug].vue → /blog/:slug
|
|
116
|
+
├── users/
|
|
117
|
+
│ └── [id]/
|
|
118
|
+
│ └── profile.vue → /users/:id/profile
|
|
119
|
+
├── [...slug].vue → /* (catch-all)
|
|
120
|
+
├── [[optional]].vue → /:optional? (optional param)
|
|
121
|
+
└── (marketing)/ → Route group (not in URL)
|
|
122
|
+
└── pricing.vue → /pricing
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Pages are optional**: Without `pages/`, no vue-router is included.
|
|
126
|
+
|
|
127
|
+
### `app/layouts/`
|
|
128
|
+
|
|
129
|
+
Layout components wrapping pages:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
layouts/
|
|
133
|
+
├── default.vue → Default layout
|
|
134
|
+
├── admin.vue → Admin layout
|
|
135
|
+
└── blank.vue → No layout
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<!-- layouts/default.vue -->
|
|
140
|
+
<template>
|
|
141
|
+
<div>
|
|
142
|
+
<TheHeader />
|
|
143
|
+
<slot />
|
|
144
|
+
<TheFooter />
|
|
145
|
+
</div>
|
|
146
|
+
</template>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Use in pages:
|
|
150
|
+
|
|
151
|
+
```vue
|
|
152
|
+
<script setup>
|
|
153
|
+
definePageMeta({
|
|
154
|
+
layout: 'admin',
|
|
155
|
+
// layout: false // Disable layout
|
|
156
|
+
})
|
|
157
|
+
</script>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### `app/middleware/`
|
|
161
|
+
|
|
162
|
+
Route middleware:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
middleware/
|
|
166
|
+
├── auth.ts → Named middleware
|
|
167
|
+
├── admin.ts → Named middleware
|
|
168
|
+
└── logger.global.ts → Global middleware (runs on every route)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### `app/plugins/`
|
|
172
|
+
|
|
173
|
+
Nuxt plugins (auto-registered):
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
plugins/
|
|
177
|
+
├── 01.analytics.ts → Order with number prefix
|
|
178
|
+
├── 02.auth.ts
|
|
179
|
+
├── vue-query.client.ts → Client-only plugin
|
|
180
|
+
└── server-init.server.ts → Server-only plugin
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### `server/` Directory
|
|
184
|
+
|
|
185
|
+
Nitro server code:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
server/
|
|
189
|
+
├── api/
|
|
190
|
+
│ ├── users.ts → GET /api/users
|
|
191
|
+
│ ├── users.post.ts → POST /api/users
|
|
192
|
+
│ └── users/[id].ts → /api/users/:id
|
|
193
|
+
├── routes/
|
|
194
|
+
│ └── sitemap.xml.ts → /sitemap.xml
|
|
195
|
+
├── middleware/
|
|
196
|
+
│ └── auth.ts → Runs on every request
|
|
197
|
+
├── plugins/
|
|
198
|
+
│ └── db.ts → Server startup plugins
|
|
199
|
+
└── utils/
|
|
200
|
+
└── db.ts → Auto-imported server utilities
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### `public/` Directory
|
|
204
|
+
|
|
205
|
+
Static assets served at root URL:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
public/
|
|
209
|
+
├── favicon.ico → /favicon.ico
|
|
210
|
+
├── robots.txt → /robots.txt
|
|
211
|
+
└── images/
|
|
212
|
+
└── logo.png → /images/logo.png
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `assets/` Directory
|
|
216
|
+
|
|
217
|
+
Build-processed assets:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
assets/
|
|
221
|
+
├── css/
|
|
222
|
+
│ └── main.css
|
|
223
|
+
├── images/
|
|
224
|
+
│ └── hero.png
|
|
225
|
+
└── fonts/
|
|
226
|
+
└── custom.woff2
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Reference in components:
|
|
230
|
+
|
|
231
|
+
```vue
|
|
232
|
+
<template>
|
|
233
|
+
<img src="~/assets/images/hero.png" />
|
|
234
|
+
</template>
|
|
235
|
+
|
|
236
|
+
<style>
|
|
237
|
+
@import '~/assets/css/main.css';
|
|
238
|
+
</style>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Special Files
|
|
242
|
+
|
|
243
|
+
| File | Purpose |
|
|
244
|
+
|------|---------|
|
|
245
|
+
| `app.vue` | Root component (optional with pages/) |
|
|
246
|
+
| `app.config.ts` | Runtime app configuration |
|
|
247
|
+
| `error.vue` | Custom error page |
|
|
248
|
+
| `nuxt.config.ts` | Build-time configuration |
|
|
249
|
+
| `.nuxtignore` | Ignore files from Nuxt |
|
|
250
|
+
| `.env` | Environment variables |
|
|
251
|
+
|
|
252
|
+
## File Naming Conventions
|
|
253
|
+
|
|
254
|
+
| Pattern | Meaning |
|
|
255
|
+
|---------|---------|
|
|
256
|
+
| `[param]` | Dynamic route parameter |
|
|
257
|
+
| `[[param]]` | Optional parameter |
|
|
258
|
+
| `[...slug]` | Catch-all route |
|
|
259
|
+
| `(group)` | Route group (not in URL) |
|
|
260
|
+
| `.client.vue` | Client-only component |
|
|
261
|
+
| `.server.vue` | Server-only component |
|
|
262
|
+
| `.global.ts` | Global middleware |
|
|
263
|
+
|
|
264
|
+
<!--
|
|
265
|
+
Source references:
|
|
266
|
+
- https://nuxt.com/docs/directory-structure
|
|
267
|
+
- https://nuxt.com/docs/directory-structure/app
|
|
268
|
+
- https://nuxt.com/docs/directory-structure/server
|
|
269
|
+
-->
|