Skip to content

Commit 71abfa8

Browse files
Agent AItecnomanu
authored andcommitted
feat: ✨ complete stack documentation with missing core files
Major documentation completion addressing gaps from deleted branch: ## New Files Added (10 files): - templates/stacks/nextjs/base/styling.md - Comprehensive Next.js styling guide - templates/stacks/nextjs/base/state-management.md - Next.js state management patterns - templates/stacks/react/base/state-management.md - React state management approaches - templates/stacks/laravel/base/styling.md - Laravel frontend styling integration - templates/stacks/laravel/base/state-management.md - Laravel state management concepts - templates/stacks/nuxt/base/styling.md - Nuxt styling features and frameworks - templates/stacks/nuxt/base/state-management.md - Nuxt universal state management - templates/stacks/sveltekit/base/styling.md - SvelteKit styling approaches - templates/stacks/sveltekit/base/state-management.md - SvelteKit reactive state - templates/stacks/nodejs/base/state-management.md - Node.js server-side state ## File Naming Fixes (4 files): - Fix typo: vue/base/bes-practices.md → best-practices.md - Standardize: go/base/best_practices.md → best-practices.md - Standardize: go/base/testing_best_practices.md → testing-best-practices.md - Standardize: react-native/base/best_practices.md → best-practices.md ## Impact: - Stacks marked 95-100% now have complete documentation - Consistent file naming across all stacks - Comprehensive coverage of styling and state management - Addresses missing content from previously deleted documentation branch
1 parent d2bacb6 commit 71abfa8

File tree

15 files changed

+2285
-18
lines changed

15 files changed

+2285
-18
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,24 +235,24 @@ MCP tools rules work alongside your stack-specific rules:
235235

236236
<p align="center">
237237

