<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Edwin Muhoro</title>
    <description>The latest articles on Forem by Edwin Muhoro (@eddiemuhoro).</description>
    <link>https://forem.com/eddiemuhoro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1066719%2F754d1afc-03ed-44f8-8c31-5f690dc76464.jpeg</url>
      <title>Forem: Edwin Muhoro</title>
      <link>https://forem.com/eddiemuhoro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/eddiemuhoro"/>
    <language>en</language>
    <item>
      <title>🐳 From FastAPI to Production: The Complete Docker Guide for Python Developers</title>
      <dc:creator>Edwin Muhoro</dc:creator>
      <pubDate>Wed, 25 Jun 2025 23:10:55 +0000</pubDate>
      <link>https://forem.com/eddiemuhoro/from-fastapi-to-production-the-complete-docker-guide-for-python-developers-5d4k</link>
      <guid>https://forem.com/eddiemuhoro/from-fastapi-to-production-the-complete-docker-guide-for-python-developers-5d4k</guid>
      <description>&lt;p&gt;Ever struggled with the classic "it works on my machine" problem? Or found yourself manually killing terminals instead of gracefully shutting down your FastAPI servers? Let's dive into a complete Docker setup that will transform your development workflow and prepare you for production!&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;The Problem We're Solving&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Picture this: You've built an amazing FastAPI recruitment portal with PostgreSQL, JWT authentication, and AI-powered features. Your code works perfectly locally, but:&lt;/p&gt;

&lt;p&gt;Setting up the environment is complex for new team members&lt;br&gt;
Database connections get messy when you kill terminals&lt;br&gt;
Production deployment feels like a mystery&lt;br&gt;
Environment variables are scattered everywhere&lt;br&gt;
Enter Docker - your development superhero! 🦸‍♂️&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# docker-compose.yml
services:
  web:                    # Your FastAPI app
    build: .
    ports:
      - "8000:8000"
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - SECRET_KEY=${SECRET_KEY}
      - OPENAI_API_KEY=${OPENAI_API_KEY}
    depends_on:
      - db
    command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload

  db:                     # PostgreSQL database
    image: postgres:15
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:          # Persistent database storage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🏗️ &lt;strong&gt;The Complete Docker Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's what we're building - a multi-container application that Just Works:&lt;/p&gt;

&lt;p&gt;🔧 The Magic Dockerfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM python:3.12-slim

# Essential for Python in containers
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

