البداية · فصل ١

شكل الفولدرات والطبقات

app · pages · widgets · features · entities · shared
🎯 الهدف: تشوف طبقات FSD في تطبيق المتجر، وتعرف إن الطبقة الأعلى بس هي اللي تعتمد على الأدنى.

الست طبقات

src/├── app/          Application setup — Router · Providers · Global styles · Query Client├── pages/        Route pages — home · products · product-details · cart · checkout · orders├── widgets/      Large UI blocks — header · product-grid · cart-summary · product-gallery├── features/     User actions — add-to-cart · add-to-wishlist · login · apply-coupon · place-order├── entities/     Business entities — product · cart · user · order · category└── shared/       Reusable infrastructure — api · ui · lib · config · types

الطبقات دي مرتبة من الأعلى للأدنى. الطبقة الأعلى تقدر تعتمد على طبقة أدنى منها. العكس ممنوع.

يعني features تقدر تستخدم entities وshared. لكن entities مينفعش تستورد من features.

خلّصت الفصل لما

🧠 اختبر نفسك
١) entities تقدر تستورد من features؟
لأ. الاعتماد من الأعلى للأدنى بس.
٢) add-to-cart مكانها في أنهي طبقة؟
features. دي أفعال المستخدم.