238-
| Stack | Status | Features |
239-
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
240-
| <img src="https://img.shields.io/badge/MCP%20Tools-FF6600?style=for-the-badge&logo=tools&logoColor=white" alt="MCP Tools" width="100"/> | ![100%](https://progress-bar.xyz/100) | **Since v2.0**: Multi-select MCP tools (PAMPA, GitHub, Memory, Filesystem, Git), usage patterns, security guidelines, workflows |
241-
| <img src="https://img.shields.io/badge/MCP-0066CC?style=for-the-badge&logo=protocol&logoColor=white" alt="MCP" width="100"/> | ![100%](https://progress-bar.xyz/100) | Complete SDK coverage (Python, TypeScript, Java, Kotlin, C#, Swift), server/client patterns, architecture concepts |
242-
| <img src="https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white" alt="Laravel" width="100"/> | ![100%](https://progress-bar.xyz/100) | Multiple architectures, version detection, casting rules |
243-
| <img src="https://img.shields.io/badge/Nuxt-00DC82?style=for-the-badge&logo=nuxt.js&logoColor=white" alt="Nuxt" width="100"/> | ![100%](https://progress-bar.xyz/100) | Testing guidelines, architectural patterns, version-specific docs |
244-
| <img src="https://img.shields.io/badge/Pampa-FF6B35?style=for-the-badge&logo=search&logoColor=white" alt="Pampa" width="100"/> | ![100%](https://progress-bar.xyz/100) | Semantic code search, AI agent integration, MCP support, multi-language indexing |
245-
| <img src="https://img.shields.io/badge/React-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="React" width="100"/> | ![95%](https://progress-bar.xyz/95) | Architecture options, state management, testing guidelines, version-specific guidance (v18 concurrent features) |
246-
| <img src="https://img.shields.io/badge/React%20Native-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="React Native" width="100"/> | ![25%](https://progress-bar.xyz/25) | Base rules (architecture, best practices, styling, naming, navigation, platform code, state, testing, version info) |
247-
| <img src="https://img.shields.io/badge/Next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white" alt="Next.js" width="100"/> | ![95%](https://progress-bar.xyz/95) | App & Pages router support, version detection, testing docs, version-specific guidance (v13 API routes, v14 Server Components) |
248-
| <img src="https://img.shields.io/badge/Svelte-FF3E00?style=for-the-badge&logo=svelte&logoColor=white" alt="Svelte" width="100"/> | ![70%](https://progress-bar.xyz/70) | Component organization, runes (v5), lifecycle, state management |
249-
| <img src="https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white" alt="Go" width="100"/> | ![75%](https://progress-bar.xyz/75) | Multiple architectures, project structure, error handling patterns |
250-
| <img src="https://img.shields.io/badge/SvelteKit-FF3E00?style=for-the-badge&logo=svelte&logoColor=white" alt="SvelteKit" width="100"/> | ![70%](https://progress-bar.xyz/70) | Routing system, layouts, SSR/CSR strategies, form actions |
251-
| <img src="https://img.shields.io/badge/Astro-0D0D0D?style=for-the-badge&logo=astro&logoColor=white" alt="Astro" width="100"/> | ![60%](https://progress-bar.xyz/60) | Content collections, static/dynamic content, integration guides |
252-
| <img src="https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white" alt="Angular" width="100"/> | ![55%](https://progress-bar.xyz/55) | Signals support, base project structure |
253-
| <img src="https://img.shields.io/badge/NestJS-E0234E?style=for-the-badge&logo=nestjs&logoColor=white" alt="NestJS" width="100"/> | ![75%](https://progress-bar.xyz/75) | Standard and Microservices architectures, NestJS 9.x and 10.x features |
254-
| <img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js" width="100"/> | ![20%](https://progress-bar.xyz/20) | Base project structure, best practices, naming, testing |
255-
| <img src="https://img.shields.io/badge/Vue-4FC08D?style=for-the-badge&logo=vue.js&logoColor=white" alt="Vue" width="100"/> | ![45%](https://progress-bar.xyz/45) | Testing guidelines, architecture concepts |
238+
| Stack | Status | Features |
239+
| --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
240+
| <img src="https://img.shields.io/badge/MCP%20Tools-FF6600?style=for-the-badge&logo=tools&logoColor=white" alt="MCP Tools" width="100"/> | ![100%](https://progress-bar.xyz/100) | **Since v2.0**: Multi-select MCP tools (PAMPA, GitHub, Memory, Filesystem, Git), usage patterns, security guidelines, workflows |
241+
| <img src="https://img.shields.io/badge/MCP-0066CC?style=for-the-badge&logo=protocol&logoColor=white" alt="MCP" width="100"/> | ![100%](https://progress-bar.xyz/100) | Complete SDK coverage (Python, TypeScript, Java, Kotlin, C#, Swift), server/client patterns, architecture concepts |
242+
| <img src="https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white" alt="Laravel" width="100"/> | ![100%](https://progress-bar.xyz/100) | Multiple architectures, version detection, casting rules |
243+
| <img src="https://img.shields.io/badge/Nuxt-00DC82?style=for-the-badge&logo=nuxt.js&logoColor=white" alt="Nuxt" width="100"/> | ![100%](https://progress-bar.xyz/100) | Testing guidelines, architectural patterns, version-specific docs |
244+
| <img src="https://img.shields.io/badge/Pampa-FF6B35?style=for-the-badge&logo=search&logoColor=white" alt="Pampa" width="100"/> | ![100%](https://progress-bar.xyz/100) | Semantic code search, AI agent integration, MCP support, multi-language indexing |
245+
| <img src="https://img.shields.io/badge/React-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="React" width="100"/> | ![95%](https://progress-bar.xyz/95) | Architecture options, state management, testing guidelines, version-specific guidance (v18 concurrent features) |
246+
| <img src="https://img.shields.io/badge/React%20Native-61DAFB?style=for-the-badge&logo=react&logoColor=black" alt="React Native" width="100"/> | ![25%](https://progress-bar.xyz/25) | Base rules (architecture, best practices, styling, naming, navigation, platform code, state, testing, version info) |
247+
| <img src="https://img.shields.io/badge/Next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white" alt="Next.js" width="100"/> | ![95%](https://progress-bar.xyz/95) | App & Pages router support, version detection, testing docs, version-specific guidance (v13 API routes, v14 Server Components) |
248+
| <img src="https://img.shields.io/badge/Svelte-FF3E00?style=for-the-badge&logo=svelte&logoColor=white" alt="Svelte" width="100"/> | ![70%](https://progress-bar.xyz/70) | Component organization, runes (v5), lifecycle, state management |
249+
| <img src="https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white" alt="Go" width="100"/> | ![75%](https://progress-bar.xyz/75) | Multiple architectures, project structure, error handling patterns |
250+
| <img src="https://img.shields.io/badge/SvelteKit-FF3E00?style=for-the-badge&logo=svelte&logoColor=white" alt="SvelteKit" width="100"/> | ![70%](https://progress-bar.xyz/70) | Routing system, layouts, SSR/CSR strategies, form actions |
251+
| <img src="https://img.shields.io/badge/Astro-0D0D0D?style=for-the-badge&logo=astro&logoColor=white" alt="Astro" width="100"/> | ![60%](https://progress-bar.xyz/60) | Content collections, static/dynamic content, integration guides |
252+
| <img src="https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white" alt="Angular" width="100"/> | ![55%](https://progress-bar.xyz/55) | Signals support, base project structure |
253+
| <img src="https://img.shields.io/badge/NestJS-E0234E?style=for-the-badge&logo=nestjs&logoColor=white" alt="NestJS" width="100"/> | ![75%](https://progress-bar.xyz/75) | Standard and Microservices architectures, NestJS 9.x and 10.x features |
254+
| <img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js" width="100"/> | ![20%](https://progress-bar.xyz/20) | Base project structure, best practices, naming, testing |
255+
| <img src="https://img.shields.io/badge/Vue-4FC08D?style=for-the-badge&logo=vue.js&logoColor=white" alt="Vue" width="100"/> | ![45%](https://progress-bar.xyz/45) | Testing guidelines, architecture concepts |
256256

257257
</p>
258258

File renamed without changes.
File renamed without changes.
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
---
2+
description: State management concepts and approaches in Laravel applications
3+
globs: <root>/resources/**/*.{js,ts,vue,blade.php}, <root>/app/**/*.php
4+
alwaysApply: true
5+
---
6+
7+
# State Management in Laravel Applications
8+
9+
This document outlines common conceptual approaches to state management in Laravel applications in {projectPath}. Laravel applications can use various state management strategies depending on the frontend architecture chosen.
10+
11+
## Server-Side State Management
12+
13+
### 1. Session Management
14+
- **Concept**: Store user state on the server using Laravel's session system.
15+
- **Use Cases**: User authentication, shopping carts, form data persistence.
16+
- **Storage Options**: File, database, Redis, Memcached.
17+
- **Pros**: Secure, works without JavaScript, simple to implement.
18+
- **Cons**: Server memory usage, not suitable for API-only applications.
19+
20+
### 2. Database State
21+
- **Concept**: Store application state directly in the database.
22+
- **Use Cases**: User preferences, application settings, persistent data.
23+
- **Implementation**: Eloquent models, database migrations, seeders.
24+
- **Pros**: Persistent, queryable, relational.
25+
- **Cons**: Database overhead, not suitable for temporary state.
26+
27+
### 3. Cache-Based State
28+
- **Concept**: Use Laravel's cache system for temporary state storage.
29+
- **Use Cases**: Computed values, API responses, temporary data.
30+
- **Storage Options**: Redis, Memcached, file, database.
31+
- **Pros**: Fast access, automatic expiration, distributed.
32+
- **Cons**: May be volatile, requires cache strategy.
33+
34+
### 4. Queue State Management
35+
- **Concept**: Manage state through job queues and background processing.
36+
- **Use Cases**: Long-running processes, asynchronous state updates.
37+
- **Implementation**: Laravel jobs, queues, event listeners.
38+
- **Pros**: Non-blocking, scalable, reliable.
39+
- **Cons**: Eventual consistency, complexity.
40+
41+
## Client-Side State Management
42+
43+
### 1. Traditional Form-Based State
44+
- **Concept**: Use HTML forms and server-side processing for state changes.
45+
- **Implementation**: Blade templates, form requests, validation.
46+
- **State Flow**: Client form → Server processing → Database → Response.
47+
- **Pros**: Simple, works without JavaScript, SEO-friendly.
48+
- **Cons**: Page reloads, limited interactivity.
49+
50+
### 2. AJAX-Based State
51+
- **Concept**: Use JavaScript and AJAX for dynamic state updates.
52+
- **Implementation**: jQuery, Axios, Fetch API with Laravel routes.
53+
- **State Flow**: Client JavaScript → API endpoint → Database → JSON response.
54+
- **Pros**: Better UX, no page reloads, partial updates.
55+
- **Cons**: Requires JavaScript, more complex error handling.
56+
57+
### 3. SPA State Management
58+
- **Concept**: Single Page Application with client-side routing and state.
59+
- **Frontend Options**: Vue.js, React, Angular with Laravel API.
60+
- **State Libraries**: Vuex/Pinia, Redux, Zustand.
61+
- **Pros**: Rich interactivity, offline capabilities, modern UX.
62+
- **Cons**: SEO challenges, complexity, requires build process.
63+
64+
## Laravel + Frontend Framework Integration
65+
66+
### 1. Laravel + Vue.js
67+
- **State Management**: Vuex (Vue 2) or Pinia (Vue 3).
68+
- **API Integration**: Laravel API routes with Vue HTTP client.
69+
- **Authentication**: Laravel Sanctum for SPA authentication.
70+
- **Real-time**: Laravel WebSockets or Pusher with Vue.
71+
72+
```php
73+
// Laravel API Controller
74+
class UserController extends Controller
75+
{
76+
public function index()
77+
{
78+
return response()->json(User::all());
79+
}
80+
}
81+
```
82+
83+
### 2. Laravel + React
84+
- **State Management**: Redux Toolkit, Zustand, or React Query.
85+
- **API Integration**: Laravel API with React HTTP client.
86+
- **Authentication**: Laravel Sanctum or Passport.
87+
- **Server-Side Rendering**: Laravel + Inertia.js for SSR.
88+
89+
### 3. Laravel + Alpine.js
90+
- **State Management**: Alpine.js reactive data and stores.
91+
- **Integration**: Blade templates with Alpine.js directives.
92+
- **API Calls**: Alpine.js with Laravel routes.
93+
- **Pros**: Lightweight, easy integration, progressive enhancement.
94+
95+
### 4. Laravel + Inertia.js
96+
- **Concept**: Build SPAs using server-side routing and controllers.
97+
- **State Management**: Server-side props with client-side reactivity.
98+
- **Frontend**: Vue.js, React, or Svelte with Inertia adapter.
99+
- **Pros**: SPA experience with server-side simplicity.
100+
101+
## State Synchronization Patterns
102+
103+
### 1. Real-time State Updates
104+
- **Laravel WebSockets**: Real-time communication with WebSocket server.
105+
- **Pusher Integration**: Cloud-based real-time messaging.
106+
- **Server-Sent Events**: One-way real-time updates from server.
107+
- **Use Cases**: Live chat, notifications, collaborative editing.
108+
109+
### 2. Optimistic Updates
110+
- **Concept**: Update UI immediately, sync with server afterward.
111+
- **Implementation**: Client-side state updates with API calls.
112+
- **Error Handling**: Rollback on server error.
113+
- **Use Cases**: Like buttons, form submissions, instant feedback.
114+
115+
### 3. Offline State Management
116+
- **Service Workers**: Cache API responses for offline use.
117+
- **Local Storage**: Store state locally for offline access.
118+
- **Sync Strategies**: Background sync when connection restored.
119+
- **Use Cases**: Progressive Web Apps, mobile applications.
120+
121+
## Authentication State
122+
123+
### 1. Session-Based Authentication
124+
- **Implementation**: Laravel's built-in session authentication.
125+
- **State Storage**: Server-side session storage.
126+
- **Frontend Access**: CSRF tokens, authenticated user data.
127+
- **Use Cases**: Traditional web applications.
128+
129+
### 2. Token-Based Authentication
130+
- **Laravel Sanctum**: SPA authentication with tokens.
131+
- **Laravel Passport**: OAuth2 server implementation.
132+
- **JWT**: JSON Web Tokens for stateless authentication.
133+
- **Use Cases**: API-driven applications, mobile apps.
134+
135+
### 3. Social Authentication
136+
- **Laravel Socialite**: OAuth integration with social providers.
137+
- **State Management**: User profile data, social connections.
138+
- **Implementation**: OAuth flows with state persistence.
139+
140+
## Best Practices
141+
142+
### Server-Side State
143+
- **Validation**: Always validate state changes on the server.
144+
- **Authorization**: Check permissions before state modifications.
145+
- **Transactions**: Use database transactions for atomic updates.
146+
- **Caching**: Cache frequently accessed state data.
147+
148+
### Client-Side State
149+
- **Synchronization**: Keep client state in sync with server.
150+
- **Validation**: Validate on both client and server sides.
151+
- **Error Handling**: Handle network errors gracefully.
152+
- **Performance**: Minimize state updates and re-renders.
153+
154+
### Security Considerations
155+
- **CSRF Protection**: Use Laravel's CSRF protection for state changes.
156+
- **Input Sanitization**: Sanitize all user inputs.
157+
- **Rate Limiting**: Implement rate limiting for state-changing operations.
158+
- **Audit Logging**: Log important state changes for security.
159+
160+
## Recommendations
161+
162+
### For Traditional Laravel Applications
163+
- Use **session-based state** for user data
164+
- Use **database state** for persistent application data
165+
- Use **cache** for computed or temporary data
166+
- Implement **CSRF protection** for all state changes
167+
168+
### For Laravel + SPA Applications
169+
- Use **Laravel Sanctum** for authentication
170+
- Use **appropriate frontend state library** (Pinia, Redux, etc.)
171+
- Implement **optimistic updates** for better UX
172+
- Use **Laravel Echo** for real-time updates
173+
174+
### For Laravel API Applications
175+
- Use **token-based authentication**
176+
- Implement **stateless design** principles
177+
- Use **database state** for persistence
178+
- Consider **event sourcing** for complex state management
179+
180+
### For High-Performance Applications
181+
- Use **Redis** for session and cache storage
182+
- Implement **queue-based state updates**
183+
- Use **database read replicas** for state queries
184+
- Consider **CQRS pattern** for complex state management
185+
186+
Remember that state management strategy should align with your application's architecture, scalability requirements, and team expertise.

0 commit comments

Comments
 (0)