# Install system dependencies for PostgreSQL
RUN apt-get update \
    &amp;amp;&amp;amp; apt-get install -y --no-install-recommends \
        postgresql-client gcc python3-dev libpq-dev \
    &amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/*

# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔐 &lt;strong&gt;Security First: The Template Approach&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Never commit secrets to Git! Here's the pro way to handle sensitive data:&lt;/p&gt;

&lt;p&gt;What goes in Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# docker-compose.template.yml (safe to commit)
services:
  web:
    environment:
      - DATABASE_URL=${DATABASE_URL}
      - SECRET_KEY=${SECRET_KEY}
      # Template shows structure, not actual values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What stays local:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# .env (NEVER commit this)
DATABASE_URL=postgresql://user:pass@localhost/db
SECRET_KEY=super-secret-jwt-key
OPENAI_API_KEY=sk-your-actual-key
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your .gitignore:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Ignore the real compose file with secrets
docker-compose.yml
.env
.env.*

# But allow the template
!docker-compose.template.yml
!.env.example
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚡ &lt;strong&gt;The Developer Experience Revolution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# The painful way 😤
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Start PostgreSQL somehow...
# Set 15 environment variables...
# Kill terminal when done (bad!)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# The magical way ✨
docker compose up --build
# Everything just works!

# Graceful shutdown
docker compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🛠️ &lt;strong&gt;Essential Docker Commands Every Developer Needs&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Development workflow
docker compose up --build        # Start with rebuild
docker compose up -d            # Background mode
docker compose logs -f web      # Follow logs
docker compose down             # Graceful shutdown

# Database operations
docker compose exec db psql -U postgres -d recruitment_db
docker compose down -v          # Fresh start (deletes data)

# Debugging
docker compose ps               # See running services
docker compose exec web bash   # Shell into container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🚨&lt;strong&gt;Common Gotchas &amp;amp; Solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Permission Denied Error?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Add yourself to docker group (one-time setup)
sudo usermod -aG docker $USER
newgrp docker
# Now docker commands work without sudo!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Database Connection Issues?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Check if database is ready
curl http://localhost:8000/db-check
# Should return: {"database": "connected", "result": 1}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Port Already in Use?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Find what's using port 8000
sudo lsof -i :8000
# Kill it or change ports in docker-compose.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🚀 &lt;strong&gt;Production-Ready Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Transform your development setup to production:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# docker-compose.prod.yml
services:
  web:
    command: uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4
    restart: unless-stopped
    # Remove --reload flag for production

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - web
    # Load balancer + SSL termination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 &lt;strong&gt;Pro Tips for FastAPI + Docker&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Graceful Shutdown: Your FastAPI app can run cleanup code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.on_event("shutdown")
async def shutdown_event():
    """Cleanup database connections"""
    cleanup()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Health Checks: Always include health endpoints:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.get("/health")
def health_check():
    return {"status": "healthy"}

@app.get("/db-check") 
def db_check():
    # Test database connectivity
    pass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Environment-Specific Configs: Use different compose files:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Development
docker compose up

# Production  
docker compose -f docker-compose.prod.yml up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🎯 The Bottom Line&lt;br&gt;
Docker transforms your FastAPI development from chaotic to professional:&lt;/p&gt;

&lt;p&gt;✅ Consistent environments across all machines&lt;br&gt;
✅ One-command setup for new developers&lt;br&gt;
✅ Graceful shutdowns preserve data integrity&lt;br&gt;
✅ Production-ready deployment pipeline&lt;br&gt;
✅ Secure secret management with templates&lt;br&gt;
✅ Database included - no manual setup needed&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Ready to Dockerize Your FastAPI App?&lt;/strong&gt;&lt;br&gt;
Start with these files in your project:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Dockerfile&lt;/code&gt; - Your app container&lt;br&gt;
&lt;code&gt;docker-compose.template.yml&lt;/code&gt; - Safe template for Git&lt;br&gt;
&lt;code&gt;.env.example&lt;/code&gt; - Environment variable examples&lt;br&gt;
&lt;code&gt;README-Docker.md&lt;/code&gt; - Setup instructions&lt;br&gt;
Updated &lt;code&gt;.gitignore&lt;/code&gt; - Security first!&lt;br&gt;
Your future self (and your team) will thank you for the professional setup!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Understanding Session Storage, Local Storage, and Cookies in Web Development</title>
      <dc:creator>Edwin Muhoro</dc:creator>
      <pubDate>Sun, 25 Aug 2024 19:59:26 +0000</pubDate>
      <link>https://forem.com/eddiemuhoro/understanding-session-storage-local-storage-and-cookies-in-web-development-1i14</link>
      <guid>https://forem.com/eddiemuhoro/understanding-session-storage-local-storage-and-cookies-in-web-development-1i14</guid>
      <description>&lt;p&gt;In the modern web development landscape, managing client-side storage is crucial for creating efficient and interactive web applications. There are primarily three ways to handle this: session storage, local storage, and cookies. Each method comes with its unique features, advantages, and limitations. In this article, we'll deeply explore these technologies, helping beginners understand their use, differences, and the scenarios in which one might be more suitable over the others.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Client-Side Storage?
&lt;/h2&gt;

&lt;p&gt;Client-side storage allows data to be stored on the user's browser. This data can be used to maintain session information, user preferences, or any other data that needs to be preserved across different pages of a website without having to retrieve it from the server on each page load. This can significantly enhance the performance and user experience of web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Session Storage
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Definition and Use&lt;/strong&gt;: Session storage is used to store data for the duration of the page session. The data stored in session storage gets cleared when the page session ends — this occurs when the user closes the specific tab or window in which the site is opened.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of usage:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Store data in session storage
sessionStorage.setItem('username', 'JohnDoe');

// Retrieve data from session storage
let userName = sessionStorage.getItem('username');

// Remove data from session storage
sessionStorage.removeItem('username');

// Clear all data from session storage
sessionStorage.clear();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tab-specific storage&lt;/strong&gt;: Each open tab has its own isolated instance of session storage, making it ideal for sensitive data that shouldn’t persist beyond the session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;: Clears data automatically at the end of the session, reducing the risk of data leakage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Limited lifespan&lt;/strong&gt;: Data does not persist on closing the tab, which can be a disadvantage if persistent data storage is required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Storage limit&lt;/strong&gt;: Typically allows about 5MB of data, which might be limiting for more complex applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Local Storage
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Definition and Use&lt;/strong&gt;: Local storage provides a way to store data across browser sessions. Data stored in local storage doesn’t expire and remains stored on the user’s browser until explicitly cleared either via scripting or manually by the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of Usage&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Store data in local storage
localStorage.setItem('theme', 'dark');

// Retrieve data from local storage
let theme = localStorage.getItem('theme');

// Remove data from local storage
localStorage.removeItem('theme');

// Clear all data from local storage
localStorage.clear();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Persistence&lt;/strong&gt;: Data persists even after the browser window is closed, ideal for saving user preferences or themes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity&lt;/strong&gt;: Typically allows for larger storage limits than session storage (at least 5MB).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lack of auto-expiry&lt;/strong&gt;: Data needs to be manually managed and cleared, which can lead to potential security risks if sensitive data is stored.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Global access&lt;/strong&gt;: Unlike session storage, local storage is accessible across all tabs and windows with the same origin.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Cookies
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Definition and Use&lt;/strong&gt;: Cookies are data that is stored on the user's computer by the web browser while browsing. Cookies are primarily used for session management, personalization, and tracking user behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example of Usage:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Set a cookie
document.cookie = "username=JohnDoe; expires=Thu, 18 Dec 2023 12:00:00 UTC; path=/";

// Get all cookies
let cookies = document.cookie;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Expiration control&lt;/strong&gt;: Cookies can be set to expire after a certain date or time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP-only cookies&lt;/strong&gt;: Can be configured to be accessible only by the web server, enhancing security.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Size limitation&lt;/strong&gt;: Cookies are limited to about 4KB each.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance impact&lt;/strong&gt;: Every HTTP request includes cookies, which can affect performance if many cookies are used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security risks&lt;/strong&gt;: If not securely handled (e.g., without setting the Secure and HttpOnly attributes), cookies can be susceptible to cross-site scripting (XSS) and cross-site request forgery (CSRF) attacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Which One to Use and When?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use session storage when you need to store sensitive data that should not persist beyond the session and is only relevant to a specific window or tab.&lt;/li&gt;
&lt;li&gt;Use local storage for data that needs to persist across sessions and is not sensitive. It is ideal for storing user preferences or settings that are non-sensitive.&lt;/li&gt;
&lt;li&gt;Use cookies when you need server-side readability of stored data, control over expiration, and for implementing user tracking for analytics.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Understanding the distinctions between session storage, local storage, and cookies is crucial for implementing effective client-side storage solutions in web applications. Each method has its ideal use cases and understanding these will allow you to make informed decisions about storing user data efficiently and securely. Remember, the choice of storage mechanism can greatly impact the functionality, performance, and security of your web applications.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>ui</category>
      <category>react</category>
    </item>
    <item>
      <title>Building Native Applications with Capacitor and ReactJS</title>
      <dc:creator>Edwin Muhoro</dc:creator>
      <pubDate>Sun, 16 Jun 2024 07:53:35 +0000</pubDate>
      <link>https://forem.com/eddiemuhoro/building-native-applications-with-capacitor-and-reactjs-26a1</link>
      <guid>https://forem.com/eddiemuhoro/building-native-applications-with-capacitor-and-reactjs-26a1</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the ever-evolving landscape of software development, the demand for building native applications from web-based code has grown exponentially. Capacitor, a tool created by the team behind Ionic, offers developers a seamless way to create cross-platform native applications using their existing web technologies. In this article, we will explore how to incorporate Capacitor into a ReactJS project to build native mobile applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is Capacitor?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Capacitor is a cross-platform native runtime that allows you to build web applications with JavaScript, TypeScript, or any front-end framework and then deploy them as native mobile apps or Progressive Web Apps (PWAs). It provides a simple and unified API to access native device features and functionalities such as the camera, geolocation, and storage.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started with Capacitor and ReactJS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To start using Capacitor with ReactJS, follow these steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Set Up Your React Project&lt;/strong&gt;&lt;br&gt;
First, you need to create a new React project or navigate to your existing React project directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-capacitor-app
cd my-capacitor-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a new React project named my-capacitor-app and navigates into the project directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Install Capacitor&lt;/strong&gt;&lt;br&gt;
Next, you need to install Capacitor core and the CLI (Command Line Interface). Run the following command in your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @capacitor/core @capacitor/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command installs the core Capacitor library and the CLI, which you will use to interact with Capacitor from the command line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Initialize Capacitor&lt;/strong&gt;&lt;br&gt;
Initialize Capacitor with your project. This will create a &lt;code&gt;capacitor.config.json&lt;/code&gt; file in your project directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cap init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During initialization, you will be prompted to enter your app name and package ID (e.g., &lt;code&gt;com.example.myapp&lt;/code&gt;). The &lt;code&gt;capacitor.config.json&lt;/code&gt; file stores configuration settings for Capacitor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: It’s important to change the package ID to something unique and meaningful for your project. The package ID should follow the reverse domain name notation (e.g., &lt;code&gt;com.yourcompany.yourapp&lt;/code&gt;). This unique identifier is necessary for publishing your app on app stores and helps to distinguish your app from others.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivto384it2rmjaf5oagq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivto384it2rmjaf5oagq.png" alt="Image description" width="598" height="221"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? What is the name of your app? My Capacitor App
? What should be the Package ID? com.yourcompany.yourapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Install and Add Platforms&lt;/strong&gt;&lt;br&gt;
Add the desired platforms (iOS, Android) to your project. This step prepares your project to be built and run on these platforms.&lt;br&gt;
&lt;strong&gt;Install&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;npm install @capacitor/android&lt;br&gt;
npm install @capacitor/android&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cap add ios
npx cap add android
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates the necessary folders and files for iOS and Android projects within your React project directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Build Your React App&lt;/strong&gt;&lt;br&gt;
Before you can run your app on a device or emulator, you need to build your React app. This step compiles your React code into static files that can be served by Capacitor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command generates a build folder containing the static files of your React application. Building the project ensures that the latest version of your app is used when syncing with the native projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6: Sync Your Project&lt;/strong&gt;&lt;br&gt;
After building your React app, sync your web code with the native platform projects. This step copies the built web assets into the native project folders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cap sync
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;npx cap sync&lt;/code&gt; command ensures that the latest version of your web app is included in the native builds and updates any Capacitor plugins and dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Capacitor Plugins
&lt;/h2&gt;

&lt;p&gt;Capacitor comes with a set of plugins to access native device functionalities. Here are a few examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example 1: Using the Camera Plugin&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Step 1: Install the Camera Plugin&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @capacitor/camera
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Import and Use the Camera Plugin in your react code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
import { Camera, CameraResultType } from '@capacitor/camera';

const CameraComponent = () =&amp;gt; {
  const [photo, setPhoto] = useState(null);

  const takePhoto = async () =&amp;gt; {
    const image = await Camera.getPhoto({
      resultType: CameraResultType.Uri,
    });
    setPhoto(image.webPath);
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={takePhoto}&amp;gt;Take Photo&amp;lt;/button&amp;gt;
      {photo &amp;amp;&amp;amp; &amp;lt;img src={photo} alt="Captured" /&amp;gt;}
    &amp;lt;/div&amp;gt;
  );
};

export default CameraComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2: Using the Toast Plugin&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Step 1: Install the Toast Plugin&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @capacitor/toast
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Import and Use the Toast Plugin&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { Toast } from '@capacitor/toast';

const ToastComponent = () =&amp;gt; {
  const showToast = async () =&amp;gt; {
    await Toast.show({
      text: 'Hello from Capacitor!',
    });
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={showToast}&amp;gt;Show Toast&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default ToastComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the App on a Device
&lt;/h2&gt;

&lt;p&gt;To run your app on a device, you need to open the native project in the respective IDEs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;iOS&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cap open ios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will open your iOS project in Xcode. From there, you can run the app on a simulator or a connected device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Android&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx cap open android
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will open your Android project in Android Studio. You can then run the app on an emulator or a connected device.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Capacitor provides a powerful and easy-to-use platform for building native mobile applications using web technologies. By integrating Capacitor with ReactJS, you can leverage your existing web development skills to create robust, cross-platform native applications. This article covered the basics of setting up Capacitor in a React project, using plugins, and running your app on devices. With Capacitor, you can simplify your development workflow and deliver high-quality mobile experiences.&lt;/p&gt;

</description>
      <category>react</category>
      <category>capacitor</category>
      <category>ionic</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Unveiling the Strengths of .NET: Choosing .NET over Node.js</title>
      <dc:creator>Edwin Muhoro</dc:creator>
      <pubDate>Thu, 25 Apr 2024 19:32:25 +0000</pubDate>
      <link>https://forem.com/eddiemuhoro/unveiling-the-strengths-of-net-choosing-net-over-nodejs-44cl</link>
      <guid>https://forem.com/eddiemuhoro/unveiling-the-strengths-of-net-choosing-net-over-nodejs-44cl</guid>
      <description>&lt;p&gt;In the vast landscape of programming languages and frameworks, choosing the right technology stack for your project can be a daunting task. Two popular contenders in the realm of web development are .NET and Node.js. While Node.js has gained significant traction in recent years, .NET remains a robust and powerful framework with its own set of strengths and advantages. In this article, we'll delve into why choosing .NET over Node.js can be a strategic decision for developers and businesses alike.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Basics: .NET vs. Node.js
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Architecture and Ecosystem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;.NET:&lt;/strong&gt; .NET is a mature and versatile framework developed by Microsoft. It provides a unified platform for building various types of applications, including web applications, desktop applications, mobile apps, and more. With .NET, developers can choose from different languages such as C#, F#, and Visual Basic.NET, offering flexibility and scalability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node.js:&lt;/strong&gt; Node.js, on the other hand, is a runtime environment that allows developers to run JavaScript code outside of a web browser. It is known for its event-driven, non-blocking I/O model, making it ideal for building scalable, real-time applications such as chat applications and streaming services.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Performance and Scalability
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;.NET:&lt;/strong&gt; .NET is renowned for its performance and scalability, especially when it comes to building enterprise-level applications. The introduction of .NET Core and its successor, has further enhanced the performance and cross-platform capabilities of .NET applications. With features like Just-In-Time (JIT) compilation and efficient memory management, .NET applications can handle high loads and complex tasks with ease.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node.js:&lt;/strong&gt; Node.js excels in handling I/O-heavy tasks and asynchronous operations, thanks to its non-blocking architecture. This makes it a popular choice for building real-time applications that require high concurrency. However, Node.js may face challenges with CPU-bound tasks, and developers may need to employ clustering or other techniques to achieve scalability for CPU-intensive workloads.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Advantages of Using .NET
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Language and Tooling
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;C# and Visual Studio:&lt;/strong&gt; One of the primary advantages of .NET is the use of languages like C#, which offers strong typing, extensive libraries, and a robust ecosystem. Visual Studio, the integrated development environment (IDE) for .NET, provides powerful tools for code editing, debugging, and performance analysis, enhancing developer productivity and code quality.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Cross-Platform Development
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;.NET Core and .NET Framework:&lt;/strong&gt; With the introduction of .NET Core and its evolution into .NET 8, .NET has become a truly cross-platform framework. Developers can build and deploy .NET applications on Windows, Linux, and macOS, leveraging the same codebase and libraries across different platforms. This versatility is crucial for modern development teams targeting multiple platforms and environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Performance and Optimization
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JIT Compilation and Runtime Performance:&lt;/strong&gt; .NET's Just-In-Time (JIT) compilation optimizes code execution at runtime, leading to improved performance compared to interpreted languages. Additionally, .NET's runtime environment includes features like garbage collection and memory management, reducing memory leaks and optimizing resource utilization.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Enterprise-Ready Solutions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Enterprise Support and Tooling:&lt;/strong&gt; .NET offers comprehensive support and tooling for building enterprise-grade applications. From robust security features to integration with cloud platforms like Azure, .NET provides a solid foundation for developing scalable, reliable, and secure solutions for businesses of all sizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Choose .NET Over Node.js?
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Scalability and Performance
&lt;/h2&gt;

&lt;p&gt;While Node.js excels in handling asynchronous operations and real-time applications, .NET's performance and scalability shine in enterprise-level scenarios and CPU-bound tasks. .NET's mature ecosystem, JIT compilation, and optimized runtime make it a preferred choice for building high-performance applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Language and Development Environment
&lt;/h2&gt;

&lt;p&gt;The use of languages like C# and the feature-rich Visual Studio IDE contribute to a productive and efficient development experience with .NET. Strong typing, comprehensive libraries, and advanced debugging tools empower developers to write maintainable and scalable codebases.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Cross-Platform Capabilities
&lt;/h2&gt;

&lt;p&gt;With the evolution of .NET Core into .NET 5/6, .NET has embraced cross-platform development, allowing developers to target multiple platforms without compromising on performance or features. This flexibility is crucial for modern applications targeting diverse deployment environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Enterprise Support and Ecosystem
&lt;/h2&gt;

&lt;p&gt;.NET's integration with Microsoft's ecosystem, including Azure cloud services, provides seamless deployment, monitoring, and management capabilities for enterprise applications. The robust security features and enterprise-grade tooling make .NET a preferred choice for organizations with complex requirements and regulatory compliance needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In the dynamic landscape of software development, choosing the right framework can significantly impact the success of your projects. While Node.js offers strengths in certain areas such as real-time applications and asynchronous operations, .NET stands out as a powerhouse for enterprise-grade solutions, cross-platform development, and performance-critical applications.&lt;/p&gt;

&lt;p&gt;By leveraging the strengths of .NET, developers and businesses can benefit from a mature ecosystem, robust tooling, cross-platform capabilities, and optimized performance, ultimately leading to faster time-to-market, scalability, and long-term maintainability of applications.&lt;/p&gt;

&lt;p&gt;Whether you are embarking on a new project or considering migration/optimization of existing applications, evaluating the specific requirements, scalability needs, and development preferences can guide you in making an informed choice between .NET and Node.js. Ultimately, both frameworks have their merits, but understanding their strengths and aligning them with your project goals is key to achieving success in today's competitive tech landscape.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>api</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>Building a Full-Stack Application with AWS Amplify and ReactJS</title>
      <dc:creator>Edwin Muhoro</dc:creator>
      <pubDate>Sun, 24 Mar 2024 22:30:02 +0000</pubDate>
      <link>https://forem.com/eddiemuhoro/building-a-full-stack-application-with-aws-amplify-and-reactjs-4kbe</link>
      <guid>https://forem.com/eddiemuhoro/building-a-full-stack-application-with-aws-amplify-and-reactjs-4kbe</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;AWS Amplify is a powerful development platform that enables developers to build scalable full-stack applications. This guide will walk you through creating a ReactJS application with a backend powered by AWS Amplify.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js v10.x or later&lt;/li&gt;
&lt;li&gt;npm or yarn&lt;/li&gt;
&lt;li&gt;AWS Account&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install the Amplify CLI
&lt;/h2&gt;

&lt;p&gt;The Amplify Command Line Interface (CLI) is a unified toolchain to create AWS cloud services for your app. Let's go ahead and install the Amplify CLI.&lt;br&gt;
&lt;code&gt;npm install -g @aws-amplify/cli&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Initializing the Project
&lt;/h2&gt;

&lt;p&gt;Create a new React application and initialize your Amplify project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app amplify-react-app
cd amplify-react-app
npm install -g @aws-amplify/cli
amplify configure
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;amplify configure will prompt you to sign in and add IAM user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frqc9mvlifx06b6e6nsto.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frqc9mvlifx06b6e6nsto.png" alt="Image description" width="658" height="273"&gt;&lt;/a&gt;&lt;br&gt;
Enter your desired username and press Next.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwig24md09cu37hz4l0oa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwig24md09cu37hz4l0oa.png" alt="Image description" width="800" height="374"&gt;&lt;/a&gt;&lt;br&gt;
Select Attach policies directly and select AdministratorAccess-Amplify as the Permissions policy. Select Next&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8glyevv9wu9aebw0xpbw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8glyevv9wu9aebw0xpbw.png" alt="Image description" width="800" height="374"&gt;&lt;/a&gt;&lt;br&gt;
This is the review page. Check if everything is alright and create user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqcxgetga94pewnrore1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuqcxgetga94pewnrore1.png" alt="Image description" width="800" height="374"&gt;&lt;/a&gt;&lt;br&gt;
Navigate to the just created user and click on the '&lt;strong&gt;create access key button&lt;/strong&gt;'.We'll need the key in the projects' terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkjmqo4zkz2e88d9epdr8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkjmqo4zkz2e88d9epdr8.png" alt="Image description" width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
Select the first option,Click Next.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj7x4ncwfbricv75z3mb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj7x4ncwfbricv75z3mb.png" alt="Image description" width="800" height="457"&gt;&lt;/a&gt;&lt;br&gt;
There we go! Use the copy icon to copy these values to your clipboard, then return to the Amplify CLI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yijya8x97drl1n372jl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yijya8x97drl1n372jl.png" alt="Image description" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up Authentication
&lt;/h2&gt;

&lt;p&gt;Set up authentication using Amazon Cognito:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;amplify add auth
# When prompted, select the default configuration
amplify push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Adding a GraphQL API and Database
&lt;/h2&gt;

&lt;p&gt;Add a GraphQL API and database using AWS AppSync and Amazon DynamoDB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;amplify add api
# Select GraphQL, provide an API name, and choose an authorization type
amplify push

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementing the Frontend
&lt;/h2&gt;

&lt;p&gt;Install necessary packages and configure the frontend to interact with the backend services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//index.js
import Amplify from 'aws-amplify';
import awsExports from './aws-exports';
Amplify.configure(awsExports);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Interacting with the API
&lt;/h2&gt;

&lt;p&gt;Use the Amplify library to interact with the GraphQL API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { API, graphqlOperation } from 'aws-amplify';
import { listNotes } from './graphql/queries';

async function fetchNotes() {
  try {
    const noteData = await API.graphql(graphqlOperation(listNotes));
    console.log('notes:', noteData);
  } catch (err) {
    console.log('error fetching notes', err);
  }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Deploying the Application
&lt;/h2&gt;

&lt;p&gt;Deploy your application using the Amplify Console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;amplify add hosting
# Select a hosting service and follow the prompts
amplify publish

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You’ve now successfully set up a full-stack application with AWS Amplify and ReactJS. This application includes user authentication and a serverless backend with a GraphQL API.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
