Set Up a Free CI/CD Pipeline for Your Full Stack Project

Aamir Khan
0
Set Up a Free CI/CD Pipeline for Your Full Stack Project

Set Up a Free CI/CD Pipeline for Your Full Stack Project

Continuous Integration and Continuous Deployment (CI/CD) has become a game-changer for developers. It automates repetitive tasks like testing and deploying your apps, saving time and reducing human error. For self-taught developers or juniors working on side projects, learning CI/CD helps you ship updates confidently and keep your apps production-ready.

In this post, I’ll guide you through setting up a free CI/CD pipeline for your full stack project using GitHub Actions. By the end, you’ll know how to automatically deploy a Node.js/React (MERN) app whenever you push changes to GitHub.

What is CI/CD and Why Does It Matter?

CI/CD combines Continuous Integration (running automated tests and builds) and Continuous Deployment (automatically delivering code to production). For example, when you push code to your GitHub repository, a CI/CD pipeline can:

  • Run lint checks and tests
  • Build the React frontend
  • Deploy both backend and frontend to hosting platforms (like Vercel, Netlify, or VPS)

This workflow ensures your code is always up-to-date and reliable, removing the need to manually redeploy after every change.

Tools You’ll Need

  • GitHub Actions – Free CI/CD pipelines for public repositories
  • Node.js + npm – For building backend and frontend
  • Hosting Service – Free services like Render or Vercel work great
  • MERN Stack or Full Stack App – A repository with separate frontend and backend folders

Step-by-Step Guide to Set Up CI/CD

Step 1: Add a GitHub Actions Workflow File

Create a .github/workflows/deploy.yml file in your repository.

name: CI/CD Pipeline

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 18

      - name: Install backend dependencies
        run: |
          cd backend
          npm install

      - name: Install frontend dependencies
        run: |
          cd frontend
          npm install
          npm run build

      - name: Deploy to Render (or another host)
        run: echo "Trigger deployment here"

Step 2: Configure Hosting Service

If you’re using Render, you can set up a web service for your backend and a static site for your React frontend. Then use Render's Deploy Hook URL in your workflow:

curl -X POST ${{ secrets.RENDER_DEPLOY_HOOK }}

Add RENDER_DEPLOY_HOOK as a GitHub Secret under repository settings.

Step 3: Automate Tests

Add test commands in the workflow to ensure that only stable code is deployed:

      - name: Run tests
        run: |
          cd backend
          npm test

Step 4: Trigger Deployment

Each time you git push to main, GitHub Actions will automatically run the pipeline, build your project, and trigger deployment.

Real-World Example

For my projects, I use a MERN stack hosted on Render and GitHub Actions to handle automated deployments. This means I can focus on writing features instead of manually deploying.

You can also check my post on Deploying Full Stack App on VPS (Step-by-Step) for VPS-based deployment.

Related Tools and Resources

  • GitHub Actions Marketplace – Prebuilt workflows
  • Render – Free backend hosting
  • Netlify/Vercel – Perfect for frontend hosting
  • Docker – Use Docker with Actions for advanced pipelines

Conclusion

Setting up a free CI/CD pipeline is easier than you think. With GitHub Actions and services like Render, even beginner developers can deploy apps automatically without touching servers.

Try it on your next project and experience smoother deployments! Got questions? Comment your thoughts below.

💖

Enjoyed the Post?

If my blog helped you, please consider supporting me!

Support Me 💖

Post a Comment

0 Comments

Hi Everyone, please do not spam in comments.

Post a Comment (0)

Made with Love by

Welcome to Code Journey with Aamir – your one-stop hub for full-stack development tutorials, projec…