<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nursena Karakulah on Medium]]></title>
        <description><![CDATA[Stories by Nursena Karakulah on Medium]]></description>
        <link>https://medium.com/@senafrakara?source=rss-671e98f161f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yalepsEzYtBmqFgN3mA7Mg.jpeg</url>
            <title>Stories by Nursena Karakulah on Medium</title>
            <link>https://medium.com/@senafrakara?source=rss-671e98f161f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 09:02:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@senafrakara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Firebase Cloud Functions ile Pub/Sub: Gerçek Zamanlı Asenkron Mesajlaşma Rehberi]]></title>
            <link>https://medium.com/@senafrakara/firebase-cloud-functions-ile-pub-sub-ger%C3%A7ek-zamanl%C4%B1-asenkron-mesajla%C5%9Fma-rehberi-5165afa31e93?source=rss-671e98f161f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/5165afa31e93</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firebase-cloud-functions]]></category>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[asynchronous]]></category>
            <dc:creator><![CDATA[Nursena Karakulah]]></dc:creator>
            <pubDate>Sat, 01 Nov 2025 19:19:13 GMT</pubDate>
            <atom:updated>2025-11-01T19:19:13.407Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zzDf4klDfFdyyQZ7D4NSWA.png" /></figure><p>Modern uygulama geliştirmede en büyük zorluklardan biri, zaman alan işlemleri kullanıcı deneyimini bozmadan yönetmektir. Kullanıcı bir sipariş verdiğinde onay e-postası göndermek, yüklenen resimlerin thumbnail’larını oluşturmak veya büyük veri setlerini işlemek gibi operasyonlar, kullanıcının beklemesine neden olabilir. İşte bu noktada <strong>Google Cloud Pub/Sub</strong> hayat kurtarıcı bir çözüm sunar.</p><p>Bu yazıda, Firebase Cloud Functions (Gen 1) ile Pub/Sub entegrasyonunu sıfırdan anlatacağım. Hem teori hem de pratik örneklerle, production-ready bir mesajlaşma sistemi kurmayı öğreneceksiniz.</p><blockquote><em>📦 </em><strong><em>Kaynak Kod</em></strong><em>: Tüm örnekleri </em><a href="https://github.com/senafrakara/FIREBASE_PUBSUB_EXAMPLE"><em>GitHub reposunda</em></a><em> bulabilir ve doğrudan kullanabilirsiniz.</em></blockquote><h3>🤔 Pub/Sub Nedir ve Neden İhtiyacımız Var?</h3><p><strong>Pub/Sub (Publish/Subscribe)</strong>, mesajlaşma tabanlı bir iletişim modelidir. Basitçe anlatmak gerekirse:</p><ol><li><strong>Publisher (Yayıncı)</strong>: Mesajı bir kanala (topic) gönderir</li><li><strong>Topic (Konu)</strong>: Mesajların toplandığı kanal</li><li><strong>Subscriber (Abone)</strong>: Topic’i dinler ve gelen mesajları işler</li></ol><h3>Klasik HTTP vs Pub/Sub</h3><p>Farkı bir örnekle açıklayalım:</p><p><strong>Klasik HTTP Yaklaşımı:</strong></p><pre>Kullanıcı → Sipariş Ver → [Bekle] → E-posta Gönder → [Bekle] → SMS Gönder → Yanıt</pre><p>Toplam süre: 5–10 saniye (kullanıcı bekliyor ⏳)</p><p><strong>Pub/Sub Yaklaşımı:</strong></p><pre>Kullanıcı → Sipariş Ver → Mesaj Yayınla → Hemen Yanıt ✅<br>                              ↓<br>                    [Arka Planda]<br>                    E-posta Gönder<br>                    SMS Gönder<br>                    Fatura Oluştur</pre><p>Yanıt süresi: ~200ms (kullanıcı mutlu 😊)</p><h3>Pub/Sub’ın Süper Güçleri</h3><p>✅ <strong>Asenkron İşleme</strong>: Fire-and-forget prensibi ile anında yanıt<br> ✅ <strong>Ölçeklenebilirlik</strong>: Binlerce mesajı otomatik olarak yönetir<br> ✅ <strong>Güvenilirlik</strong>: At-least-once delivery garantisi<br> ✅ <strong>Decoupling</strong>: Servisler birbirini tanımaz, sadece topic’i bilir<br> ✅ <strong>Trafik Kontrolü</strong>: Ani yüklenmelerde kuyruk sistemi ile koruma</p><h3>Gerçek Hayattan Kullanım Senaryoları</h3><p>📧 <strong>E-posta ve Bildirimler</strong>: Kullanıcı kaydında hoş geldin e-postası<br> 🖼️ <strong>Resim İşleme</strong>: Yüklenen görsellerin farklı boyutlarda thumbnail’ları<br> 📊 <strong>Veri Analizi</strong>: Log kayıtlarını topla ve işle<br> 🛒 <strong>E-ticaret</strong>: Sipariş işleme, stok güncelleme, fatura oluşturma<br> 🔄 <strong>Event-Driven Mimari</strong>: Mikroservisler arası haberleşme</p><h3>🚀 Hızlı Başlangıç</h3><h3>Gereksinimler</h3><ul><li>Node.js 20+</li><li>Firebase CLI: npm install -g firebase-tools</li><li>Google Cloud CLI (topic oluşturma için)</li><li>Aktif bir Firebase projesi</li></ul><h3>Projeyi Çalıştırma</h3><pre># Depoyu klonlayın<br>git clone https://github.com/senafrakara/FIREBASE_PUBSUB_EXAMPLE.git<br>cd firebase-pubsub-example</pre><pre># Bağımlılıkları yükleyin<br>cd functions<br>npm install<br># Firebase&#39;e bağlanın<br>firebase login<br>firebase use --add  # Proje ID&#39;nizi seçin</pre><h3>📋 Topic Oluşturma: İlk Adım</h3><p>Pub/Sub kullanmadan önce topic’leri oluşturmalısınız. Üç farklı yöntem var:</p><h3>1️⃣ Google Cloud Console (Önerilen)</h3><ol><li><a href="https://console.cloud.google.com/">Google Cloud Console</a>’a gidin</li><li>Menüden <strong>“Pub/Sub”</strong> → <strong>“Topics”</strong> seçin</li><li><strong>“Create Topic”</strong> tıklayın</li><li>Topic adını girin: orders, notifications, user-events</li></ol><h3>2️⃣ gcloud CLI</h3><pre># Projenizi seçin<br>gcloud config set project YOUR-PROJECT-ID</pre><pre># Topic&#39;leri oluşturun<br>gcloud pubsub topics create orders<br>gcloud pubsub topics create notifications<br>gcloud pubsub topics create user-events<br># Doğrulama<br>gcloud pubsub topics list</pre><h3>3️⃣ Kod ile Oluşturma</h3><pre>const { PubSub } = require(&#39;@google-cloud/pubsub&#39;);<br>const pubsub = new PubSub();<br><br>// Topic oluştur<br>await pubsub.createTopic(&#39;my-dynamic-topic&#39;);</pre><h3>📤 Mesaj Yayınlama (Publishing)</h3><p>GitHub projemde üç farklı mesaj yayınlama örneği bulunuyor. Her birini inceleyelim:</p><h3>1. Basit String Mesaj</h3><p>En temel kullanım:</p><pre>exports.publishMessage = functions.https.onRequest(async (req, res) =&gt; {<br>  const { message, topic = &#39;test-topic&#39; } = req.body;<br><br>const messageId = await pubsub.topic(topic).publishMessage({<br>    data: Buffer.from(message),<br>  });<br>  functions.logger.info(`Message ${messageId} published`);<br>  <br>  return res.json({<br>    success: true,<br>    messageId,<br>    topic,<br>    message<br>  });<br>});</pre><p><strong>Test etmek için:</strong></p><pre>curl -X POST https://YOUR-REGION-YOUR-PROJECT.cloudfunctions.net/publishMessage \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;message&quot;: &quot;Hello Pub/Sub!&quot;, &quot;topic&quot;: &quot;test-topic&quot;}&#39;</pre><h3>2. JSON Mesaj (Yapılandırılmış Veri)</h3><p>Gerçek dünya uygulamalarında genellikle JSON kullanırız:</p><pre>exports.publishJson = functions.https.onRequest(async (req, res) =&gt; {<br>  const { topic = &#39;json-topic&#39;, data } = req.body;<br><br>const messageId = await pubsub.topic(topic).publishMessage({<br>    json: data,  // Otomatik JSON serialization<br>  });<br>  return res.json({ success: true, messageId, data });<br>});</pre><p><strong>E-ticaret örneği:</strong></p><pre>curl -X POST https://YOUR-REGION.cloudfunctions.net/publishJson \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;topic&quot;: &quot;orders&quot;,<br>    &quot;data&quot;: {<br>      &quot;orderId&quot;: &quot;ORD-2024-12345&quot;,<br>      &quot;customerId&quot;: &quot;CUST-67890&quot;,<br>      &quot;total&quot;: 299.99,<br>      &quot;type&quot;: &quot;express&quot;,<br>      &quot;items&quot;: [<br>        {&quot;id&quot;: &quot;PROD-1&quot;, &quot;quantity&quot;: 2},<br>        {&quot;id&quot;: &quot;PROD-2&quot;, &quot;quantity&quot;: 1}<br>      ]<br>    }<br>  }&#39;</pre><h3>3. Attribute’lu Mesaj (Metadata)</h3><p>Mesaj filtreleme ve yönlendirme için:</p><pre>exports.publishWithAttributes = functions.https.onRequest(async (req, res) =&gt; {<br>  const { message, topic, attributes = {} } = req.body;<br>  const messageId = await pubsub.topic(topic).publishMessage({<br>      data: Buffer.from(message),<br>      attributes: attributes  // Metadata<br>    });<br>    return res.json({ success: true, messageId, attributes });<br>});</pre><p><strong>Kullanım örneği:</strong></p><pre>curl -X POST https://YOUR-REGION.cloudfunctions.net/publishWithAttributes \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;message&quot;: &quot;İşlem tamamlandı&quot;,<br>    &quot;topic&quot;: &quot;notifications&quot;,<br>    &quot;attributes&quot;: {<br>      &quot;userId&quot;: &quot;12345&quot;,<br>      &quot;priority&quot;: &quot;high&quot;,<br>      &quot;type&quot;: &quot;order_confirmation&quot;,<br>      &quot;timestamp&quot;: &quot;2024-01-15T10:30:00Z&quot;<br>    }<br>  }&#39;</pre><p><strong>Attribute’lar ne işe yarar?</strong></p><ul><li>Mesajları filtrelemek (sadece high priority olanları işle)</li><li>Yönlendirme yapmak (mobile vs web notification)</li><li>Mesaj body’yi parse etmeden metadata okumak</li></ul><h3>📥 Mesaj İşleme (Consuming)</h3><h3>🎯 Kritik Bilgi: Otomatik Subscription</h3><p>Firebase Functions’da onPublish() kullandığınızda, deployment sırasında <strong>otomatik olarak</strong> bir subscription oluşturulur. Manuel subscription yapmanıza gerek yok!</p><pre>// Bu kodu yazdığınızda...<br>exports.myFunction = functions.pubsub.topic(&#39;orders&#39;).onPublish((message) =&gt; {<br>  // İşlem kodu<br>});</pre><pre>// Firebase deploy sırasında şunlar olur:<br>// ✅ &#39;orders&#39; topic&#39;i için subscription oluşturulur<br>// ✅ Her mesajda bu fonksiyon tetiklenir<br>// ✅ Retry mekanizması otomatik aktif olur</pre><h3>1. Base64 Mesaj Okuma</h3><p>String mesajlar base64 encode edilmiş gelir:</p><pre>exports.helloPubSub = functions.pubsub.topic(&#39;test-topic&#39;).onPublish((message) =&gt; {<br>  // Base64 decode<br>  const messageBody = message.data <br>    ? Buffer.from(message.data, &#39;base64&#39;).toString() <br>    : null;<br>  functions.logger.log(`Mesaj alındı: ${messageBody}`);<br>    <br>    // İş mantığınız buraya<br>    <br>    return null;<br>});</pre><p><strong>Test:</strong></p><pre># gcloud ile mesaj gönder<br>gcloud pubsub topics publish test-topic --message &quot;Merhaba Dünya&quot;,<br><br># Logları izle<br>firebase functions:log --tail</pre><h3>2. JSON Mesaj İşleme</h3><p>En yaygın kullanım şekli:</p><pre>exports.processUserSignup = functions.pubsub<br>  .topic(&#39;user-signup&#39;)<br>  .onPublish(async (message) =&gt; {<br>    try {<br>      const userData = message.json;<br>      <br>      functions.logger.info(&#39;Yeni kullanıcı kaydı:&#39;, {<br>        userId: userData.userId,<br>        email: userData.email<br>      });<br>      <br>      // E-posta gönder<br>      await sendWelcomeEmail(userData.email, userData.name);<br>      <br>      // Analytics&#39;e kaydet<br>      await trackUserSignup(userData);<br>      <br>      // Hoş geldin kuponu oluştur<br>      await createWelcomeCoupon(userData.userId);<br>      <br>      functions.logger.info(`Kullanıcı işlendi: ${userData.userId}`);<br>    } catch (error) {<br>      functions.logger.error(&#39;Hata:&#39;, error);<br>      // Pub/Sub otomatik retry yapacak<br>    }<br>    <br>    return null;<br>});</pre><h3>3. Attribute Okuma</h3><p>Metadata’yı kullanarak akıllı işleme:</p><pre>exports.smartNotificationHandler = functions.pubsub<br>  .topic(&#39;notifications&#39;)<br>  .onPublish((message) =&gt; {<br>    const priority = message.attributes.priority;<br>    const type = message.attributes.type;<br>    const userId = message.attributes.userId;<br>    functions.logger.log(`Bildirim: ${type}, Priority: ${priority}, User: ${userId}`);<br>    // Priority&#39;ye göre işlem<br>    if (priority === &#39;urgent&#39;) {<br>      sendPushNotification(userId, message.data);<br>    } else if (priority === &#39;high&#39;) {<br>      scheduleNotification(userId, message.data, &#39;5m&#39;);<br>    } else {<br>      queueNotification(userId, message.data);<br>    }<br>    return null;<br>});</pre><h3>💼 Gerçek Dünya Örneği: Sipariş İşleme Sistemi</h3><p>Projemde yer alan ileri seviye örnek, tam bir sipariş işleme sistemini gösteriyor:</p><pre>exports.processOrder = functions.pubsub<br>  .topic(&#39;orders&#39;)<br>  .onPublish(async (message) =&gt; {<br>    try {<br>      const orderData = message.json;<br><br>      // 1. Validasyon<br>      if (!orderData.orderId || !orderData.customerId || !orderData.total) {<br>        functions.logger.error(&#39;Eksik veri&#39;, orderData);<br>        return null;  // Retry yapma<br>      }<br>      // 2. Detaylı loglama<br>      functions.logger.info(`Sipariş işleniyor: ${orderData.orderId}`, {<br>        orderId: orderData.orderId,<br>        customerId: orderData.customerId,<br>        total: orderData.total,<br>        type: orderData.type,<br>        timestamp: new Date().toISOString()<br>      });<br>      // 3. Sipariş tipine göre işlem<br>      switch (orderData.type) {<br>        case &#39;standard&#39;:<br>          await processStandardOrder(orderData);<br>          functions.logger.info(&#39;Standart sipariş işlendi&#39;);<br>          break;<br>        case &#39;express&#39;:<br>          // Acil işlem - öncelikli kargo<br>          await processExpressOrder(orderData);<br>          await notifyWarehouse(orderData, &#39;URGENT&#39;);<br>          functions.logger.info(&#39;Ekspres sipariş - öncelikli işlem&#39;);<br>          break;<br>        case &#39;bulk&#39;:<br>          // Toplu sipariş - özel fiyatlandırma<br>          await processBulkOrder(orderData);<br>          await calculateBulkDiscount(orderData);<br>          functions.logger.info(&#39;Toplu sipariş - özel fiyat uygulandı&#39;);<br>          break;<br>        default:<br>          functions.logger.warn(`Bilinmeyen sipariş tipi: ${orderData.type}`);<br>      }<br>      // 4. Yan işlemler<br>      await Promise.all([<br>        sendOrderConfirmationEmail(orderData),<br>        updateInventory(orderData.items),<br>        createInvoice(orderData),<br>        notifyShippingDepartment(orderData)<br>      ]);<br>      functions.logger.info(`✅ Sipariş başarıyla tamamlandı: ${orderData.orderId}`);<br>      <br>      return { success: true, orderId: orderData.orderId };<br>    } catch (error) {<br>      functions.logger.error(&#39;❌ Sipariş işleme hatası:&#39;, error);<br>      // Pub/Sub otomatik retry yapacak<br>      throw error;<br>    }<br>});</pre><p><strong>Bu örneği test etmek için:</strong></p><pre>gcloud pubsub topics publish orders --message &#39;{<br>  &quot;orderId&quot;: &quot;ORD-2024-12345&quot;,<br>  &quot;customerId&quot;: &quot;CUST-67890&quot;,<br>  &quot;total&quot;: 299.99,<br>  &quot;type&quot;: &quot;express&quot;,<br>  &quot;items&quot;: [<br>    {&quot;productId&quot;: &quot;PROD-1&quot;, &quot;quantity&quot;: 2, &quot;price&quot;: 99.99},<br>    {&quot;productId&quot;: &quot;PROD-2&quot;, &quot;quantity&quot;: 1, &quot;price&quot;: 100.01}<br>  ],<br>  &quot;shippingAddress&quot;: {<br>    &quot;name&quot;: &quot;Ahmet Yılmaz&quot;,<br>    &quot;address&quot;: &quot;İstanbul, Türkiye&quot;<br>  }<br>}&#39;</pre><h3>🔄 Tam Workflow: Baştan Sona</h3><p>Şimdi tüm parçaları bir araya getirelim:</p><h3>Adım 1: Topic Oluştur</h3><pre>gcloud pubsub topics create user-events</pre><h3>Adım 2: Fonksiyonları Deploy Et</h3><pre>firebase deploy --only functions</pre><p>Deploy sonrası console’da göreceksiniz:</p><pre>✔  functions[publishJson]: Successful create operation.<br>✔  functions[processUserSignup]: Successful create operation.<br>   - Topic: user-events<br>   - Subscription: Auto-created</pre><h3>Adım 3: Mesaj Gönder</h3><p><strong>Yöntem 1: HTTP Endpoint</strong></p><pre>curl -X POST https://us-central1-YOUR-PROJECT.cloudfunctions.net/publishJson \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{<br>    &quot;topic&quot;: &quot;user-events&quot;,<br>    &quot;data&quot;: {<br>      &quot;userId&quot;: &quot;user_123&quot;,<br>      &quot;email&quot;: &quot;ahmet@example.com&quot;,<br>      &quot;name&quot;: &quot;Ahmet Yılmaz&quot;,<br>      &quot;timestamp&quot;: &quot;2024-01-15T10:30:00Z&quot;<br>    }<br>  }&#39;</pre><p><strong>Yöntem 2: gcloud CLI</strong></p><pre>gcloud pubsub topics publish user-events --message &#39;{<br>  &quot;userId&quot;: &quot;user_123&quot;,<br>  &quot;email&quot;: &quot;ahmet@example.com&quot;,<br>  &quot;name&quot;: &quot;Ahmet Yılmaz&quot;<br>}&#39;</pre><h3>Adım 4: Logları İzle</h3><pre># Tüm loglar<br>firebase functions:log<br><br># Gerçek zamanlı takip<br>firebase functions:log --tail<br># Belirli fonksiyon<br>firebase functions:log --only processUserSignup</pre><p><strong>Log çıktısı:</strong></p><pre>2024-01-15T10:30:05.123Z - info: Yeni kullanıcı kaydı: {userId: &quot;user_123&quot;, email: &quot;ahmet@example.com&quot;}<br>2024-01-15T10:30:06.456Z - info: Hoş geldin e-postası gönderildi: ahmet@example.com<br>2024-01-15T10:30:07.789Z - info: Kullanıcı işlendi: user_123</pre><h3>🎨 Gerçek Hayat Senaryoları</h3><h3>Senaryo 1: Kullanıcı Kayıt Sistemi</h3><pre>// 1. Firebase Auth trigger&#39;ı ile mesaj yayınla<br>exports.onUserCreate = functions.auth<br>  .user()<br>  .onCreate(async (user) =&gt; {<br>    await pubsub.topic(&#39;user-signup&#39;).publishMessage({<br>      json: {<br>        userId: user.uid,<br>        email: user.email,<br>        name: user.displayName || &#39;Kullanıcı&#39;,<br>        createdAt: new Date().toISOString()<br>      }<br>    });<br>    <br>    functions.logger.info(`Kullanıcı kaydı pub/sub&#39;a gönderildi: ${user.uid}`);<br>  });<br><br><br>// 2. Mesajı işle ve birden fazla görev yap<br>exports.handleUserSignup = functions.pubsub<br>  .topic(&#39;user-signup&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const { userId, email, name } = message.json;<br>    // Paralel olarak çalışan görevler<br>    await Promise.all([<br>      // Hoş geldin e-postası<br>      sendWelcomeEmail(email, name),<br>      <br>      // Firestore&#39;da profil oluştur<br>      admin.firestore().collection(&#39;users&#39;).doc(userId).set({<br>        email,<br>        name,<br>        createdAt: admin.firestore.FieldValue.serverTimestamp(),<br>        onboardingCompleted: false<br>      }),<br>      <br>      // Analytics&#39;e kaydet<br>      trackEvent(&#39;user_signup&#39;, { userId, email }),<br>      <br>      // İlk kullanıcı kuponu oluştur<br>      createWelcomeCoupon(userId, &#39;10TL&#39;),<br>      <br>      // Marketing listesine ekle<br>      addToMailingList(email, name)<br>    ]);<br>    functions.logger.info(`✅ Kullanıcı onboarding tamamlandı: ${userId}`);<br>  });</pre><h3>Senaryo 2: Resim İşleme Pipeline</h3><pre>// 1. Storage&#39;a resim yüklendiğinde mesaj yayınla<br>exports.onImageUpload = functions.storage<br>  .object()<br>  .onFinalize(async (object) =&gt; {<br>    const filePath = object.name;<br>    const bucket = object.bucket;<br><br>if (!filePath.startsWith(&#39;uploads/&#39;)) return null;<br>    await pubsub.topic(&#39;image-processing&#39;).publishMessage({<br>      json: {<br>        filePath,<br>        bucket,<br>        contentType: object.contentType,<br>        userId: object.metadata?.userId,<br>        uploadedAt: new Date().toISOString()<br>      }<br>    });<br>  });<br><br>// 2. Resimleri işle<br>exports.processImage = functions.pubsub<br>  .topic(&#39;image-processing&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const { filePath, bucket, userId } = message.json;<br>    functions.logger.info(`Resim işleniyor: ${filePath}`);<br><br>    // Farklı boyutlarda thumbnail oluştur<br>    const sizes = [<br>      { name: &#39;thumb&#39;, width: 200, height: 200 },<br>      { name: &#39;medium&#39;, width: 800, height: 800 },<br>      { name: &#39;large&#39;, width: 1920, height: 1920 }<br>    ];<br>    const thumbnails = await Promise.all(<br>      sizes.map(async (size) =&gt; {<br>        const thumbPath = await createThumbnail(<br>          bucket,<br>          filePath,<br>          size.width,<br>          size.height<br>        );<br>        return { size: size.name, path: thumbPath };<br>      })<br>    );<br><br>    // Firestore&#39;a kaydet<br>    await admin.firestore()<br>      .collection(&#39;images&#39;)<br>      .add({<br>        userId,<br>        originalPath: filePath,<br>        thumbnails,<br>        processedAt: admin.firestore.FieldValue.serverTimestamp()<br>      });<br>    functions.logger.info(`✅ Resim işlendi: ${thumbnails.length} thumbnail`);<br>  });<br></pre><h3>Senaryo 3: E-ticaret Sipariş Workflow</h3><pre>// 1. Sipariş oluşturulduğunda<br>exports.onOrderCreated = functions.firestore<br>  .document(&#39;orders/{orderId}&#39;)<br>  .onCreate(async (snap, context) =&gt; {<br>    const order = snap.data();<br>    const orderId = context.params.orderId;<br><br>await pubsub.topic(&#39;order-created&#39;).publishMessage({<br>      json: {<br>        orderId,<br>        customerId: order.customerId,<br>        items: order.items,<br>        total: order.total,<br>        status: &#39;pending&#39;<br>      }<br>    });<br>  });<br><br><br>// 2. Sipariş işleme<br>exports.processOrderCreated = functions.pubsub<br>  .topic(&#39;order-created&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const { orderId, customerId, items, total } = message.json;<br>    // Paralel işlemler<br>    await Promise.all([<br>      // Ödeme işlemi<br>      processPayment(orderId, total),<br>      <br>      // Stok güncelleme<br>      updateInventory(items),<br>      <br>      // Fatura oluştur<br>      generateInvoice(orderId),<br>      <br>      // Kargo bildirimi<br>      notifyShipping(orderId)<br>    ]);<br>    // Sipariş onayı mesajı yayınla<br>    await pubsub.topic(&#39;order-confirmed&#39;).publishMessage({<br>      json: { orderId, customerId }<br>    });<br>  });,<br><br><br>  // 3. Sipariş onayı bildirimleri<br>  exports.sendOrderConfirmation = functions.pubsub<br>    .topic(&#39;order-confirmed&#39;)<br>    .onPublish(async (message) =&gt; {<br>      const { orderId, customerId } = message.json;<br>      const customer = await getCustomerInfo(customerId);<br>      await Promise.all([<br>        sendConfirmationEmail(customer.email, orderId),<br>        sendSMS(customer.phone, `Siparişiniz alındı: ${orderId}`),<br>        sendPushNotification(customerId, &#39;Sipariş Onaylandı&#39;)<br>      ]);<br>  });</pre><h3>⚡ Performans ve Best Practices</h3><h3>1. İdempotent Fonksiyonlar Yazın</h3><p>Pub/Sub “at-least-once” delivery sağlar, yani mesaj birden fazla kez gelebilir:</p><pre>exports.processPayment = functions.pubsub<br>  .topic(&#39;payments&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const { orderId, amount } = message.json;<br><br>     // Idempotency kontrolü<br>    const paymentRef = admin.firestore()<br>      .collection(&#39;payments&#39;)<br>      .doc(orderId);<br>    const payment = await paymentRef.get();<br>    <br>    if (payment.exists &amp;&amp; payment.data().status === &#39;completed&#39;) {<br>      functions.logger.info(`Ödeme zaten işlendi: ${orderId}`);<br>      return null;  // Tekrar işleme<br>    }<br>    // Ödeme işle<br>    await processPaymentAPI(orderId, amount);<br>    <br>    await paymentRef.set({<br>      orderId,<br>      amount,<br>      status: &#39;completed&#39;,<br>      processedAt: admin.firestore.FieldValue.serverTimestamp()<br>    });<br>  });</pre><h3>2. Error Handling ve Retry</h3><pre>exports.resilientFunction = functions.pubsub<br>  .topic(&#39;critical-task&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const maxRetries = 3;<br>    let attempt = 0;<br><br>    while (attempt &lt; maxRetries) {<br>      try {<br>        await performCriticalTask(message.json);<br>        functions.logger.info(`✅ İşlem başarılı (deneme: ${attempt + 1})`);<br>        return null;<br>      } catch (error) {<br>        attempt++;<br>        functions.logger.error(`❌ Hata (deneme ${attempt}/${maxRetries}):`, error);<br>        if (attempt === maxRetries) {<br>          // Son denemede de başarısız<br>          await sendAlert({<br>            type: &#39;critical_failure&#39;,<br>            message: `Task failed after ${maxRetries} attempts`,<br>            data: message.json,<br>            error: error.message<br>          });<br>          <br>          // Dead letter queue&#39;ya gönder<br>          await pubsub.topic(&#39;dead-letter-queue&#39;).publishMessage({<br>            json: {<br>              originalTopic: &#39;critical-task&#39;,<br>              data: message.json,<br>              error: error.message,<br>              attempts: maxRetries<br>            }<br>          });<br>        }<br>      }<br>    }<br>  });</pre><h3>3. Batching (Toplu İşlem)</h3><p>Birden fazla mesajı birleştirip tek seferde işleyin:</p><pre>// Her mesajda ayrı publish yerine<br>const messages = orders.map(order =&gt; ({<br>  json: order<br>}));<br><br>// Toplu publish<br>await pubsub.topic(&#39;orders&#39;).publishMessage(messages);</pre><h3>4. Timeout Ayarları</h3><pre>exports.longRunningTask = functions<br>  .runWith({<br>    timeoutSeconds: 540,  // 9 dakika (max)<br>    memory: &#39;2GB&#39;<br>  })<br>  .pubsub.topic(&#39;heavy-processing&#39;)<br>  .onPublish(async (message) =&gt; {<br>    // Uzun süren işlem<br>  });</pre><h3>🆚 Pub/Sub vs HTTP: Hangisini Seçmeli?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beMITKz_dgvW3OLbOclQOw.png" /></figure><p><strong>Ne zaman Pub/Sub?</strong></p><ul><li>✅ İşlem 30+ saniye sürüyor</li><li>✅ Kullanıcı beklemeyecek</li><li>✅ Background job gerekiyor</li><li>✅ Yüksek güvenilirlik şart</li></ul><p><strong>Ne zaman HTTP?</strong></p><ul><li>✅ Hızlı yanıt gerekli (&lt;5 saniye)</li><li>✅ Kullanıcı sonucu görmeli</li><li>✅ Real-time feedback</li><li>✅ CRUD operasyonları</li></ul><h3>🎯 Karar Ağacı</h3><pre>İşlem 30 saniyeden fazla mı?<br>    ├─ Evet → Pub/Sub kullan<br>    └─ Hayır<br>        │<br>        Kullanıcı sonucu beklemeli mi?<br>            ├─ Hayır → Pub/Sub (daha iyi UX)<br>            └─ Evet → HTTP</pre><p><strong>Altın Kural:</strong> Zaman alan ve kullanıcının beklemesine gerek olmayan işlemler için Pub/Sub, anında yanıt gereken işlemler için HTTP tercih edin.</p><h3><strong>💰 Maliyet Analizi</strong></h3><h3>Pub/Sub Fiyatlandırma</h3><ul><li>İlk 10 GB/ay: <strong>Ücretsiz</strong></li><li>Sonrası: <strong>$0.40 / 10 GB</strong></li></ul><h3>Örnek Hesaplama</h3><p><strong>Senaryo:</strong> Aylık 1 milyon sipariş işleme</p><pre>Mesaj boyutu: ~2 KB<br>Toplam veri: 1M * 2 KB = 2 GB<br>Maliyet: Ücretsiz (10 GB altı)</pre><p><strong>Senaryo:</strong> Aylık 10 milyon e-posta bildirimi</p><pre>Mesaj boyutu: ~1 KB<br>Toplam veri: 10M * 1 KB = 10 GB<br>Maliyet: Ücretsiz</pre><p><strong>Senaryo:</strong> Aylık 100 milyon analytics eventi</p><pre>Mesaj boyutu: ~500 bytes<br>Toplam veri: 100M * 0.5 KB = 50 GB<br>Ek veri: 50 GB - 10 GB = 40 GB<br>Maliyet: (40 / 10) * $0.40 = $1.60</pre><h3>Firebase Functions Maliyeti</h3><ul><li>İlk 2M çağrı: <strong>Ücretsiz</strong></li><li>Sonrası: <strong>$0.40 / 1M çağrı</strong></li><li>İlk 400K GB-saniye: <strong>Ücretsiz</strong></li><li>Sonrası: <strong>$0.0000025 / GB-saniye</strong></li></ul><p><strong>Toplam örnek:</strong></p><pre>1M Pub/Sub mesajı + 1M function çağrısı<br>= $0 (her ikisi de ücretsiz limitte)</pre><h3>🐛 Debugging ve Monitoring</h3><h3>Local Test (Emulator)</h3><pre># Emulator&#39;ı başlat<br>firebase emulators:start --only functions,pubsub</pre><pre># Mesaj gönder<br>curl -X POST <a href="http://localhost:5001/YOUR-PROJECT/us-central1/publishMessage">http://localhost:5001/YOUR-PROJECT/us-central1/publishMessage</a> \<br>  -H &quot;Content-Type: application/json&quot; \ <br>  -d &#39;{&quot;message&quot;:&quot;Test mesajı&quot;,&quot;topic&quot;:&quot;test-topic&quot;}&#39;</pre><h3>Production Logları</h3><pre># Tüm logları göster<br>firebase functions:log</pre><pre># Gerçek zamanlı takip<br>firebase functions:log --tail</pre><pre># Son 100 log<br>firebase functions:log --limit 100</pre><pre># Belirli fonksiyon<br>firebase functions:log --only processOrder</pre><pre># Hata logları<br>firebase functions:log --only error</pre><h3>Cloud Console’da Monitoring</h3><ol><li><a href="https://console.firebase.google.com/">Firebase Console</a> → Functions</li><li>Fonksiyonu seçin</li><li>Metrikleri görün:</li></ol><ul><li>Invocation count (çağrı sayısı)</li><li>Execution time (çalışma süresi)</li><li>Memory usage (bellek kullanımı)</li><li>Error rate (hata oranı)</li></ul><h3>Topic ve Subscription Kontrolü</h3><pre># Topic listesi<br>gcloud pubsub topics list</pre><pre># Subscription listesi<br>gcloud pubsub subscriptions list</pre><pre># Topic detayları<br>gcloud pubsub topics describe orders</pre><pre># Subscription detayları<br>gcloud pubsub subscriptions describe SUBSCRIPTION-NAME</pre><pre># Pending mesajları kontrol et<br>gcloud pubsub subscriptions describe SUBSCRIPTION-NAME \<br>  --format=&quot;value(numUndeliveredMessages)&quot;</pre><h3>Custom Monitoring</h3><pre>exports.monitoredFunction = functions.pubsub<br>  .topic(&#39;orders&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const startTime = Date.now();<br>    <br>    try {<br>      await processOrder(message.json);<br>      <br>      const duration = Date.now() - startTime;<br>      <br>      // Custom metrik<br>      functions.logger.info(&#39;Performance metric&#39;, {<br>        functionName: &#39;processOrder&#39;,<br>        duration,<br>        success: true,<br>        orderId: message.json.orderId<br>      });<br>      <br>    } catch (error) {<br>      const duration = Date.now() - startTime;<br>      <br>      functions.logger.error(&#39;Error metric&#39;, {<br>        functionName: &#39;processOrder&#39;,<br>        duration,<br>        success: false,<br>        error: error.message,<br>        orderId: message.json?.orderId<br>      });<br>      <br>      throw error;<br>    }<br>  });</pre><h3>🔒 Güvenlik Best Practices</h3><h3>1. Topic İsimlendirme</h3><pre>// ❌ Kötü<br>topic(&#39;user-data&#39;)<br>topic(&#39;payments&#39;)<br><br>// ✅ İyi (environment prefix)<br>topic(`${env}-user-data`)  // prod-user-data, dev-user-data<br>topic(`${env}-payments`)</pre><h3>2. Mesaj Validasyonu</h3><pre>const Joi = require(&#39;joi&#39;);<br><br>const orderSchema = Joi.object({<br>  orderId: Joi.string().required(),<br>  customerId: Joi.string().required(),<br>  total: Joi.number().positive().required(),<br>  items: Joi.array().min(1).required()<br>});<br>exports.processOrder = functions.pubsub<br>  .topic(&#39;orders&#39;)<br>  .onPublish(async (message) =&gt; {<br>    // Validasyon<br>    const { error, value } = orderSchema.validate(message.json);<br>    <br>    if (error) {<br>      functions.logger.error(&#39;Geçersiz mesaj formatı:&#39;, error.details);<br>      return null;  // Retry yapma<br>    }<br>    <br>    // Güvenli veriyle devam et<br>    await processValidOrder(value);<br>  });</pre><h3>3. Sensitive Data Şifreleme</h3><pre>const crypto = require(&#39;crypto&#39;);<br><br>function encryptData(data, key) {<br>  const cipher = crypto.createCipher(&#39;aes-256-cbc&#39;, key);<br>  let encrypted = cipher.update(JSON.stringify(data), &#39;utf8&#39;, &#39;hex&#39;);<br>  encrypted += cipher.final(&#39;hex&#39;);<br>  return encrypted;<br>}<br><br>function decryptData(encrypted, key) {<br>  const decipher = crypto.createDecipher(&#39;aes-256-cbc&#39;, key);<br>  let decrypted = decipher.update(encrypted, &#39;hex&#39;, &#39;utf8&#39;);<br>  decrypted += decipher.final(&#39;utf8&#39;);<br>  return JSON.parse(decrypted);<br>}<br><br>// Publish<br>const encryptionKey = functions.config().encryption.key;<br>const encrypted = encryptData(sensitiveData, encryptionKey);<br>await pubsub.topic(&#39;secure-topic&#39;).publishMessage({<br>  data: Buffer.from(encrypted)<br>});<br><br>// Consume<br>exports.handleSecureData = functions.pubsub<br>  .topic(&#39;secure-topic&#39;)<br>  .onPublish((message) =&gt; {<br>    const encryptionKey = functions.config().encryption.key;<br>    const encrypted = Buffer.from(message.data, &#39;base64&#39;).toString();<br>    const data = decryptData(encrypted, encryptionKey);<br>    <br>    // Şifresi çözülmüş veriyle çalış<br>  });</pre><h3>4. Rate Limiting</h3><pre>const rateLimiter = {};<br><br>exports.rateLimitedFunction = functions.pubsub<br>  .topic(&#39;api-calls&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const userId = message.json.userId;<br>    const now = Date.now();<br>    <br>    // Son 1 dakikadaki istekler<br>    if (!rateLimiter[userId]) {<br>      rateLimiter[userId] = [];<br>    }<br>    <br>    // Eski kayıtları temizle<br>    rateLimiter[userId] = rateLimiter[userId].filter(<br>      timestamp =&gt; now - timestamp &lt; 60000<br>    );<br>    <br>    // Limit kontrolü (dakikada max 100)<br>    if (rateLimiter[userId].length &gt;= 100) {<br>      functions.logger.warn(`Rate limit aşıldı: ${userId}`);<br>      return null;<br>    }<br>    <br>    rateLimiter[userId].push(now);<br>    <br>    // İşleme devam et<br>    await processRequest(message.json);<br>  });</pre><h3>❓ Sık Sorulan Sorular</h3><h3>S: Mesaj sırası garantili mi?</h3><p><strong>C:</strong> Hayır. Pub/Sub “at-least-once delivery” sağlar ama mesajlar sırasız gelebilir. Sıralama önemliyse:</p><pre>// Çözüm 1: Sequence number ekle<br>await pubsub.topic(&#39;events&#39;).publishMessage({<br>  json: {<br>    data: eventData,<br>    sequenceNumber: Date.now(),<br>    eventId: generateUniqueId()<br>  }<br>});<br><br>// Consume tarafında sırala<br>exports.processEvents = functions.pubsub<br>  .topic(&#39;events&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const events = await getBufferedEvents();<br>    events.push(message.json);<br>    <br>    // Sequence&#39;a göre sırala<br>    events.sort((a, b) =&gt; a.sequenceNumber - b.sequenceNumber);<br>    <br>    // Sırayla işle<br>    for (const event of events) {<br>      await processEvent(event);<br>    }<br>  });</pre><h3>S: Mesaj ne kadar süre kuyrukta kalır?</h3><p><strong>C:</strong> Default olarak <strong>7 gün</strong>. Ayarlanabilir:</p><pre>gcloud pubsub subscriptions update YOUR-SUBSCRIPTION \<br>  --message-retention-duration=24h</pre><h3>S: Dead Letter Queue nasıl kullanılır?</h3><p><strong>C:</strong> Başarısız mesajlar için yedek topic:</p><pre>exports.mainProcessor = functions.pubsub<br>  .topic(&#39;main-topic&#39;)<br>  .onPublish(async (message) =&gt; {<br>    try {<br>      await processMessage(message.json);<br>    } catch (error) {<br>      // 3 denemeden sonra dead letter&#39;a gönder<br>      if (message.attributes.deliveryAttempt &gt; 3) {<br>        await pubsub.topic(&#39;dead-letter-topic&#39;).publishMessage({<br>          json: {<br>            originalMessage: message.json,<br>            error: error.message,<br>            attempts: message.attributes.deliveryAttempt,<br>            timestamp: new Date().toISOString()<br>          }<br>        });<br>        <br>        return null;  // Retry yapma<br>      }<br>      <br>      throw error;  // Retry yap<br>    }<br>  });<br><br>// Dead letter handler<br>exports.handleDeadLetters = functions.pubsub<br>  .topic(&#39;dead-letter-topic&#39;)<br>  .onPublish(async (message) =&gt; {<br>    // Alert gönder<br>    await sendSlackAlert({<br>      channel: &#39;#critical-errors&#39;,<br>      message: `Dead letter: ${JSON.stringify(message.json)}`<br>    });<br>    <br>    // Database&#39;e kaydet<br>    await admin.firestore()<br>      .collection(&#39;failed-messages&#39;)<br>      .add(message.json);<br>  });</pre><h3>S: Mesaj boyutu limiti nedir?</h3><p><strong>C:</strong> <strong>10 MB</strong> (base64 encoded). Büyük veri için:</p><pre>// Çözüm: Cloud Storage kullan<br>async function publishLargeData(largeData) {<br>  // 1. Storage&#39;a yükle<br>  const bucket = admin.storage().bucket();<br>  const fileName = `temp/${Date.now()}.json`;<br>  const file = bucket.file(fileName);<br>  <br>  await file.save(JSON.stringify(largeData));<br>  <br>  // 2. Sadece referans gönder<br>  await pubsub.topic(&#39;large-data&#39;).publishMessage({<br>    json: {<br>      type: &#39;storage-reference&#39;,<br>      fileName: fileName,<br>      size: Buffer.byteLength(JSON.stringify(largeData))<br>    }<br>  });<br><br>// Consumer<br>exports.processLargeData = functions.pubsub<br>  .topic(&#39;large-data&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const { fileName } = message.json;<br>    <br>    // Storage&#39;dan oku<br>    const bucket = admin.storage().bucket();<br>    const file = bucket.file(fileName);<br>    const [content] = await file.download();<br>    const data = JSON.parse(content.toString());<br>    <br>    // İşle<br>    await processData(data);<br>    <br>    // Temizle<br>    await file.delete();<br>  });</pre><h3>S: Paralel işleme nasıl yapılır?</h3><p><strong>C:</strong> Firebase otomatik olarak paralelleştirir, ancak kontrol edebilirsiniz:</p><pre>// Her mesaj ayrı instance&#39;da işlenir<br>exports.autoParallel = functions.pubsub<br>  .topic(&#39;tasks&#39;)<br>  .onPublish(async (message) =&gt; {<br>    // Bu fonksiyon her mesaj için paralel çalışır<br>    await heavyTask(message.json);<br>  });<br><br>// Manuel partitioning<br>exports.partitionedProcessor = functions.pubsub<br>  .topic(&#39;partitioned-tasks&#39;)<br>  .onPublish(async (message) =&gt; {<br>    const partition = message.attributes.partition;<br>    <br>    // Partition&#39;a göre işle<br>    switch(partition) {<br>      case &#39;A&#39;:<br>        await processPartitionA(message.json);<br>        break;<br>      case &#39;B&#39;:<br>        await processPartitionB(message.json);<br>        break;<br>    }<br>  });</pre><h3>S: Local development nasıl yapılır?</h3><p><strong>C:</strong> Firebase Emulator Suite:</p><pre>// firebase.json<br>{<br>  &quot;emulators&quot;: {<br>    &quot;functions&quot;: {<br>      &quot;port&quot;: 5001<br>    },<br>    &quot;pubsub&quot;: {<br>      &quot;port&quot;: 8085<br>    }<br>  }<br>}</pre><pre># Başlat<br>firebase emulators:start<br><br># Test<br>curl -X POST http://localhost:5001/YOUR-PROJECT/us-central1/publishMessage \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;message&quot;:&quot;Test&quot;,&quot;topic&quot;:&quot;test-topic&quot;}&#39;</pre><h3>🎯 Production Checklist</h3><p>Deploy etmeden önce kontrol edin:</p><h3>Kod Kalitesi</h3><ul><li>[ ] Error handling tüm fonksiyonlarda var</li><li>[ ] İdempotent fonksiyonlar (duplicate mesaj kontrolü)</li><li>[ ] Input validasyonu yapılıyor</li><li>[ ] Timeout değerleri ayarlanmış</li><li>[ ] Memory limitleri optimize edilmiş</li></ul><h3>Güvenlik</h3><ul><li>[ ] Sensitive data şifreleniyor</li><li>[ ] Topic isimleri environment prefix’li</li><li>[ ] Rate limiting implementasyonu var</li><li>[ ] Mesaj validasyonu aktif</li></ul><h3>Monitoring</h3><ul><li>[ ] Structured logging kullanılıyor</li><li>[ ] Error alertleri ayarlanmış</li><li>[ ] Dead letter queue tanımlı</li><li>[ ] Metrics tracking var</li></ul><h3>Maliyet</h3><ul><li>[ ] Unnecessary retry’lar önlenmiş</li><li>[ ] Mesaj boyutları optimize edilmiş</li><li>[ ] Batch processing düşünülmüş</li><li>[ ] Timeout değerleri gereksiz uzun değil</li></ul><h3>Testing</h3><ul><li>[ ] Local emulator’da test edildi</li><li>[ ] Staging environment’ta test edildi</li><li>[ ] Load testing yapıldı</li><li>[ ] Failure scenarios test edildi</li></ul><h3>🚀 Sonraki Adımlar</h3><p><strong>1. GitHub Deposunu Klonlayın</strong></p><pre>git clone git@github.com:senafrakara/FIREBASE_PUBSUB_EXAMPLE.git</pre><p><strong>2. Local’de Deneyin</strong></p><pre>cd firebase-pubsub-example/functions<br>npm install<br>firebase emulators:start</pre><p><strong>3. Kendi Senaryonuzu Oluşturun</strong></p><ul><li>Hangi asenkron işlemlere ihtiyacınız var?</li><li>Hangi topic’leri oluşturmalısınız?</li><li>Publisher ve consumer fonksiyonlarını yazın</li></ul><p><strong>4. Deploy Edin</strong></p><pre>firebase deploy --only functions</pre><p><strong>5. Monitor Edin</strong></p><ul><li>Firebase Console’da logları izleyin</li><li>Cloud Monitoring’de metrikleri takip edin</li><li>Error alert’leri kurun</li></ul><h3>📚 Ek Kaynaklar</h3><h3>Resmi Dokümantasyon</h3><ul><li><a href="https://firebase.google.com/docs/functions">Firebase Functions</a></li><li><a href="https://cloud.google.com/pubsub/docs">Google Cloud Pub/Sub</a></li><li><a href="https://cloud.google.com/pubsub/docs/publisher">Pub/Sub Best Practices</a></li></ul><h3>Faydalı Araçlar</h3><ul><li><a href="https://cloud.google.com/pubsub/docs/emulator">Pub/Sub Emulator</a></li><li><a href="https://firebase.google.com/docs/cli">Firebase CLI</a></li><li><a href="https://console.cloud.google.com/">Cloud Console</a></li></ul><h3>İleri Seviye Konular</h3><ul><li><a href="https://cloud.google.com/architecture/event-driven-architecture">Event-Driven Architecture</a></li><li><a href="https://cloud.google.com/solutions/microservices-with-pubsub">Microservices with Pub/Sub</a></li><li><a href="https://cloud.google.com/solutions/stream-analytics">Streaming Analytics</a></li></ul><h3>🎓 Özet</h3><p>Bu yazıda Firebase Cloud Functions ile Google Cloud Pub/Sub entegrasyonunu derinlemesine inceledik:</p><p>✅ <strong>Pub/Sub’ın ne olduğunu</strong> ve neden HTTP’den daha iyi olduğunu öğrendik<br> ✅ <strong>Topic oluşturma</strong> yöntemlerini gördük<br> ✅ <strong>Mesaj yayınlama</strong> (string, JSON, attributes) yöntemlerini uyguladık<br> ✅ <strong>Mesaj işleme</strong> (consuming) tekniklerini öğrendik<br> ✅ <strong>Gerçek dünya senaryolarını</strong> (sipariş işleme, kullanıcı kaydı, resim işleme) inceledik<br> ✅ <strong>Best practices</strong> ve güvenlik önlemlerini uyguladık<br> ✅ <strong>Debugging ve monitoring</strong> stratejilerini öğrendik</p><p><strong>Pub/Sub ile:</strong></p><ul><li>Kullanıcı deneyimi bozulmaz (asenkron işleme)</li><li>Sistem daha güvenilir (message guarantee)</li><li>Mimari daha esnek (loose coupling)</li><li>Maliyet optimize edilir (otomatik scaling)</li></ul><p>Artık kendi projelerinizde Pub/Sub kullanmaya hazırsınız! Tüm örnekleri <a href="https://github.com/senafrakara/FIREBASE_PUBSUB_EXAMPLE">GitHub reposundan</a> inceleyebilir ve kendi ihtiyaçlarınıza göre uyarlayabilirsiniz.</p><h3>💬 Sorularınız mı var?</h3><p>Yorumlarda buluşalım! Pub/Sub kullanımıyla ilgili deneyimlerinizi ve sorularınızı paylaşın.</p><p><strong>Faydalı olduysa</strong> 👏 alkışlamayı ve paylaşmayı unutmayın!</p><p><strong>Etiketler:</strong> #Firebase #CloudFunctions #PubSub #Serverless #EventDrivenArchitecture #Microservices #GoogleCloud #NodeJS #BackendDevelopment #Asynchronous</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5165afa31e93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Laravel + React + MySQL Projesini Heroku’ya Deploy Etmek: Adım Adım Rehber]]></title>
            <link>https://medium.com/@senafrakara/laravel-react-mysql-projesini-herokuya-deploy-etmek-ad%C4%B1m-ad%C4%B1m-rehber-27050dbf1402?source=rss-671e98f161f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/27050dbf1402</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[vitejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Nursena Karakulah]]></dc:creator>
            <pubDate>Sun, 18 May 2025 19:04:56 GMT</pubDate>
            <atom:updated>2025-05-18T19:04:56.675Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ykqY8G9TVpzcmy56y4XzCg.png" /></figure><p>Fullstack bir projeni Heroku’ya taşımak mı istiyorsun?</p><p>Bu rehberde kodlaması tamamlanmış Laravel + React (Vite) projesini <strong>tek bir monorepo</strong> yapısıyla Heroku’ya nasıl deploy edeceğini adım adım anlatacağım.</p><p>İçeriğinde:</p><ul><li><strong>Laravel + React (Vite)</strong> projesini tek bir monorepo olarak Heroku’ya nasıl deploy edeceğini,</li><li><strong>ClearDB MySQL</strong> entegrasyonunu,</li><li><strong>Heroku buildpack</strong> ayarlarını ve</li><li>Yayına alma sonrası yapılması gereken kontrolleri bulacaksın.</li></ul><h4>📁 Proje Yapısı (Monorepo)</h4><p>Projemiz Laravel + React’ten oluşan birleşik (monorepo) bir yapıda. React uygulaması Laravel içerisinde resources/js dizininde yer alır ve <strong>Laravel Mix ya da Vite ile derlenip</strong> public/ klasöründe servis edilir.</p><pre>my-project/<br>├── app/<br>├── public/<br>│   └── index.php<br>├── resources/<br>│   └── js/       &lt;-- React uygulaması burada<br>├── routes/<br>├── .env<br>├── composer.json<br>├── package.json<br>└── vite.config.js / webpack.mix.js</pre><h4>1️⃣ Heroku Hesabı Oluştur ve CLI Kur</h4><p>🔗 <a href="https://signup.heroku.com/">https://signup.heroku.com/</a> üzerinden ücretsiz hesap oluştur.</p><h4>✅ Heroku CLI Kurulumu</h4><ul><li><strong>macOS</strong>:</li></ul><pre>brew tap heroku/brew &amp;&amp; brew install heroku</pre><ul><li><strong>Windows / Linux</strong>:<br> <a href="https://devcenter.heroku.com/articles/heroku-cli">Heroku CLI Kurulumu</a>: <a href="https://devcenter.heroku.com/articles/heroku-cli">https://devcenter.heroku.com/articles/heroku-cli</a></li></ul><p>Kurulum sonrası giriş yap:</p><pre>heroku login</pre><h4>2️⃣ Laravel Projesini Hazırla</h4><h4>📦 Composer Bağımlılıkları</h4><pre>composer install --no-dev --optimize-autoloader</pre><h4>📂 Storage ve Cache Ayarları</h4><pre>php artisan storage:link<br>php artisan config:cache<br>php artisan route:cache<br>php artisan view:cache<br>php artisan key:generate</pre><h4>🗂️ Git Repo Başlat ve İlk Commit</h4><pre>git init<br>git add .<br>git commit -m &quot;Commit message&quot;</pre><h4>3️⃣ Heroku App ve MySQL Veritabanı Oluştur</h4><h4>🔧 App Oluştur</h4><pre>heroku create my-fullstack-app</pre><h4>🛠 ClearDB MySQL Eklentisini Ekle</h4><p>Heroku’nun varsayılan veritabanı PostgreSQL olsa da biz MySQL kullanacağız. Bunun için ClearDB eklentisini kullanmamız gerekiyor. ClearDB MySQL eklentisini Heroku’ya eklemek için terminalde şu komutu çalıştırın:</p><pre>heroku addons:create cleardb:ignite</pre><h4>🔗 Veritabanı Bilgilerini Al</h4><pre>heroku config | grep CLEARDB_DATABASE_URL</pre><p>Çıktı şöyle bir şey olur:</p><pre>mysql://username:password@host/database_name?reconnect=true</pre><p>Bu bağlantıyı .env dosyana parçalayarak ekleyin:</p><pre>DB_CONNECTION=mysql<br>DB_HOST=host<br>DB_PORT=3306<br>DB_DATABASE=database_name<br>DB_USERNAME=username<br>DB_PASSWORD=password</pre><p>Alternatif olarak Heroku config’e doğrudan set edebilirsin:</p><pre>heroku config:set DB_CONNECTION=mysql DB_HOST=host DB_DATABASE=xxx DB_USERNAME=xxx DB_PASSWORD=xxx</pre><h4>4️⃣ <strong>Frontend (Vite + React) Derleme Ayarları</strong></h4><h4>🛠 Heroku Deploy Script (heroku-deploy.sh)</h4><p>Laravel ve Vite ile React projenizi aynı repo içinde yönetiyorsanız, frontend’i üretim modunda build etmek için npm run build komutunu kullanacaksınız. Heroku’da bu işlemin otomatik yapılabilmesi için heroku-deploy.sh adında bir script dosyası oluşturacağız.</p><pre># Optimize Composer autoloader<br>composer install --optimize-autoloader --no-dev<br><br># Generate application key if not already set<br>if [ -z &quot;$APP_KEY&quot; ]; then<br>  php artisan key:generate --force<br>fi<br>php artisan migrate<br><br># Clear and cache configurations<br>php artisan config:clear<br>php artisan config:cache<br><br># Cache routes<br>php artisan route:cache<br><br># Clear and cache views<br>php artisan view:clear<br>php artisan view:cache<br><br># Run migrations (use with caution in production)<br>php artisan migrate --force<br><br># Install NPM dependencies and build assets<br>npm ci<br>if [[ &quot;$APP_ENV&quot; == &quot;production&quot; ]]; then<br>    npm run build<br>fi<br>echo &quot;Heroku deployment setup complete!&quot;</pre><p>Bu dosyayı proje kök dizinine koyun ve çalıştırılabilir hale getirin:</p><pre>chmod +x heroku-deploy.sh</pre><h4>📝 Procfile Dosyası</h4><p>Heroku, PHP projeleri için Procfile dosyası arar. Bu dosyada, uygulamanın nasıl başlatılacağı belirtilir.</p><p>Kök dizine Procfile adında dosya oluştur.Procfile içeriği şöyle olmalı:</p><pre>web: vendor/bin/heroku-php-apache2 public/</pre><p>Eğer özel Apache ayarları yapmayacaksanız -C apache.conf kısmını kaldırabilirsiniz.</p><h4>⚙️ .htaccess (public/.htaccess)</h4><p>Vite ile build edilen dosyaların doğru şekilde yüklenebilmesi için public/.htaccess dosyasında bazı düzenlemeler gerekir.</p><p>Dosya içeriği şu şekilde olabilir:</p><pre>&lt;IfModule mod_rewrite.c&gt;<br>    RewriteEngine On<br>    RewriteCond %{REQUEST_FILENAME} !-f<br>    RewriteCond %{REQUEST_FILENAME} !-d<br>    RewriteRule ^ index.php [QSA,L]<br>&lt;/IfModule&gt;<br>&lt;IfModule mod_mime.c&gt;<br>    AddType application/javascript .js<br>    AddType text/css .css<br>&lt;/IfModule&gt;</pre><p>Bu ayarlar sayesinde React uygulamanızın derlenmiş build/assets içeriği düzgün şekilde sunulur.</p><h4>⚙️ <strong>Heroku Buildpacks Ayarları</strong></h4><p>Laravel projeleri için genellikle PHP buildpack kullanılır. Hem PHP hem Node.js kullanıldığı için iki farklı buildpack tanımlanmalı:</p><p>Ek olarak nodejs ve composer buildpack’lerini sıralı şekilde ekle:</p><pre>heroku buildpacks:clear<br>heroku buildpacks:add --index 1 heroku/nodejs<br>heroku buildpacks:add --index 2 heroku/php</pre><blockquote>Node.js en üstte ( — index 1) olacak şekilde eklenmelidir.<em>Böylece önce </em><em>npm run build</em> yapılacak, sonra PHP çalışacaktır.</blockquote><h4>5️⃣ Frontend (Vite + React) Build İşlemi</h4><h4>🔧 vite.config.js Ayarı</h4><ul><li>vite çıktıyı public/build altına yazar. vite.config.js&#39;te build.outDir tanımlanabilir.</li></ul><pre>import { defineConfig } from &#39;vite&#39;<br>import react from &#39;@vitejs/plugin-react&#39;<br><br>export default defineConfig({<br>  base: &#39;/&#39;,<br>  plugins: [react()],<br>})</pre><h4>📄 .env</h4><pre>APP_URL=https://your-app-name.herokuapp.com<br>ASSET_URL=https://your-app-name.herokuapp.com<br></pre><h4>6️⃣ Uygulamayı Yayınla</h4><p>React frontend’iniz için yeni bir üretim (production) derlemesi oluşturduğunuzdan emin olun.</p><p>Derleme komutunu local olarak çalıştırın:</p><pre>npm run build</pre><p>build klasörünün production için doğru dosyaları içerdiğini doğrulayın.</p><h4>📤 Push Et</h4><pre>git add .<br>git commit -m &quot;Prepare for deploy&quot;<br>git push heroku main</pre><h4>🚀 Deploy Script’i Çalıştır</h4><p>Deploy sonrası bash’e bağlanıp heroku-deploy.sh script’ini çalıştırın:</p><pre>heroku run bash<br>./heroku-deploy.sh</pre><blockquote>Laravel Mix build işlemi Heroku’da otomatik yapılır (npm run prod gibi).</blockquote><p>Heroku uygulamanız <a href="https://your-app-name.herokuapp.com/">https://your-app-name.herokuapp.com</a> adresinde yayına alınmış olmalı.</p><p>Eğer CSS veya JS yüklenmiyorsa:</p><ul><li>vite.config.js,</li><li>Procfile,</li><li>public/.htaccess<br> dosyalarını kontrol et.</li></ul><h3>📎 Özet</h3><p><strong>Adım adım;</strong></p><ol><li>Heroku CLI kurulumu ve giriş</li></ol><p>2. Laravel Mix ile React build</p><p>3. Buildpack ayarları</p><p>4 .ClearDB (MySQL) kurulumu</p><p>5. .env veritabanı ayarları</p><p>6. Git push ile deploy</p><p>7. Laravel php artisan migrate</p><h3>✍️ Kapanış</h3><p>Bu makalede, Laravel + React + MySQL monorepo yapısındaki bir projeyi Heroku’ya <strong>tek bir uygulama</strong> olarak nasıl deploy edeceğini tüm detaylarıyla anlattım.</p><p>👉 Eğer bu yazı işine yaradıysa beğenip paylaşmayı unutma!<br> 💬 Yorumlarda deploy sürecini paylaşabilir veya karşılaştığın sorunları sorabilirsin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27050dbf1402" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EAS Build ile React Native Expo CLI Kullanarak Android APK Oluşturma]]></title>
            <link>https://medium.com/@senafrakara/eas-build-ile-react-native-expo-cli-kullanarak-android-apk-olu%C5%9Fturma-b3c93175a1c0?source=rss-671e98f161f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3c93175a1c0</guid>
            <category><![CDATA[build]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[expo-cli]]></category>
            <category><![CDATA[ea]]></category>
            <dc:creator><![CDATA[Nursena Karakulah]]></dc:creator>
            <pubDate>Wed, 21 Aug 2024 20:23:24 GMT</pubDate>
            <atom:updated>2024-08-21T20:23:24.885Z</atom:updated>
            <content:encoded><![CDATA[<p>Expo/React Native projenizi build etmek hiç bu kadar kolay olmamıştı. Expo CLI ve EAS (Expo Application Services) ile geliştirdiğiniz uygulamayı fiziksel cihazlarda test etmek için gerekli APK ve IPA dosyalarını elde etmek son derece basit bir hale geliyor. <a href="https://docs.expo.dev/eas-update/getting-started/">EAS, Expo’nun bulut tabanlı servis hizmetidir</a> ve QR kodları ya da linkler aracılığıyla bu süreci hızlı ve sorunsuz bir şekilde gerçekleştirmenizi sağlar.</p><p>Bu yazımızda, EAS ve Expo CLI kullanarak Android cihazlar için projenizi nasıl build edebileceğinizi ve APK dosyasını nasıl elde edebileceğinizi detaylı bir şekilde ele alacağız. İster yeni bir projeye başlayın, ister mevcut uygulamanızı test edin, bu rehber sayesinde adım adım nasıl ilerleyeceğinizi keşfedeceksiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*p_D1bGrAL8TqmiFmxBQfkw.png" /><figcaption>Expo</figcaption></figure><p>React Native/Expo ile uygulamanızı geliştirdiğinizi farz edelim. Tüm bu süreçte Node.js ve Expo kurulumunu gerçekleştirdiğinizi varsayıyoruz. Sıra build almaya geldi.</p><p>Öncelikle EAS CLI’yı kurmanız gerekiyor. EAS CLI, Expo paketine dahildir, indirmek için yarn veya npm kullanabilirsiniz. EAS CLI hakkında daha detaylı bilgi edinmek için <a href="https://docs.expo.dev/build/introduction/">dökümanını</a> inceleyebilirsiniz.</p><p>Npm ile global olarak indirmek için aşağıdaki komutu çalıştırmalısınız.</p><pre>npm install -g eas-cli</pre><p><em>Global paket kurulumları için yarn yerine npm kullanmak tavsiye ediliyor.</em></p><p>Kurulum gerçekleştikten sonra EAS’ı kullanmak için Expo hesabınıza giriş yapmanız gerekiyor. Bunun için çalıştırmanız gereken ilgili komut ise:</p><pre>eas login</pre><p>Kullanıcı adınızı ve şifrenizi girdiniz ve login oldunuz. Build için gerekli konfigürasyonları yapmanız gerekiyor şimdi. Bunun için ise şu komutu çalıştırmalısınız:</p><pre>eas build:configure</pre><p>Bu komut, projenizin ana dizininde <em>eas.json</em> dosyasını oluşturacak. Bu dosyada, default olarak 3 adet build profili gelir.</p><pre>{<br>  &quot;build&quot;: {<br>    &quot;development&quot;: {<br>      &quot;developmentClient&quot;: true,<br>      &quot;distribution&quot;: &quot;internal&quot;<br>    },<br>    &quot;preview&quot;: {<br>      &quot;distribution&quot;: &quot;internal&quot;<br>    },<br>    &quot;production&quot;: {}<br>  }<br>}</pre><p>Buradaki profil ayarlarını değiştirebilir veya farklı isimlerle yeni profiller oluşturabilirsiniz. Bu profiller, daha sonrasında build almak için çalıştıracağımız komutta kullanılacak ve böylece belirttiğimiz ayarlarla belirttiğimiz ortam için gerekli işlemleri gerçekleştirecek.</p><h3>Konfigürasyon Dosyaları app.json/app.config.js</h3><p>Expo, projelerde yapılandırma ayarlarını yönetmek için <em>app.json </em>veya<em> app.config.js </em>konfigürasyon dosyalarını kullanır. Default olarak Expo <em>app.json</em> kullanır. Fakat, burada dikkat etmemiz gereken ufak bir nokta var; uzantısından da anladığımız üzere <em>app.json</em>, JSON formatında bir dosyadır ve yapılandırma ayarlarını statik olarak tanımlar. Daha basit ve doğrudan bir yapı sunar, ancak dinamik yapılandırma yeteneği sunmaz. Ancak <em>app.config.js</em>, JavaScript tabanlı bir dosyadır ve dinamik yapılandırma sağlar. Uygulama yapılandırmasını koşullara göre dinamik olarak değiştirmek için JavaScript kodları yazabilirsiniz. Ortam değişkenlerine(environment variables) göre farklı ayarlar yapabilirsiniz.</p><p>Şimdi bunu biraz daha detaylandırarak daha anlaşılır hale getirelim. Local development için projemizde, uygulama yapılandırmaları ve gizli bilgileri yönetmek için .env dosyasını kullanırız. Genellikle environment variable’larını depolamak için ve development, production gibi çeşitli ortamlar arasındaki farklı ayarları yönetmek için kullanılır. Expo projenizde, .env dosyanıza dahil etmek istediğiniz bu bilgileri EXPO_PUBLIC slug’ını kullanarak yapmalısınız. Örneğin;</p><pre>EXPO_PUBLIC_API_URL=http://api.test.com</pre><p>Proje içerisinde bunları kullanmak istediğinizdeyse, <em>process.env.EXPO_PUBLIC_API_URL</em> şeklinde kullanabilirsiniz. Proje içinde kullanmak için aynı zamanda extra değişkeni altında <em>app.json</em> dosyasına da ortam değişkenlerinizi ekleyebilirsiniz.</p><pre>{<br>  &quot;expo&quot;: {<br>    &quot;name&quot;: &quot;App Name&quot;,<br>    &quot;slug&quot;: &quot;App slug&quot;,<br>    &quot;version&quot;: &quot;1.0.0&quot;,<br>    &quot;extra&quot;: {<br>      &quot;apiUrl&quot;: &quot;https://api.test.com&quot;<br>    }<br>  }<br>}</pre><p>Build işlemlerinde kullanılacak ortam değişkenlerini tanımlamak için bu değişkenleri <em>eas.json</em> dosyasına da eklememiz gerekir.</p><pre>{<br>  &quot;build&quot;: {<br>    &quot;production&quot;: {<br>      &quot;env&quot;: {<br>        &quot;EXPO_PUBLIC_API_URL&quot;: &quot;https://api.production.com&quot;<br>      }<br>    },<br>    &quot;test&quot;: {<br>      &quot;env&quot;: {<br>        &quot;EXPO_PUBLIC_API_URL&quot;: &quot;https://api.test.com&quot;<br>      }<br>    }<br>  }<br>}</pre><p>Burada <a href="https://docs.expo.dev/workflow/configuration/#dynamic-configuration">daha fazla özelleştirme ve dinamik konfigürasyon için JavaScript (<em>app.config.js</em>) veya TypeScript (<em>app.config.ts</em>) kullanabiliriz.</a></p><p>Ardından, derleme aşamasında kullanılması üzere, <em>app.json</em> dosyasında yaptığımız gibi, <em>app.config.js</em> dosyasında da envrionment variable’larımızı refere ederiz.</p><pre>const myValue = &#39;App Name&#39;;<br><br>module.exports = {<br>  name: myValue,<br>  version: process.env.MY_CUSTOM_PROJECT_VERSION || &#39;1.0.0&#39;,<br>  extra: {<br>    API_KEY: process.env.EXPO_PUBLIC_API_KEY,<br>    ...<br>  },<br>};</pre><p><a href="https://docs.expo.dev/workflow/configuration/#dynamic-configuration">Bu ortam değişkenlerini proje içerisinde kodumuzda çağırmak için ise </a><a href="https://docs.expo.dev/workflow/configuration/#dynamic-configuration">expo-constants kullanırız</a>.</p><pre>import Constants from &#39;expo-constants&#39;;<br><br>Constants.expoConfig.extra.API_KEY;</pre><h3>Dokunmayın Ağlarım: Aşırı Hassas Ortam Değişkenlerimiz</h3><p>Source code’umuza ya da Git repository’imize yüklemek istemediğimiz çok hassas ortam değişkenlerimizin olduğunu düşünelim. Expo bunu da düşünmüş ve demiş ki sırrını bana ver; expo secrets.</p><p>Oluşturduğumuz secret’lar şifreli bir şekilde aktarılır ve yalnızca Expo server’ları tarafından decrypt edilir. Secret’larınızı, Expo web sitesi üzerinden yönetebilirsiniz.</p><p>Geliştirmek yaparken secret create etmek için <em>eas secret:create </em>komutu çalıştırılır:</p><pre>eas secret:create --scope project --name SECRET_NAME --value secretvalue --type string</pre><p>Varolan tüm secretları görüntülemek için eas secret:list komutunu çalıştırabilirsiniz.</p><p>.env dosyanızdan import etmek istediğinizde ise;</p><pre>eas secret:push --scope project --env-file ./eas/.env</pre><p>Local development için tavsiye edilen best practice<em> .env </em>dosyasını kullanmak olduğu için, eas.json dosyasına eklemek için de fazla hassas olan environment variable’larımızı bu şekilde muhafaza edebiliriz. Build aşamasında kullanılmak üzere bu variable’ları yine<em> app.config.js</em> dosyamızda <em>.env </em>dosyası aracılığıyla refere etmeliyiz.</p><pre>import &#39;dotenv/config&#39;; // .env dosyasını kullanmak için<br><br>export default {<br>  expo: {<br>    name: &quot;App Name&quot;,<br>    slug: &quot;App name &quot;,<br>    version: &quot;1.0.0&quot;,<br>    extra: {<br>      apiKey: process.env.MY_SECRET_KEY, // EAS Secret&#39;ı kullanma<br>    },<br>  },<br>};</pre><h3>Build Zamanı</h3><p><a href="https://docs.expo.dev/build-reference/apk/">APK dosyası generate etmek için <em>eas.json</em> dosyamızın build profile’onda birtakım değişiklikler yapmamız gerekiyor.</a></p><ul><li>developmentClient =true</li><li>distribution =internal</li><li>android.buildType = apk</li><li>android.gradleCommand =:app:assembleRelease, :app:assembleDebug</li></ul><p>Ardından android için, build almak istediğiniz profili belirterek aşağıdaki komutu çalıştırın:</p><pre>eas build -p android --profile &lt;profile_name&gt;</pre><p>Build işlemi başarılı bir şekilde tamamlandıktan sonra apk dosyasını paylaşıp indirmeniz için size bir link ve QR kod verilecek.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0x4gRZIdUtMePUqSRH_QSg.png" /></figure><p>Expo hesabınızdan aldığınız build’leri detaylı olarak görebilirsiniz.</p><p>Android için build alma işleminden ve birkaç ufak noktadan bahsettim bu yazıda. Sormak istediğiniz herhangi bir şey olduğu noktada bana <a href="https://www.linkedin.com/in/nursena-karakulah/"><em>linkedin</em></a> hesabım üzerinden ulaşabilirsiniz. <em>Keyifli okumalar 🌸.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3c93175a1c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>