feat: initial commit of WMOC CEO portfolio with cruise ship parallax and seafarer document compliance platform
This commit is contained in:
40
.agents/skills/app-builder/templates/SKILL.md
Normal file
40
.agents/skills/app-builder/templates/SKILL.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: templates
|
||||
description: Project scaffolding templates for new applications. Use when creating new projects from scratch. Contains 13 templates for various tech stacks.
|
||||
allowed-tools: Read, Glob, Grep
|
||||
---
|
||||
|
||||
# Project Templates
|
||||
|
||||
> Quick-start templates for scaffolding new projects.
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Selective Reading Rule
|
||||
|
||||
**Read ONLY the template matching user's project type!**
|
||||
|
||||
| Template | Tech Stack | When to Use |
|
||||
|----------|------------|-------------|
|
||||
| [nextjs-fullstack](nextjs-fullstack/TEMPLATE.md) | Next.js + Prisma | Full-stack web app |
|
||||
| [nextjs-saas](nextjs-saas/TEMPLATE.md) | Next.js + Stripe | SaaS product |
|
||||
| [nextjs-static](nextjs-static/TEMPLATE.md) | Next.js + Framer | Landing page |
|
||||
| [nuxt-app](nuxt-app/TEMPLATE.md) | Nuxt 4 + Pinia | Vue full-stack app |
|
||||
| [express-api](express-api/TEMPLATE.md) | Express + JWT | REST API |
|
||||
| [python-fastapi](python-fastapi/TEMPLATE.md) | FastAPI | Python API |
|
||||
| [react-native-app](react-native-app/TEMPLATE.md) | Expo + Zustand | Mobile app |
|
||||
| [flutter-app](flutter-app/TEMPLATE.md) | Flutter + Riverpod | Cross-platform |
|
||||
| [electron-desktop](electron-desktop/TEMPLATE.md) | Electron + React | Desktop app |
|
||||
| [chrome-extension](chrome-extension/TEMPLATE.md) | Chrome MV3 | Browser extension |
|
||||
| [cli-tool](cli-tool/TEMPLATE.md) | Node.js + Commander | CLI app |
|
||||
| [monorepo-turborepo](monorepo-turborepo/TEMPLATE.md) | Turborepo + pnpm | Monorepo |
|
||||
| [astro-static](astro-static/TEMPLATE.md) | Astro + MDX | Blog / Docs |
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
1. User says "create [type] app"
|
||||
2. Match to appropriate template
|
||||
3. Read ONLY that template's TEMPLATE.md
|
||||
4. Follow its tech stack and structure
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
name: astro-static
|
||||
description: Astro static site template principles. Content-focused websites, blogs, documentation.
|
||||
---
|
||||
|
||||
# Astro Static Site Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Framework | Astro 6.x |
|
||||
| Content | MDX + Content Collections (Content Layer API) |
|
||||
| Styling | Tailwind CSS v4 (@tailwindcss/vite) |
|
||||
| Integrations | Sitemap, RSS, SEO |
|
||||
| Output | Static/SSG |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── components/ # .astro components
|
||||
│ ├── content/ # Collection entries (blog/, docs/ .md/.mdx)
|
||||
│ ├── layouts/ # Page layouts
|
||||
│ ├── pages/ # File-based routing (only reserved dir)
|
||||
│ ├── styles/
|
||||
│ │ └── global.css # @import "tailwindcss";
|
||||
│ └── content.config.ts # Collection definitions (Content Layer, in src/ root)
|
||||
├── public/ # Static assets
|
||||
├── astro.config.mjs
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts
|
||||
|
||||
| Concept | Description |
|
||||
|---------|-------------|
|
||||
| Content Layer API | Collections defined in `src/content.config.ts` with `loader`s (glob/file) + Zod schemas |
|
||||
| Islands Architecture | Partial hydration for interactivity |
|
||||
| Zero JS by default | Static HTML unless needed |
|
||||
| MDX Support | Markdown with components |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. `npm create astro@latest {{name}}`
|
||||
2. Add integrations: `npx astro add mdx sitemap`
|
||||
3. Add Tailwind v4: `npx astro add tailwind` (installs @tailwindcss/vite, not the legacy @astrojs/tailwind)
|
||||
4. Define collections in `src/content.config.ts` using `loader`s + Zod schemas
|
||||
5. `npm run dev`
|
||||
|
||||
---
|
||||
|
||||
## Deployment
|
||||
|
||||
| Platform | Method |
|
||||
|----------|--------|
|
||||
| Vercel | Auto-detected |
|
||||
| Netlify | Auto-detected |
|
||||
| Cloudflare Pages | Auto-detected |
|
||||
| GitHub Pages | Build + deploy action |
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use Content Collections for type safety
|
||||
- Leverage static generation
|
||||
- Add islands only where needed
|
||||
- Optimize images with Astro Image
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
name: chrome-extension
|
||||
description: Chrome Extension template principles. Manifest V3, React, TypeScript.
|
||||
---
|
||||
|
||||
# Chrome Extension Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Manifest | V3 |
|
||||
| UI | React 19 |
|
||||
| Language | TypeScript |
|
||||
| Styling | Tailwind CSS v4 |
|
||||
| Bundler | Vite + CRXJS (@crxjs/vite-plugin v2) |
|
||||
| Storage | Chrome Storage API |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
> CRXJS + Vite: `manifest.config.ts` is the source of truth, Vite resolves entries.
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── popup/ # { index.html, main.tsx, Popup.tsx }
|
||||
│ ├── options/ # { index.html, main.tsx, Options.tsx }
|
||||
│ ├── background/ # service-worker.ts (MV3 service worker)
|
||||
│ ├── content/ # { content-script.ts, content.css }
|
||||
│ ├── components/ # Shared React
|
||||
│ └── lib/
|
||||
│ ├── storage.ts # Chrome storage helpers
|
||||
│ └── messaging.ts # Message passing
|
||||
├── public/ # Static assets (icons)
|
||||
├── manifest.config.ts # defineManifest() — typed manifest
|
||||
├── vite.config.ts # crx({ manifest }) + react + tailwind
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Manifest V3 Concepts
|
||||
|
||||
| Component | Purpose |
|
||||
|-----------|---------|
|
||||
| Service Worker | Background processing |
|
||||
| Content Scripts | Page injection |
|
||||
| Popup | User interface |
|
||||
| Options Page | Settings |
|
||||
|
||||
---
|
||||
|
||||
## Permissions
|
||||
|
||||
| Permission | Use |
|
||||
|------------|-----|
|
||||
| storage | Save user data |
|
||||
| activeTab | Current tab access |
|
||||
| scripting | Inject scripts |
|
||||
| host_permissions | Site access |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. `npm create vite@latest {{name}} -- --template react-ts`
|
||||
2. Install CRXJS: `npm install -D @crxjs/vite-plugin@latest`
|
||||
3. Add Chrome types: `npm install -D @types/chrome`
|
||||
4. Create `manifest.config.ts` with `defineManifest`, wire `crx({ manifest })` in `vite.config.ts`
|
||||
5. `npm run dev` (HMR for popup/options/content)
|
||||
6. Load in Chrome: `chrome://extensions` → Load unpacked → select `dist/`
|
||||
|
||||
---
|
||||
|
||||
## Development Tips
|
||||
|
||||
| Task | Method |
|
||||
|------|--------|
|
||||
| Debug Popup | Right-click icon → Inspect |
|
||||
| Debug Background | Extensions page → Service worker |
|
||||
| Debug Content | DevTools console on page |
|
||||
| Hot Reload | `npm run dev` (CRXJS HMR) |
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use type-safe messaging
|
||||
- Wrap Chrome APIs in promises
|
||||
- MV3 background is an ephemeral service worker — persist state in `chrome.storage`, not module globals; use event listeners + alarms, not long-lived timers
|
||||
- Minimize permissions
|
||||
- Scope content-script styles to avoid host-page bleed
|
||||
88
.agents/skills/app-builder/templates/cli-tool/TEMPLATE.md
Normal file
88
.agents/skills/app-builder/templates/cli-tool/TEMPLATE.md
Normal file
@@ -0,0 +1,88 @@
|
||||
---
|
||||
name: cli-tool
|
||||
description: Node.js CLI tool template principles. Commander.js, interactive prompts.
|
||||
---
|
||||
|
||||
# CLI Tool Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Runtime | Node.js 24 (Krypton LTS) |
|
||||
| Language | TypeScript (ESM) |
|
||||
| CLI Framework | Commander.js (v15, needs Node ≥22.12) |
|
||||
| Prompts | @inquirer/prompts (modular) |
|
||||
| Output | chalk + ora |
|
||||
| Config | cosmiconfig |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── index.ts # Entry: #!/usr/bin/env node shebang, wires Commander
|
||||
│ ├── commands/ # One file per command (factory functions)
|
||||
│ ├── lib/ # Core logic (framework-agnostic, testable)
|
||||
│ ├── utils/ # logger (chalk/ora), prompt wrappers
|
||||
│ └── config.ts # cosmiconfig loader
|
||||
├── dist/ # Build output (tsup/tsc)
|
||||
└── package.json # "type":"module", "bin":{...}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CLI Design Principles
|
||||
|
||||
| Principle | Description |
|
||||
|-----------|-------------|
|
||||
| Subcommands | Group related actions |
|
||||
| Options | Flags with defaults |
|
||||
| Interactive | Prompts when needed |
|
||||
| Non-interactive | Support --yes flags |
|
||||
|
||||
---
|
||||
|
||||
## Key Components
|
||||
|
||||
| Component | Purpose |
|
||||
|-----------|---------|
|
||||
| Commander | Command parsing (use a local `new Command()` for testability) |
|
||||
| @inquirer/prompts | Modular interactive prompts (`input`, `select`, `confirm`) |
|
||||
| Chalk | Colored output |
|
||||
| Ora | Spinners/loading |
|
||||
| Cosmiconfig | Config file discovery |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Create project directory
|
||||
2. `npm init -y` then set `"type": "module"`
|
||||
3. Install deps: `npm install commander @inquirer/prompts chalk ora cosmiconfig`
|
||||
4. Point `bin` at compiled `./dist/index.js`, keep `#!/usr/bin/env node` shebang
|
||||
5. `npm link` for local testing
|
||||
|
||||
---
|
||||
|
||||
## Publishing
|
||||
|
||||
```bash
|
||||
npm login
|
||||
npm publish
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Keep `src/index.ts` thin; attach commands via `.addCommand()` factories in `src/commands/`
|
||||
- Put business logic in `lib/`/`utils/` so commands stay testable wrappers
|
||||
- ESM by default; build with tsup/esbuild
|
||||
- Support both interactive and non-interactive (`--yes`) modes
|
||||
- Validate inputs with Zod; exit with proper codes (0 success, 1 error)
|
||||
- Alternatives worth knowing: @clack/prompts (polished prompts), citty (lightweight ESM command framework)
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
name: electron-desktop
|
||||
description: Electron desktop app template principles. Cross-platform, React, TypeScript.
|
||||
---
|
||||
|
||||
# Electron Desktop App Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Framework | Electron 42+ |
|
||||
| UI | React 19 |
|
||||
| Language | TypeScript |
|
||||
| Styling | Tailwind CSS v4 |
|
||||
| Bundler | electron-vite + electron-builder |
|
||||
| IPC | Type-safe communication (contextBridge) |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
> electron-vite layout: main / preload / renderer separation is the 2026 standard.
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── main/ # Main process (lifecycle, windows, IPC handlers)
|
||||
│ │ └── index.ts
|
||||
│ ├── preload/ # contextBridge — type-safe IPC surface
|
||||
│ │ ├── index.ts
|
||||
│ │ └── index.d.ts # Ambient types shared with renderer
|
||||
│ └── renderer/ # React app
|
||||
│ ├── index.html
|
||||
│ └── src/
|
||||
│ ├── main.tsx
|
||||
│ ├── App.tsx
|
||||
│ └── components/
|
||||
├── resources/ # App icons / static (build-time)
|
||||
├── build/ # Builder assets (entitlements, icons)
|
||||
├── electron.vite.config.ts
|
||||
├── electron-builder.yml
|
||||
└── package.json # scripts: electron-vite dev | build | preview
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Process Model
|
||||
|
||||
| Process | Role |
|
||||
|---------|------|
|
||||
| Main | Node.js, system access |
|
||||
| Renderer | Chromium, React UI |
|
||||
| Preload | Bridge, context isolation |
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts
|
||||
|
||||
| Concept | Purpose |
|
||||
|---------|---------|
|
||||
| contextBridge | Safe API exposure |
|
||||
| ipcMain/ipcRenderer | Process communication |
|
||||
| nodeIntegration: false | Security |
|
||||
| contextIsolation: true | Security |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. `npm create @quick-start/electron@latest {{name}} -- --template react-ts`
|
||||
2. `cd {{name}} && npm install`
|
||||
3. Add Tailwind v4: `npm install tailwindcss @tailwindcss/vite`
|
||||
4. Define IPC types in `src/preload/index.d.ts`
|
||||
5. `npm run dev`
|
||||
|
||||
---
|
||||
|
||||
## Build Targets
|
||||
|
||||
| Platform | Output |
|
||||
|----------|--------|
|
||||
| Windows | NSIS, Portable |
|
||||
| macOS | DMG, ZIP |
|
||||
| Linux | AppImage, DEB |
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- `contextIsolation: true` (default v12+), `sandbox: true` (default v20+), `nodeIntegration: false` (default v5+) — never enable Node for remote content
|
||||
- Expose a narrow API via `contextBridge.exposeInMainWorld`, never raw `ipcRenderer`
|
||||
- Validate IPC `sender` against an allowlist; set a restrictive CSP (`script-src 'self'`)
|
||||
- Type-safe IPC: share types from `preload/index.d.ts` into the renderer
|
||||
- Auto-updates with electron-updater
|
||||
91
.agents/skills/app-builder/templates/express-api/TEMPLATE.md
Normal file
91
.agents/skills/app-builder/templates/express-api/TEMPLATE.md
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
name: express-api
|
||||
description: Express.js REST API template principles. TypeScript, Prisma, JWT.
|
||||
---
|
||||
|
||||
# Express.js API Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Runtime | Node.js 24 (Krypton LTS) |
|
||||
| Framework | Express 5 (stable, default on npm) |
|
||||
| Language | TypeScript |
|
||||
| Database | PostgreSQL + Prisma |
|
||||
| Validation | Zod |
|
||||
| Auth | JWT + bcrypt |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── prisma/
|
||||
│ └── schema.prisma
|
||||
├── src/
|
||||
│ ├── app.ts # Express app + middleware wiring (no listen)
|
||||
│ ├── server.ts # Bootstrap: listen() — split for testability
|
||||
│ ├── config/ # Environment
|
||||
│ ├── routes/ # Route definitions only
|
||||
│ ├── controllers/ # HTTP layer (req/res, calls services)
|
||||
│ ├── services/ # Business logic
|
||||
│ ├── middlewares/
|
||||
│ │ ├── auth.ts # JWT verify
|
||||
│ │ ├── error.ts # Error handler
|
||||
│ │ └── validate.ts # Zod validation
|
||||
│ ├── schemas/ # Zod schemas
|
||||
│ └── utils/
|
||||
├── tests/
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Middleware Stack
|
||||
|
||||
| Order | Middleware |
|
||||
|-------|------------|
|
||||
| 1 | helmet (security) |
|
||||
| 2 | cors |
|
||||
| 3 | compression |
|
||||
| 4 | body parsing |
|
||||
| 5 | morgan (logging) |
|
||||
| 6 | routes |
|
||||
| 7 | error handler (last, 4-arg signature) |
|
||||
|
||||
---
|
||||
|
||||
## API Response Format
|
||||
|
||||
| Type | Structure |
|
||||
|------|-----------|
|
||||
| Success | `{ success: true, data: {...} }` |
|
||||
| Error | `{ error: "message", details: [...] }` |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Create project directory
|
||||
2. `npm init -y`
|
||||
3. Install deps: `npm install express @prisma/client zod bcrypt jsonwebtoken`
|
||||
4. Install devDeps: `npm install -D prisma typescript @types/node @types/express @types/bcrypt @types/jsonwebtoken`
|
||||
5. Configure Prisma (`npx prisma init`)
|
||||
6. `npm run db:push`
|
||||
7. `npm run dev`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Split `app.ts` (wiring) from `server.ts` (`listen`) so the app imports cleanly into tests
|
||||
- Layer architecture (routes → controllers → services)
|
||||
- Validate all inputs with Zod at the route boundary
|
||||
- Centralized error handler last (Express 5 auto-forwards rejected promises — no manual catch wrapper needed)
|
||||
- Environment-based config
|
||||
- Use Prisma for type-safe DB access
|
||||
93
.agents/skills/app-builder/templates/flutter-app/TEMPLATE.md
Normal file
93
.agents/skills/app-builder/templates/flutter-app/TEMPLATE.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
name: flutter-app
|
||||
description: Flutter mobile app template principles. Riverpod, Go Router, clean architecture.
|
||||
---
|
||||
|
||||
# Flutter App Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Framework | Flutter 3.x |
|
||||
| Language | Dart 3.x |
|
||||
| State | Riverpod 3 (codegen) |
|
||||
| Navigation | Go Router |
|
||||
| HTTP | Dio |
|
||||
| Storage | Hive |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project_name/
|
||||
├── lib/
|
||||
│ ├── main.dart
|
||||
│ ├── app.dart
|
||||
│ ├── core/
|
||||
│ │ ├── constants/
|
||||
│ │ ├── theme/
|
||||
│ │ ├── router/
|
||||
│ │ └── utils/
|
||||
│ ├── features/
|
||||
│ │ ├── auth/
|
||||
│ │ │ ├── data/
|
||||
│ │ │ ├── domain/
|
||||
│ │ │ └── presentation/
|
||||
│ │ └── home/
|
||||
│ ├── shared/
|
||||
│ │ ├── widgets/
|
||||
│ │ └── providers/
|
||||
│ └── services/
|
||||
│ ├── api/
|
||||
│ └── storage/
|
||||
├── test/
|
||||
└── pubspec.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Architecture Layers
|
||||
|
||||
| Layer | Contents |
|
||||
|-------|----------|
|
||||
| Presentation | Screens, Widgets, Providers |
|
||||
| Domain | Entities, Use Cases |
|
||||
| Data | Repositories, Models |
|
||||
|
||||
---
|
||||
|
||||
## Key Packages
|
||||
|
||||
| Package | Purpose |
|
||||
|---------|---------|
|
||||
| flutter_riverpod | State management |
|
||||
| riverpod_annotation | Code generation |
|
||||
| go_router | Navigation |
|
||||
| dio | HTTP client |
|
||||
| freezed | Immutable models |
|
||||
| hive | Local storage |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. `flutter create {{name}} --org com.{{bundle}}`
|
||||
2. Update `pubspec.yaml`
|
||||
3. `flutter pub get`
|
||||
4. Run code generation: `dart run build_runner build`
|
||||
5. `flutter run`
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Feature-first folder structure (data / domain / presentation per feature)
|
||||
- Riverpod 3 with `riverpod_annotation` codegen (generated ref is just `Ref`; plain `Notifier`, no `AutoDisposeNotifier`)
|
||||
- Legacy `StateProvider`/`StateNotifierProvider` moved to `package:riverpod/legacy.dart`
|
||||
- Freezed for immutable data classes
|
||||
- Go Router for declarative navigation
|
||||
- Material 3 theming
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
name: monorepo-turborepo
|
||||
description: Turborepo monorepo template principles. pnpm workspaces, shared packages.
|
||||
---
|
||||
|
||||
# Turborepo Monorepo Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Build System | Turborepo 2.x |
|
||||
| Package Manager | pnpm |
|
||||
| Apps | Next.js, Express |
|
||||
| Packages | Shared UI, Config, Types, Utils |
|
||||
| Language | TypeScript |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── apps/
|
||||
│ ├── web/ # Next.js app
|
||||
│ ├── api/ # Express API
|
||||
│ └── docs/ # Documentation
|
||||
├── packages/
|
||||
│ ├── ui/ # Shared components (@repo/ui)
|
||||
│ ├── config/ # ESLint, TS, Tailwind presets (@repo/config)
|
||||
│ ├── types/ # Shared types (@repo/types)
|
||||
│ └── utils/ # Shared utilities (@repo/utils)
|
||||
├── turbo.json # "tasks" key (renamed from "pipeline" in v2)
|
||||
├── pnpm-workspace.yaml
|
||||
└── package.json # requires "packageManager" field
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts
|
||||
|
||||
| Concept | Description |
|
||||
|---------|-------------|
|
||||
| Workspaces | Globs declared in `pnpm-workspace.yaml` |
|
||||
| Pipeline | `turbo.json` `tasks` graph (NOT `pipeline` — renamed in v2) |
|
||||
| Caching | Remote/local task caching |
|
||||
| Dependencies | `workspace:*` protocol, `@repo/*` namespace |
|
||||
| Env mode | v2 is strict — declare task `env`/`globalEnv` or caching breaks |
|
||||
|
||||
---
|
||||
|
||||
## Turbo Tasks (turbo.json)
|
||||
|
||||
> `tasks` is the v2 key. The `pipeline` key was renamed — migrate with `npx @turbo/codemod rename-pipeline`.
|
||||
|
||||
| Task | Depends On |
|
||||
|------|------------|
|
||||
| build | ^build (dependencies first) |
|
||||
| dev | cache: false, persistent |
|
||||
| lint | ^build |
|
||||
| test | ^build |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Create root directory
|
||||
2. `pnpm init`
|
||||
3. Create pnpm-workspace.yaml
|
||||
4. Create turbo.json
|
||||
5. Add apps and packages
|
||||
6. `pnpm install`
|
||||
7. `pnpm dev`
|
||||
|
||||
---
|
||||
|
||||
## Common Commands
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `pnpm dev` | Run all apps |
|
||||
| `pnpm build` | Build all |
|
||||
| `pnpm --filter @name/web dev` | Run specific app |
|
||||
| `pnpm --filter @name/web add axios` | Add dep to app |
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Split `apps/` (deployable) from `packages/` (libraries, shared config)
|
||||
- Namespace internal packages with `@repo/*`; reference via `workspace:*`
|
||||
- Define entrypoints with the `exports` field (better tree-shaking than barrel files)
|
||||
- Share tsconfig/eslint from `packages/config`
|
||||
- Declare task `env`/`globalEnv` explicitly (v2 strict env mode)
|
||||
- Use Turbo remote caching for CI
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
name: nextjs-fullstack
|
||||
description: Next.js full-stack template principles. App Router, Prisma, Tailwind v4.
|
||||
---
|
||||
|
||||
# Next.js Full-Stack Template (2026 Edition)
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Version / Notes |
|
||||
|-----------|------------|-----------------|
|
||||
| Framework | Next.js | v16+ (App Router, Turbopack) |
|
||||
| Runtime | Node.js | v24 (Krypton LTS) |
|
||||
| Language | TypeScript | v5+ (Strict Mode) |
|
||||
| Database | PostgreSQL | Prisma ORM (Serverless friendly) |
|
||||
| Styling | Tailwind CSS | v4.0 (Zero-config, CSS-first) |
|
||||
| Auth | Auth.js v5 (`next-auth@beta`) / Clerk | Protected routes via `proxy.ts` |
|
||||
| UI Logic | React 19 | Server Actions, useActionState |
|
||||
| Validation | Zod | Schema validation (API & Forms) |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── prisma/
|
||||
│ └── schema.prisma # Database schema
|
||||
├── src/
|
||||
│ ├── app/
|
||||
│ │ ├── (auth)/ # Route groups for Login/Register
|
||||
│ │ ├── (dashboard)/ # Protected routes
|
||||
│ │ ├── api/ # Route Handlers (only for Webhooks/External integration)
|
||||
│ │ ├── layout.tsx # Root Layout (Metadata, Providers)
|
||||
│ │ ├── page.tsx # Landing Page
|
||||
│ │ └── globals.css # Tailwind v4 config (@theme) lives here
|
||||
│ ├── components/
|
||||
│ │ ├── ui/ # Reusable UI (Button, Input)
|
||||
│ │ └── forms/ # Client forms using useActionState
|
||||
│ ├── lib/
|
||||
│ │ ├── db.ts # Prisma singleton client
|
||||
│ │ ├── utils.ts # Helper functions
|
||||
│ │ └── dal.ts # Data Access Layer (Server-only)
|
||||
│ ├── actions/ # Server Actions (Mutations)
|
||||
│ └── types/ # Global TS Types
|
||||
├── public/
|
||||
├── DESIGN.md # Visual source-of-truth tokens & rationale (MANDATORY before UI)
|
||||
├── next.config.ts # TypeScript Config
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts (Updated)
|
||||
|
||||
| Concept | Description |
|
||||
|---------|-------------|
|
||||
| Server Components | Render on server (default). Direct DB access (Prisma) without APIs. |
|
||||
| Server Actions | Handle Form mutations. Replaces traditional API Routes. Use in action={}. |
|
||||
| React 19 Hooks | Form state management: useActionState, useFormStatus, useOptimistic. |
|
||||
| Data Access Layer | Data security. Separation of DB logic (DTOs) for safe reuse. |
|
||||
| Tailwind v4 | Styling engine. No tailwind.config.js. Config directly in CSS. |
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| DATABASE_URL | PostgreSQL connection string (Prisma) |
|
||||
| NEXT_PUBLIC_APP_URL | Public application URL |
|
||||
| AUTH_SECRET | Auth.js v5 session secret (default auth) |
|
||||
| NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Auth (if using Clerk instead) |
|
||||
| CLERK_SECRET_KEY | Clerk secret (server only, if using Clerk) |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Initialize Project:
|
||||
```bash
|
||||
npx create-next-app@latest my-app --typescript --tailwind --eslint
|
||||
# Select Yes for App Router
|
||||
# Select No for src directory (optional, this template uses src)
|
||||
```
|
||||
|
||||
2. Install DB & Validation:
|
||||
```bash
|
||||
npm install prisma @prisma/client zod
|
||||
npm install -D ts-node # For running seed scripts
|
||||
```
|
||||
|
||||
3. Configure Tailwind v4 (If missing):
|
||||
Ensure `src/app/globals.css` uses the new import syntax instead of a config file:
|
||||
```css
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
--color-primary: oklch(0.5 0.2 240);
|
||||
--font-sans: "Inter", sans-serif;
|
||||
}
|
||||
```
|
||||
|
||||
4. Initialize Database:
|
||||
```bash
|
||||
npx prisma init
|
||||
# Update schema.prisma
|
||||
npm run db:push
|
||||
```
|
||||
|
||||
5. Run Developer Server:
|
||||
```bash
|
||||
npm run dev --turbo
|
||||
# --turbo to enable faster Turbopack
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices (2026 Standards)
|
||||
|
||||
- **Fetch Data**: Call Prisma directly in Server Components (async/await). Do not use useEffect for initial data fetching.
|
||||
- **Mutations**: Use Server Actions combined with React 19's `useActionState` to handle loading and error states instead of manual useState.
|
||||
- **Type Safety**: Share Zod schemas between Server Actions (input validation) and Client Forms.
|
||||
- **Security**: Always validate input data with Zod before passing it to Prisma.
|
||||
- **Styling**: Use native CSS variables in Tailwind v4 for easier dynamic theming.
|
||||
125
.agents/skills/app-builder/templates/nextjs-saas/TEMPLATE.md
Normal file
125
.agents/skills/app-builder/templates/nextjs-saas/TEMPLATE.md
Normal file
@@ -0,0 +1,125 @@
|
||||
---
|
||||
name: nextjs-saas
|
||||
description: Next.js SaaS template principles (2026 Standards). React 19, Server Actions, Auth.js v5.
|
||||
---
|
||||
|
||||
# Next.js SaaS Template (Updated 2026)
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Version / Notes |
|
||||
|-----------|------------|-----------------|
|
||||
| Framework | Next.js | v16+ (App Router, React Compiler) |
|
||||
| Runtime | Node.js | v24 (Krypton LTS) |
|
||||
| Auth | Auth.js | v5 (`next-auth@beta`, formerly NextAuth). Alternative: Clerk |
|
||||
| Payments | Stripe API | Latest |
|
||||
| Database | PostgreSQL | Prisma v7+ (Serverless Driver) |
|
||||
| Email | Resend | React Email |
|
||||
| UI | Tailwind CSS | v4 (Oxide Engine, no config file) |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── prisma/
|
||||
│ └── schema.prisma # Database Schema
|
||||
├── src/
|
||||
│ ├── actions/ # NEW: Server Actions (Replaces API Routes for data mutation)
|
||||
│ │ ├── auth-actions.ts
|
||||
│ │ ├── billing-actions.ts
|
||||
│ │ └── user-actions.ts
|
||||
│ ├── app/
|
||||
│ │ ├── (auth)/ # Route Group: Login, register
|
||||
│ │ ├── (dashboard)/ # Route Group: Protected routes (App Layout)
|
||||
│ │ ├── (marketing)/ # Route Group: Landing, pricing (Marketing Layout)
|
||||
│ │ └── api/ # Only used for Webhooks or Edge cases
|
||||
│ │ └── webhooks/stripe/
|
||||
│ ├── components/
|
||||
│ │ ├── emails/ # React Email templates
|
||||
│ │ ├── forms/ # Client components using useActionState (React 19)
|
||||
│ │ └── ui/ # Shadcn UI
|
||||
│ ├── lib/
|
||||
│ │ ├── auth.ts # Auth.js v5 config
|
||||
│ │ ├── db.ts # Prisma Singleton
|
||||
│ │ ├── data/ # Data Access Layer (server-only reads)
|
||||
│ │ └── stripe.ts # Stripe Singleton
|
||||
│ └── app/globals.css # Tailwind v4 imports (@theme in CSS)
|
||||
├── DESIGN.md # Visual source-of-truth tokens & rationale (MANDATORY before UI)
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SaaS Features
|
||||
|
||||
| Feature | Implementation |
|
||||
|---------|---------------|
|
||||
| Auth | Auth.js v5 + Passkeys + OAuth |
|
||||
| Data Mutation | Server Actions (No API routes) |
|
||||
| Subscriptions | Stripe Checkout & Customer Portal |
|
||||
| Webhooks | Asynchronous Stripe event handling |
|
||||
| Email | Transactional via Resend |
|
||||
| Validation | Zod (Server-side validation) |
|
||||
|
||||
---
|
||||
|
||||
## Database Schema
|
||||
|
||||
| Model | Fields (Key fields) |
|
||||
|-------|---------------------|
|
||||
| User | id, email, stripeCustomerId, subscriptionId, plan |
|
||||
| Account | OAuth provider data (Google, GitHub...) |
|
||||
| Session | User sessions (Database strategy) |
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| DATABASE_URL | Prisma connection string (Postgres) |
|
||||
| AUTH_SECRET | Replaces NEXTAUTH_SECRET (Auth.js v5) |
|
||||
| STRIPE_SECRET_KEY | Payments (Server-side) |
|
||||
| STRIPE_WEBHOOK_SECRET | Webhook verification |
|
||||
| RESEND_API_KEY | Email sending |
|
||||
| NEXT_PUBLIC_APP_URL | Application Canonical URL |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Initialize project (Node 24):
|
||||
```bash
|
||||
npx create-next-app@latest {{name}} --typescript --eslint
|
||||
```
|
||||
|
||||
2. Install core libraries:
|
||||
```bash
|
||||
npm install next-auth@beta stripe resend @prisma/client
|
||||
```
|
||||
|
||||
3. Install Tailwind v4 (Add to globals.css):
|
||||
```css
|
||||
@import "tailwindcss";
|
||||
```
|
||||
|
||||
4. Configure environment (.env.local)
|
||||
|
||||
5. Sync Database:
|
||||
```bash
|
||||
npx prisma db push
|
||||
```
|
||||
|
||||
6. Run local Webhook:
|
||||
```bash
|
||||
npm run stripe:listen
|
||||
```
|
||||
|
||||
7. Run project:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
175
.agents/skills/app-builder/templates/nextjs-static/TEMPLATE.md
Normal file
175
.agents/skills/app-builder/templates/nextjs-static/TEMPLATE.md
Normal file
@@ -0,0 +1,175 @@
|
||||
---
|
||||
name: nextjs-static
|
||||
description: Modern template for Next.js 16, React 19 & Tailwind v4. Optimized for Landing pages and Portfolios.
|
||||
---
|
||||
|
||||
# Next.js Static Site Template (Modern Edition)
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Notes |
|
||||
|-----------|------------|-------|
|
||||
| Framework | Next.js 16+ | App Router, Turbopack, Static Exports |
|
||||
| Core | React 19 | Server Components, New Hooks, Compiler |
|
||||
| Language | TypeScript | Strict Mode |
|
||||
| Styling | Tailwind CSS v4 | CSS-first configuration (No js config), Oxide Engine |
|
||||
| Animations | Framer Motion | Layout animations & gestures |
|
||||
| Icons | Lucide React | Lightweight SVG icons |
|
||||
| SEO | Metadata API | Native Next.js API (Replaces next-seo) |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Streamlined structure thanks to Tailwind v4 (theme configuration lives inside CSS).
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── app/
|
||||
│ │ ├── layout.tsx # Contains root SEO Metadata
|
||||
│ │ ├── page.tsx # Landing Page
|
||||
│ │ ├── globals.css # Import Tailwind v4 & @theme config
|
||||
│ │ ├── not-found.tsx # Custom 404 page
|
||||
│ │ ├── sitemap.ts # Generated sitemap (Metadata convention)
|
||||
│ │ ├── robots.ts # Generated robots.txt (Metadata convention)
|
||||
│ │ ├── opengraph-image.tsx # Dynamic OG image
|
||||
│ │ └── (routes)/ # Route groups (about, contact...)
|
||||
│ ├── components/
|
||||
│ │ ├── layout/ # Header, Footer
|
||||
│ │ ├── sections/ # Hero, Features, Pricing, CTA
|
||||
│ │ └── ui/ # Atomic components (Button, Card)
|
||||
│ └── lib/
|
||||
│ └── utils.ts # Helper functions (cn, formatters)
|
||||
├── content/ # Markdown/MDX content
|
||||
├── public/ # Static assets (images, fonts)
|
||||
├── DESIGN.md # Visual source-of-truth tokens & rationale (MANDATORY before UI)
|
||||
├── next.config.ts # Next.js Config (TypeScript)
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Static Export Config
|
||||
|
||||
Using `next.config.ts` instead of `.js` for better type safety.
|
||||
|
||||
```typescript
|
||||
// next.config.ts
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: 'export', // Required for Static Hosting (S3, GitHub Pages)
|
||||
images: {
|
||||
unoptimized: true // Required if not using Node.js server image optimization
|
||||
},
|
||||
trailingSlash: true, // Recommended for SEO and fixing 404s on some hosts
|
||||
reactStrictMode: true,
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SEO Implementation (Metadata API)
|
||||
|
||||
Deprecated next-seo. Configure directly in layout.tsx or page.tsx.
|
||||
|
||||
```typescript
|
||||
// src/app/layout.tsx
|
||||
import type { Metadata } from 'next';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: {
|
||||
template: '%s | Product Name',
|
||||
default: 'Home - Product Name',
|
||||
},
|
||||
description: 'SEO optimized description for the landing page.',
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
locale: 'en_US',
|
||||
url: 'https://mysite.com',
|
||||
siteName: 'My Brand',
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Landing Page Sections
|
||||
|
||||
| Section | Purpose | Suggested Component |
|
||||
|---------|---------|---------------------|
|
||||
| Hero | First impression, H1 & Main CTA | `<HeroSection />` |
|
||||
| Features | Product benefits (Grid/Bento layout) | `<FeaturesGrid />` |
|
||||
| Social Proof | Partner logos, User numbers | `<LogoCloud />` |
|
||||
| Testimonials | Customer reviews | `<TestimonialCarousel />` |
|
||||
| Pricing | Service plans | `<PricingCards />` |
|
||||
| FAQ | Questions & Answers (Good for SEO) | `<Accordion />` |
|
||||
| CTA | Final conversion | `<CallToAction />` |
|
||||
|
||||
---
|
||||
|
||||
## Animation Patterns (Framer Motion)
|
||||
|
||||
| Pattern | Usage | Implementation |
|
||||
|---------|-------|----------------|
|
||||
| Fade Up | Headlines, paragraphs | `initial={{ opacity: 0, y: 20 }} animate={{ opacity: 1, y: 0 }}` |
|
||||
| Stagger | Lists of Features/Cards | Use variants with `staggerChildren` |
|
||||
| Parallax | Background images or floating elements | `useScroll` & `useTransform` |
|
||||
| Micro-interactions | Hover buttons, click effects | `whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}` |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Initialize Project:
|
||||
```bash
|
||||
npx create-next-app@latest my-site --typescript --tailwind --eslint
|
||||
# Select 'Yes' for App Router
|
||||
# Select 'No' for 'Would you like to customize the default import alias?'
|
||||
```
|
||||
|
||||
2. Install Auxiliary Libraries:
|
||||
```bash
|
||||
npm install framer-motion lucide-react clsx tailwind-merge
|
||||
# clsx and tailwind-merge help handle dynamic classes better
|
||||
```
|
||||
|
||||
3. Configure Tailwind v4 (in `src/app/globals.css`):
|
||||
```css
|
||||
@import "tailwindcss";
|
||||
|
||||
@theme {
|
||||
--color-primary: #3b82f6;
|
||||
--font-sans: 'Inter', sans-serif;
|
||||
}
|
||||
```
|
||||
|
||||
4. Development:
|
||||
```bash
|
||||
npm run dev --turbopack
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Deployment
|
||||
|
||||
| Platform | Method | Important Notes |
|
||||
|----------|--------|-----------------|
|
||||
| Vercel | Git Push | Auto-detects Next.js. Best for performance. |
|
||||
| GitHub Pages | GitHub Actions | Need to set `basePath` in `next.config.ts` if not using a custom domain. |
|
||||
| AWS S3 / CloudFront | Upload out folder | Ensure Error Document is configured to `404.html`. |
|
||||
| Netlify | Git Push | Set build command to `npm run build`. |
|
||||
|
||||
---
|
||||
|
||||
## Best Practices (Modern)
|
||||
|
||||
- **React Server Components (RSC)**: Default all components to Server Components. Only add `'use client'` when you need state (`useState`) or event listeners (`onClick`).
|
||||
- **Image Optimization**: Use the `<Image />` component but remember `unoptimized: true` for static export or use an external image CDN (Cloudinary/Imgix).
|
||||
- **Font Optimization**: Use `next/font` (Google Fonts) to automatically host fonts and prevent layout shift.
|
||||
- **Responsive**: Mobile-first design using Tailwind prefixes like `sm:`, `md:`, `lg:`.
|
||||
127
.agents/skills/app-builder/templates/nuxt-app/TEMPLATE.md
Normal file
127
.agents/skills/app-builder/templates/nuxt-app/TEMPLATE.md
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
name: nuxt-app
|
||||
description: Nuxt 4 full-stack template. Vue 3, Pinia, Tailwind v4, Prisma.
|
||||
---
|
||||
|
||||
# Nuxt 4 Full-Stack Template (2026 Edition)
|
||||
|
||||
> Modern full-stack template for Nuxt 4. Versions reflect the latest stable line verified 2026-05; pin to current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Version / Notes |
|
||||
|-----------|------------|-----------------|
|
||||
| Framework | Nuxt | v4+ (app/ srcDir structure) |
|
||||
| UI Engine | Vue | v3 (stable) |
|
||||
| Language | TypeScript | v5+ (Strict Mode) |
|
||||
| State | Pinia | v3+ (setup store syntax) |
|
||||
| Database | PostgreSQL | Prisma ORM |
|
||||
| Styling | Tailwind CSS | v4 (@tailwindcss/vite plugin) |
|
||||
| UI Lib | Nuxt UI | v3 (Tailwind v4 native) |
|
||||
| Validation | Zod | Schema validation |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure (Nuxt 4 Standard)
|
||||
|
||||
Nuxt 4 defaults `srcDir` to `app/`, keeping client code separate from `server/` and root config.
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── app/ # Application source (Nuxt 4 srcDir)
|
||||
│ ├── assets/css/
|
||||
│ │ └── main.css # Tailwind v4 import
|
||||
│ ├── components/ # Auto-imported components
|
||||
│ ├── composables/ # Auto-imported logic
|
||||
│ ├── layouts/
|
||||
│ ├── middleware/
|
||||
│ ├── pages/ # File-based routing
|
||||
│ ├── plugins/
|
||||
│ ├── stores/ # Pinia stores
|
||||
│ ├── app.vue # Root component
|
||||
│ └── app.config.ts # Reactive runtime config
|
||||
├── server/ # Nitro server engine
|
||||
│ ├── api/ # API routes (e.g. /api/users)
|
||||
│ ├── routes/ # Server routes
|
||||
│ └── utils/ # Server-only helpers (Prisma client)
|
||||
├── shared/ # Isomorphic code (types, Zod schemas)
|
||||
├── prisma/
|
||||
│ └── schema.prisma
|
||||
├── public/
|
||||
├── nuxt.config.ts
|
||||
└── package.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts (2026)
|
||||
|
||||
| Concept | Description |
|
||||
|---------|-------------|
|
||||
| **app/ srcDir** | Client code lives under `app/`, cleanly separated from `server/` and config |
|
||||
| **shared/** | Isomorphic code (types, Zod validators) usable in both Vue app and Nitro server |
|
||||
| **Server Engine** | Nitro-based; API routes in `server/api/`, Prisma client in `server/utils/` |
|
||||
| **Tailwind v4** | CSS-first config; theme lives in CSS via `@theme`, no `tailwind.config.js` |
|
||||
| **Vapor Mode** | Experimental no-VDOM renderer (not GA in 2026). Opt-in per component via `<script setup vapor>` when shipped |
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| DATABASE_URL | Prisma connection string (PostgreSQL) |
|
||||
| NUXT_PUBLIC_APP_URL | Canonical URL |
|
||||
| NUXT_SESSION_PASSWORD | Session encryption key |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. Initialize project:
|
||||
```bash
|
||||
npx nuxi@latest init my-app
|
||||
```
|
||||
|
||||
2. Install core deps:
|
||||
```bash
|
||||
npm install @pinia/nuxt @prisma/client zod
|
||||
npm install -D prisma
|
||||
```
|
||||
|
||||
3. Setup Tailwind v4 (first-party Vite plugin, NOT @nuxtjs/tailwindcss):
|
||||
```bash
|
||||
npm install tailwindcss @tailwindcss/vite
|
||||
```
|
||||
|
||||
Add to `nuxt.config.ts`:
|
||||
```ts
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
export default defineNuxtConfig({
|
||||
vite: { plugins: [tailwindcss()] },
|
||||
css: ['~/assets/css/main.css']
|
||||
})
|
||||
```
|
||||
|
||||
4. Configure CSS in `app/assets/css/main.css`:
|
||||
```css
|
||||
@import "tailwindcss";
|
||||
@theme {
|
||||
--color-primary: oklch(0.6 0.15 150);
|
||||
}
|
||||
```
|
||||
|
||||
5. Run development:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Data Fetching**: Use `useFetch`/`useAsyncData` for SSR-friendly data; reserve `server: false` for client-only work.
|
||||
- **State**: Use Pinia (`defineStore`) for global state, Nuxt's `useState` for simple shared SSR state.
|
||||
- **Validation**: Define Zod schemas in `shared/` and reuse on client forms and Nitro API routes.
|
||||
- **Type Safety**: API route types are inferred automatically with `$fetch`.
|
||||
- **Server-only**: Instantiate the Prisma client in `server/utils/` so it never leaks to the client bundle.
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
name: python-fastapi
|
||||
description: FastAPI REST API template principles. SQLAlchemy, Pydantic, Alembic.
|
||||
---
|
||||
|
||||
# FastAPI API Template
|
||||
|
||||
> Versions reflect the latest stable line verified 2026-05. Pin to the current stable when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology |
|
||||
|-----------|------------|
|
||||
| Framework | FastAPI |
|
||||
| Language | Python 3.12+ (current stable 3.14) |
|
||||
| ORM | SQLAlchemy 2.0 (async) |
|
||||
| Validation | Pydantic v2 |
|
||||
| Migrations | Alembic |
|
||||
| Auth | JWT + passlib |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
> Domain/module layout (scales better than file-type for non-trivial apps). Each domain owns its router, schemas, models, service.
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── alembic/ # Migrations
|
||||
├── src/
|
||||
│ ├── auth/
|
||||
│ │ ├── router.py # APIRouter
|
||||
│ │ ├── schemas.py # Pydantic models
|
||||
│ │ ├── models.py # SQLAlchemy models
|
||||
│ │ ├── service.py # Business logic
|
||||
│ │ ├── dependencies.py
|
||||
│ │ └── exceptions.py
|
||||
│ ├── posts/ # Same shape per domain
|
||||
│ ├── config.py # Global settings (BaseSettings)
|
||||
│ ├── database.py # Async engine / session
|
||||
│ ├── models.py # Shared base models
|
||||
│ ├── exceptions.py # Global exceptions
|
||||
│ └── main.py # FastAPI() + include_router
|
||||
├── tests/
|
||||
├── requirements/ # base.txt / dev.txt / prod.txt
|
||||
├── alembic.ini
|
||||
└── .env
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Concepts
|
||||
|
||||
| Concept | Description |
|
||||
|---------|-------------|
|
||||
| Domain modules | Each feature folder owns router + schemas + models + service |
|
||||
| Async | async/await throughout (AsyncSession, async_sessionmaker) |
|
||||
| Dependency Injection | FastAPI Depends (validation, auth, DB session) |
|
||||
| Pydantic v2 | Validation + serialization |
|
||||
| SQLAlchemy 2.0 | Async sessions |
|
||||
|
||||
---
|
||||
|
||||
## API Structure
|
||||
|
||||
| Layer | Responsibility |
|
||||
|-------|---------------|
|
||||
| Routers | HTTP handling |
|
||||
| Dependencies | Auth, validation |
|
||||
| Services | Business logic |
|
||||
| Models | Database entities |
|
||||
| Schemas | Request/response |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps
|
||||
|
||||
1. `python -m venv venv`
|
||||
2. `source venv/bin/activate`
|
||||
3. `pip install fastapi uvicorn "sqlalchemy[asyncio]" alembic pydantic pydantic-settings`
|
||||
4. Create `.env`
|
||||
5. `alembic upgrade head`
|
||||
6. `uvicorn src.main:app --reload`
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Use async everywhere (AsyncSession, async dependencies; wrap sync SDKs in `run_in_threadpool`)
|
||||
- Per-module `BaseSettings` over one global config
|
||||
- Pydantic v2 for validation
|
||||
- SQLAlchemy 2.0 async sessions
|
||||
- Alembic migrations: static, reversible, descriptive slugs
|
||||
- pytest-asyncio for tests; use `dependency_overrides` to mock
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
name: react-native-app
|
||||
description: React Native mobile app template principles. Expo, TypeScript, navigation.
|
||||
---
|
||||
|
||||
# React Native App Template (2026 Edition)
|
||||
|
||||
> Modern mobile app, optimized for New Architecture and React 19. Versions reflect the latest stable line verified 2026-05; NativeWind v5 is pre-release — pin deliberately when scaffolding.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
| Component | Technology | Version / Notes |
|
||||
|-----------|------------|-----------------|
|
||||
| Core | React Native + Expo | SDK 56+ (New Architecture Enabled) |
|
||||
| Language | TypeScript | v5+ (Strict Mode) |
|
||||
| UI Logic | React | v19 (React Compiler, auto-memoization) |
|
||||
| Navigation | Expo Router | File-based, Universal Links |
|
||||
| Styling | NativeWind | v5 (pre-release, Tailwind v4 CSS-first) |
|
||||
| State | Zustand + React Query | v5+ (Async State Management) |
|
||||
| Storage | Expo SecureStore | Encrypted local storage |
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
Expo Router keeps `app/` for routes only; everything else lives under `src/` with the `@/*` alias.
|
||||
|
||||
```
|
||||
project-name/
|
||||
├── src/
|
||||
│ ├── app/ # Expo Router (file-based routing ONLY)
|
||||
│ │ ├── _layout.tsx # Root Layout (Stack/Tabs config)
|
||||
│ │ ├── index.tsx # Main Screen
|
||||
│ │ ├── (tabs)/ # Route Group for Tab Bar
|
||||
│ │ │ ├── _layout.tsx
|
||||
│ │ │ ├── home.tsx
|
||||
│ │ │ └── profile.tsx
|
||||
│ │ ├── +not-found.tsx
|
||||
│ │ └── [id].tsx # Dynamic Route (Typed)
|
||||
│ ├── components/
|
||||
│ │ ├── ui/ # Primitive Components (Button, Text)
|
||||
│ │ └── features/ # Complex Components
|
||||
│ ├── hooks/ # Custom Hooks
|
||||
│ ├── lib/
|
||||
│ │ ├── api.ts # Axios/Fetch client
|
||||
│ │ └── storage.ts # SecureStore wrapper
|
||||
│ ├── store/ # Zustand stores
|
||||
│ └── constants/ # Colors, Theme config
|
||||
├── assets/ # Fonts, Images
|
||||
├── global.css # NativeWind v5 entry: @import "tailwindcss"
|
||||
├── babel.config.js # NativeWind Babel preset
|
||||
├── metro.config.js # withNativeWind wrapper
|
||||
└── app.json # Expo Config
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Navigation Patterns (Expo Router)
|
||||
|
||||
| Pattern | Description | Implement |
|
||||
|---------|-------------|-----------|
|
||||
| Stack | Hierarchical navigation (Push/Pop) | `<Stack />` in `_layout.tsx` |
|
||||
| Tabs | Bottom navigation bar | `<Tabs />` in `(tabs)/_layout.tsx` |
|
||||
| Drawer | Side slide-out menu | `expo-router/drawer` |
|
||||
| Modals | Overlay screens | `presentation: 'modal'` in Stack screen |
|
||||
|
||||
---
|
||||
|
||||
## Key Packages & Purpose
|
||||
|
||||
| Package | Purpose |
|
||||
|---------|---------|
|
||||
| expo-router | File-based routing (Next.js like) |
|
||||
| nativewind | Use Tailwind CSS classes in React Native |
|
||||
| react-native-reanimated | Smooth animations (runs on UI thread) |
|
||||
| @tanstack/react-query | Server state management, caching, pre-fetching |
|
||||
| zustand | Global state management (lighter than Redux) |
|
||||
| expo-image | Optimized image rendering for performance |
|
||||
|
||||
---
|
||||
|
||||
## Setup Steps (2026 Standard)
|
||||
|
||||
1. Initialize Project:
|
||||
```bash
|
||||
npx create-expo-app@latest my-app --template default
|
||||
cd my-app
|
||||
```
|
||||
|
||||
2. Install Core Dependencies:
|
||||
```bash
|
||||
npx expo install expo-router react-native-safe-area-context react-native-screens expo-link expo-constants expo-status-bar
|
||||
```
|
||||
|
||||
3. Install NativeWind v5 (pre-release, Tailwind v4 CSS-first):
|
||||
```bash
|
||||
npm install nativewind@next tailwindcss react-native-reanimated
|
||||
```
|
||||
|
||||
4. Configure NativeWind (Babel, Metro & CSS):
|
||||
- Add the preset to `babel.config.js`: `presets: [["babel-preset-expo", { jsxImportSource: "nativewind" }], "nativewind/babel"]`.
|
||||
- Wrap Metro: `withNativeWind(config, { input: './global.css' })` in `metro.config.js`.
|
||||
- Create `global.css` with `@import "tailwindcss";` (theme via `@theme`, no `tailwind.config.js`).
|
||||
- Import `global.css` in `src/app/_layout.tsx`.
|
||||
|
||||
5. Run Project:
|
||||
```bash
|
||||
npx expo start -c
|
||||
# Press 'i' for iOS simulator or 'a' for Android emulator
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices (Updated)
|
||||
|
||||
- **New Architecture**: Ensure `newArchEnabled: true` in `app.json` to leverage TurboModules and Fabric Renderer.
|
||||
- **Typed Routes**: Use Expo Router's "Typed Routes" feature for type-safe routing (e.g., `router.push('/path')`).
|
||||
- **React 19**: Reduce usage of `useMemo` or `useCallback` thanks to React Compiler (if enabled).
|
||||
- **Components**: Build UI primitives (Box, Text) with NativeWind className for reusability.
|
||||
- **Assets**: Use `expo-image` instead of default `<Image />` for better caching and performance.
|
||||
- **API**: Always wrap API calls with TanStack Query, avoid direct calls in `useEffect`.
|
||||
Reference in New Issue
Block a user