Indie Hacker Mobile Apps · درس

معمارية التنقل والتوجيه

صمّموا طبقة تنقل نظيفة وقابلة للتوسع لتطبيقكم المحمول باستخدام المكدسات وعلامات التبويب والروابط العميقة وحواجز المسارات التي تحافظ على قابلية التنبؤ بتدفقات الاستخدام مع نمو التطبيق.

الدرس 4 من 413 خطوة

معمارية التنقل والتوجيه درس مجاني في Indie Hacker Mobile Apps على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Indie Hacker Mobile Apps، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Indie Hacker Mobile Apps 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Navigation Is Architecture

How users move through your app is a core architectural concern, not an afterthought. A messy navigation layer leaks state and breaks the back button.

This lesson covers patterns that keep flows predictable.

The Navigation Stack

Mobile navigation is built on a stack: pushing a screen adds it on top, going back pops it off.

  • Push: go deeper
  • Pop: go back
  • Replace: swap the top screen

The stack mirrors the user's mental history.

Tabs and Nested Stacks

Most apps combine a tab bar with a stack inside each tab. Each tab keeps its own history, so switching tabs does not lose your place.

This nesting is the backbone of modern mobile UX.

Defining Routes

Centralize your route names so they are not scattered as magic strings. A route map keeps navigation consistent and refactor-safe.

const Routes = {
  Home: 'home',
  Profile: 'profile',
  Settings: 'settings'
};
console.log(Routes.Profile);

Passing Parameters

Screens often need data, like which item to show. Pass typed parameters with navigation rather than relying on global state.

function navigateToDetail(id) {
  const params = { itemId: id };
  return { route: 'detail', params };
}
console.log(navigateToDetail(42));

Deep Linking

A deep link opens a specific screen from outside the app — a URL like myapp://item/42. Deep links power notifications, sharing, and marketing campaigns.

Map URL patterns to routes in one place.

Route Guards

Some screens require auth or a completed onboarding step. A route guard checks a condition before allowing navigation and redirects if it fails.

function canEnter(route, isLoggedIn) {
  const protectedRoutes = ['profile', 'settings'];
  if (protectedRoutes.includes(route) && !isLoggedIn) return 'login';
  return route;
}
console.log(canEnter('profile', false));

Separating Navigation from Screens

Screens should not know how navigation works internally. Inject a navigation service or callback so screens stay testable and reusable.

This decoupling keeps your architecture clean.

Handling Back Behavior

The hardware back button on Android and gestures on iOS must behave sensibly. Decide per screen whether back exits a flow, confirms a discard, or is blocked.

Predictable back behavior is a hallmark of polish.

Avoiding Navigation Spaghetti

As apps grow, avoid these traps:

  • Hardcoded route strings everywhere
  • Deeply nested stacks no one understands
  • Business logic inside navigation handlers

A central route map and guards keep complexity in check.

A Clean Navigation Layer

Put it together:

  • Central route definitions
  • Tabs wrapping nested stacks
  • Typed parameters between screens
  • Deep link mapping in one place
  • Guards for protected routes

This structure scales from MVP to mature app.

Quick Check

Test your navigation architecture knowledge.

Recap

You designed a navigation layer:

  • Stacks model push/pop history; tabs hold nested stacks
  • Centralize route names and pass typed parameters
  • Deep links open specific screens from outside
  • Guards protect restricted routes
  • Decouple navigation from screens for testability

Clean navigation keeps flows predictable as you scale.

البدء مجانًا

تعلم Indie Hacker Mobile Apps مع معلم ذكاء اصطناعي — مجانًا

اكتب وقم بتشغيل أكوادك الفعلية في المتصفح، واحصل على مساعدة فورية من معلم ذكاء اصطناعي متاح 24/7، واستمر من حيث توقفت على الويب أو في التطبيق.

الدورات
12
الدروس
48

الأسئلة الشائعة

هل درس «معمارية التنقل والتوجيه» مجاني؟

نعم — نص درس «معمارية التنقل والتوجيه» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Indie Hacker Mobile Apps، انتقل إلى CoddyKit PRO. تتضمن دورة Indie Hacker Mobile Apps 4 دروس في المجموع.

ماذا ستتعلم في «معمارية التنقل والتوجيه»؟

صمّموا طبقة تنقل نظيفة وقابلة للتوسع لتطبيقكم المحمول باستخدام المكدسات وعلامات التبويب والروابط العميقة وحواجز المسارات التي تحافظ على قابلية التنبؤ بتدفقات الاستخدام مع نمو التطبيق. تتمرن على Indie Hacker Mobile Apps مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Indie Hacker Mobile Apps؟

لا تُشترط خبرة سابقة. Indie Hacker Mobile Apps على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «معمارية التنقل والتوجيه»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Indie Hacker Mobile Apps هذا؟

نعم. كل درس في Indie Hacker Mobile Apps يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. إدارة الحالة للتطبيقات المحمولة
  2. استمرارية البيانات المحلية
  3. دمج RESTful APIs
  4. معمارية التنقل والتوجيه
← العودة إلى Indie Hacker Mobile Apps