metabinaries 1.3.3

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.
@@ -0,0 +1,275 @@
1
+ export const miscTemplates = {
2
+ 'docs/EXPLAIN_METABINARIES_FILE_STRUCTURE.md': `# MetaBinaries: Advanced CRM Architecture Guide
3
+
4
+ This project is built using the **MetaBinaries Feature-Based Internal Architecture**. It is designed for maximum scalability, maintainability, and enterprise-grade performance.
5
+
6
+ ## ๐Ÿ—๏ธ Core Philosophy
7
+
8
+ The structure follows a **Feature-Driven Development (FDD)** approach. Instead of grouping files by type (e.g., all slices in one folder), we group them by **Domain/Feature**. This minimizes "folder jumping" and keeps related logic together.
9
+
10
+ ---
11
+
12
+ ## ๐Ÿ“ Detailed File Structure Explained
13
+
14
+ ### ๐ŸŒ Application Root (\`app/[locale]\`)
15
+ Next.js 15 App Router with dynamic locale segments.
16
+ - **\`layout.tsx\`**: The global entry point. Handles fonts, base providers, and internationalization context.
17
+ - **\`globals.css\`**: Tailwind CSS base styles and design system variables (HSL).
18
+ - **\`(auth)/\`**: Grouped routes for authentication.
19
+ - \`login/\`, \`sign-up/\`, \`forgot-password/\`: Stateless pages for user entry.
20
+ - **\`(workspace)/\`**: The internal CRM area (Protected).
21
+ - \`layout.tsx\`: Wraps the entire CRM with the \`AdminLayout\`.
22
+ - \`_Components/\`: **Flat structure** for layout-specific components (Sidebar, Header, Search).
23
+ - \`page.tsx\`: The main Dashboard page.
24
+
25
+ ### ๐Ÿงช Business Logic (\`lib/features/NAME\`)
26
+ This is where the "Brain" of your feature lives. For every new feature (e.g., "leads"), you should create:
27
+ - **\`NAME.api.ts\`**: Defines API endpoints using Axios.
28
+ - **\`NAME.service.ts\`**: Data transformation and business logic (Layer between API and State).
29
+ - **\`NAME.slice.ts\`**: Redux Toolkit slice for state management.
30
+ - **\`NAME.types.ts\`**: TypeScript interfaces/types specific to this feature.
31
+ - **\`NAME.utils.ts\`**: Helper functions used only within this feature.
32
+ - **\`useNAME.ts\`**: A custom React hook for easy access to state and actions from components.
33
+
34
+ ### โš™๏ธ Shared Logic (\`lib/shared\`)
35
+ - **\`axios.ts\`**: Pre-configured Axios instance with base URL and interceptors.
36
+ - **\`store.ts\`**: Centralized Redux store configuration.
37
+ - **\`utils/validation/\`**: Zod schemas for forms and API validation.
38
+ - \`common-rules.ts\`: Reusable rules (Email, Password strength).
39
+ - \`NAME.validation.ts\`: Feature-specific form schemas.
40
+
41
+ ### ๐Ÿฑ UI Components (\`components/\`)
42
+ - **\`ui/\`**: Atomic components (Buttons, Inputs, Dialogs) from Shadcn UI. **Do not put business logic here.**
43
+ - **\`shared/\`**: Reusable higher-order components (Table wrappers, Confirmation dialogs).
44
+ - **\`layout/\`**: App-wide structural logic (AuthGuard, LanguageSwitcher, Providers).
45
+
46
+ ### ๐ŸŒ Internationalization (\`i18n/\`)
47
+ - **\`routing.ts\`**: Configuration for supported locales (\`en\`, \`ar\`) and default locale.
48
+ - **\`navigation.ts\`**: Type-safe navigation wrappers (\`Link\`, \`useRouter\`, \`usePathname\`).
49
+ - **\`request.ts\`**: Server-side logic to load the correct JSON messages.
50
+
51
+ ---
52
+
53
+ ## ๐Ÿ› ๏ธ Usage Guides
54
+
55
+ ### How to add a new Locale?
56
+ 1. Open \`i18n/routing.ts\` and add the locale code to \`locales\`.
57
+ 2. Create a new JSON file in \`messages/[code].json\`.
58
+ 3. Update the matching in \`middleware.ts\`.
59
+
60
+ ### How to create a new Feature?
61
+ 1. Create a folder in \`lib/features/[featureName]\`.
62
+ 2. Add the 6 core files (api, service, slice, types, utils, hook).
63
+ 3. Register the new \`slice\` in \`lib/shared/store.ts\`.
64
+ 4. Create the UI for it in \`app/[locale]/(workspace)/[featureName]\`.
65
+
66
+ ---
67
+
68
+ ## ๐Ÿ›ก๏ธ Security & Quality
69
+ - **Rate Limiting**: Use \`rateLimitMiddleware\` in \`middleware.ts\` for sensitive routes.
70
+ - **Husky**: Automated checks ensure you never commit broken types or bad formatting.
71
+ - **Conventional Commits**: Keeps a clean version history for easier debugging.
72
+
73
+ ---
74
+ *Created by MetaBinaries CLI - Professional Next.js Scaffolding*`,
75
+
76
+ 'README.md': projectName => `# ${projectName}
77
+
78
+ Built with [MetaBinaries](https://metabinaries.com) - The advanced CLI for CRM-style Next.js applications.
79
+
80
+ ## ๐Ÿš€ Features
81
+
82
+ - **Next.js 15 (App Router)** - High-performance web architecture.
83
+ - **Internationalization (i18n)** - Full support for English (LTR) and Arabic (RTL) using \`next-intl\`.
84
+ - **Feature-Based Architecture** - Scalable organization under \`lib/features/\`.
85
+ - **State Management** - Centralized store using **Redux Toolkit**.
86
+ - **Modern UI System** - Powered by **Tailwind CSS**, **Shadcn UI**, and **Radix UI**.
87
+ - **Developer Experience**:
88
+ - **Husky Hooks**: Automated pre-commit checks (Type-checking & Formatting).
89
+ - **Conventional Commits**: Standardized commit history.
90
+ - **Turbopack Build**: Optimized development and build speeds.
91
+ - **Security & Utilities**:
92
+ - **Rate Limiting**: Built-in request limiting for protected routes.
93
+ - **Axios Configuration**: Centralized API client with interceptors.
94
+ - **Zod Validation**: Robust schema validation for forms and APIs.
95
+
96
+ ## ๐Ÿ› ๏ธ Tech Stack
97
+
98
+ - **Framework**: Next.js 15
99
+ - **Styling**: Tailwind CSS
100
+ - **State**: Redux Toolkit
101
+ - **Internationalization**: next-intl
102
+ - **Forms**: React Hook Form + Zod
103
+ - **Icons**: Lucide React
104
+ - **Notifications**: Sonner
105
+ - **Notifications**: next-themes
106
+
107
+ ## ๐Ÿ“ Project Structure
108
+
109
+ \`\`\`
110
+ โ”œโ”€ app/[locale] # Root of the application (i18n)
111
+ โ”‚ โ”œโ”€ (auth) # Authentication routes (Login, SignUp)
112
+ โ”‚ โ””โ”€ (workspace) # Protected CRM workspace routes
113
+ โ”œโ”€ components/
114
+ โ”‚ โ”œโ”€ ui/ # Shadcn UI base components
115
+ โ”‚ โ”œโ”€ shared/ # Reusable common components
116
+ โ”‚ โ””โ”€ layout/ # AuthGuards, ThemeProviders, etc.
117
+ โ”œโ”€ lib/
118
+ โ”‚ โ”œโ”€ features/ # Business logic grouped by feature
119
+ โ”‚ โ”œโ”€ shared/ # Centralized Axios, Redux Store
120
+ โ”‚ โ””โ”€ utils/ # Common helper functions
121
+ โ”œโ”€ i18n/ # Translation routing and configurations
122
+ โ””โ”€ messages/ # JSON translation files (en/ar)
123
+ \`\`\`
124
+
125
+ ## ๐Ÿ Getting Started
126
+
127
+ ### 1. Installation
128
+ \`\`\`bash
129
+ npm install
130
+ \`\`\`
131
+
132
+ ### 2. Run Locally
133
+ \`\`\`bash
134
+ npm run dev
135
+ \`\`\`
136
+
137
+ ### 3. Build & Production
138
+ \`\`\`bash
139
+ npm run build
140
+ \`\`\`
141
+
142
+ ### ๐Ÿ“ Scripts
143
+
144
+ - \`npm run dev\`: Start the development server.
145
+ - \`npm run build\`: Clean build, format check, and Next.js build.
146
+ - \`npm run format\`: Format entire codebase with Prettier.
147
+ - \`npm run type-check\`: Run TypeScript compiler checks.
148
+
149
+ ## ๐Ÿค Contributing
150
+
151
+ This project follows **Conventional Commits**. Please make sure your commit messages match the required format:
152
+ \`type(scope): subject\` (e.g., \`feat(auth): add google sign-in\`).
153
+
154
+ ---
155
+ Generated by **MetaBinaries CLI**`,
156
+
157
+ '.husky/pre-commit': `echo "๐Ÿ” Running pre-commit checks..."
158
+ echo ""
159
+
160
+ # Step 1: Run type check first (fail fast if there are type errors)
161
+ echo "๐Ÿ”Ž Running TypeScript type check..."
162
+ if ! npm run type-check; then
163
+ echo ""
164
+ echo "โŒ Type check failed! Please fix type errors before committing."
165
+ echo ""
166
+ echo "To commit anyway (not recommended), use:"
167
+ echo " git commit --no-verify"
168
+ echo ""
169
+ exit 1
170
+ fi
171
+ echo "โœ… Type check passed!"
172
+ echo ""
173
+
174
+ # Step 2: Format code after type check passes
175
+ echo "๐Ÿ“ Formatting code with Prettier..."
176
+ if ! npm run format; then
177
+ echo ""
178
+ echo "โŒ Formatting failed! Please fix formatting issues."
179
+ echo ""
180
+ exit 1
181
+ fi
182
+ echo "โœ… Code formatted successfully!"
183
+ echo ""
184
+
185
+ echo "โœ… All pre-commit checks passed! Proceeding with commit..."`,
186
+
187
+ '.husky/commit-msg': `# Validates commit message format
188
+
189
+ # Conventional commit format: type(scope): subject
190
+ # Note: Added optional ! for breaking changes (e.g., feat!: or fix!:)
191
+ commit_regex='^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert|hotfix|release)(!)?(\\(.+\\))?: .{1,}'
192
+
193
+ if ! grep -qE "$commit_regex" "$1"; then
194
+ echo "โŒ Invalid commit message format!"
195
+ echo ""
196
+ echo "Commit message must follow conventional commit format:"
197
+ echo " type(scope): subject"
198
+ echo " or type!: subject (for breaking changes)"
199
+ echo ""
200
+ echo "Types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert, hotfix, release"
201
+ echo ""
202
+ echo "Examples:"
203
+ echo " feat: add user authentication"
204
+ echo " fix(api): resolve login bug"
205
+ echo " feat!: change API response format (breaking change)"
206
+ echo " docs: update README"
207
+ echo ""
208
+ exit 1
209
+ fi
210
+
211
+ echo "โœ… Commit message format is valid!"`,
212
+
213
+ '.husky/pre-push': `echo "\ud83d\ude80 Running pre-push checks..."
214
+ echo ""
215
+
216
+ # Get current branch
217
+ current_branch=$(git rev-parse --abbrev-ref HEAD)
218
+
219
+ # Protect main/master branches from direct pushes
220
+ protected_branches="^(main|master|production)$"
221
+ if echo "$current_branch" | grep -qE "$protected_branches"; then
222
+ echo "โŒ Direct pushes to $current_branch are not allowed!"
223
+ echo ""
224
+ echo "Please create a feature branch and open a pull request:"
225
+ echo " git checkout -b feature/your-feature-name"
226
+ echo " git push origin feature/your-feature-name"
227
+ echo ""
228
+ echo "Or if you really need to push directly, use:"
229
+ echo " git push --no-verify"
230
+ echo ""
231
+ exit 1
232
+ fi
233
+
234
+ # Run tests if test script exists
235
+ if npm run --silent 2>&1 | grep -q "\\"test\\""; then
236
+ echo "๐Ÿงช Running tests..."
237
+ if ! npm test; then
238
+ echo ""
239
+ echo "โŒ Tests failed! Please fix failing tests before pushing."
240
+ echo ""
241
+ echo "To push anyway (not recommended), use:"
242
+ echo " git push --no-verify"
243
+ echo ""
244
+ exit 1
245
+ fi
246
+ echo "โœ… All tests passed!"
247
+ echo ""
248
+ fi
249
+
250
+ echo "โœ… All pre-push checks passed! Proceeding with push..."`,
251
+
252
+ '.husky/prepare-commit-msg': `# Add branch name to commit message automatically
253
+ COMMIT_MSG_FILE=$1
254
+ COMMIT_SOURCE=$2
255
+
256
+ # Only add branch name for regular commits (not merge, squash, etc.)
257
+ if [ -z "$COMMIT_SOURCE" ]; then
258
+ BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
259
+
260
+ # Skip if on main/master or if branch name already in message
261
+ if ! echo "$BRANCH_NAME" | grep -qE "^(main|master|HEAD)$"; then
262
+ COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
263
+
264
+ # Only add if not already present
265
+ if ! echo "$COMMIT_MSG" | grep -q "$BRANCH_NAME"; then
266
+ # Extract ticket number from branch name (e.g., feature/PROJ-123-description -> PROJ-123)
267
+ TICKET=$(echo "$BRANCH_NAME" | grep -oE "[A-Z]+-[0-9]+" | head -1)
268
+
269
+ if [ -n "$TICKET" ]; then
270
+ echo "$COMMIT_MSG" | sed "1s/$/ [$TICKET]/" > "$COMMIT_MSG_FILE"
271
+ fi
272
+ fi
273
+ fi
274
+ fi`,
275
+ };
@@ -0,0 +1,74 @@
1
+ // Clean packages - Frontend only, no backend/auth dependencies
2
+ export const dependencies = {
3
+ // Next.js Core
4
+ 'next': '^15.1.4',
5
+ 'react': '^19.0.0',
6
+ 'react-dom': '^19.0.0',
7
+
8
+ // i18n
9
+ 'next-intl': '^3.26.3',
10
+
11
+ // UI & Styling
12
+ 'tailwindcss': '^4.1.0',
13
+ 'tailwindcss-animate': '^1.0.7',
14
+ '@tailwindcss/postcss': '^4.1.0',
15
+
16
+ // UI Components
17
+ 'class-variance-authority': '^0.7.1',
18
+ 'clsx': '^2.1.1',
19
+ 'tailwind-merge': '^2.6.0',
20
+ 'lucide-react': '^0.468.0',
21
+ 'input-otp': '^1.4.2',
22
+
23
+ // Radix UI Components (shadcn/ui)
24
+ '@radix-ui/react-alert-dialog': '^1.1.4',
25
+ '@radix-ui/react-avatar': '^1.1.2',
26
+ '@radix-ui/react-checkbox': '^1.1.3',
27
+ '@radix-ui/react-collapsible': '^1.1.2',
28
+ '@radix-ui/react-dropdown-menu': '^2.1.4',
29
+ '@radix-ui/react-label': '^2.1.1',
30
+ '@radix-ui/react-popover': '^1.1.4',
31
+ '@radix-ui/react-scroll-area': '^1.2.2',
32
+ '@radix-ui/react-separator': '^1.1.1',
33
+ '@radix-ui/react-slot': '^1.1.1',
34
+ '@radix-ui/react-switch': '^1.1.2',
35
+ '@radix-ui/react-toast': '^1.2.4',
36
+ '@radix-ui/react-tooltip': '^1.1.7',
37
+ '@radix-ui/react-navigation-menu': '^1.2.3',
38
+ '@radix-ui/react-dialog': '^1.1.4',
39
+
40
+ // Theming
41
+ 'next-themes': '^0.4.4',
42
+
43
+ // Animations
44
+ 'framer-motion': '^11.18.0',
45
+
46
+ // Notifications
47
+ 'sonner': '^1.7.3',
48
+
49
+ // State Management & Data Fetching
50
+ '@reduxjs/toolkit': '^2.11.2',
51
+ 'react-redux': '^9.2.0',
52
+ '@tanstack/react-query': '^5.90.12',
53
+ 'axios': '^1.13.2',
54
+ 'socket.io-client': '^4.8.3',
55
+ };
56
+
57
+ export const devDependencies = {
58
+ // TypeScript
59
+ 'typescript': '^5.7.3',
60
+ '@types/node': '^22.10.5',
61
+ '@types/react': '^19.0.7',
62
+ '@types/react-dom': '^19.0.3',
63
+
64
+ // Linting
65
+ 'eslint': '^9.18.0',
66
+ 'eslint-config-next': '^15.1.4',
67
+
68
+ // Git Hooks
69
+ 'husky': '^9.1.7',
70
+
71
+ // PostCSS
72
+ 'postcss': '^8.4.49',
73
+ };
74
+