In this repository, we will learn how to integrate CI/CD in a Node.js application using GitHub Actions and a VPS server or AWS EC2 instance.
We will also learn how to deploy our Node.js application on a VPS server or AWS EC2 instance using a CI/CD pipeline.
This is a step-by-step guide designed for learning and practicing CI/CD integration in real-world Node.js projects using GitHub Actions and remote servers.
I created this repository as part of my learning journey, so feel free to explore and adapt it for your own CI/CD needs.
Make sure you know the basics of:
- Node.js & Express.js
- Git & GitHub
- AWS EC2 or any VPS server
- CI/CD fundamentals
- GitHub Actions
- SSH
- Nginx server setup
- PM2 process manager
- MongoDB (if needed)
- Basic environment variables usage
- Basic Linux commands
- Basic terminal usage
- Basic networking concepts
- Basic firewall setup
git clone https://github.com/vikashkrdeveloper/CI-CD-Integration-IN-NodeJS.git && cd CI-CD-Integration-IN-NodeJS
npm install
npm start
Open your browser and go to:
π http://localhost:3000
You should see: Hello CI/CD World!
curl -X GET http://localhost:3000/
Send a GET
request to http://localhost:3000/
- Create your Node.js application
- Push the project to GitHub
- Set up your VPS or AWS EC2 instance
- Install on your server:
- Node.js
- Nginx
- PM2
- MongoDB (if needed)
- Set up SSH keys between GitHub Actions and your server
- Create a GitHub Actions workflow file (
.github/workflows/main.yml
) - Configure the pipeline to:
- Install dependencies
- Run tests
- SSH into server
- Pull latest code
- Restart app with PM2
- Test by pushing a commit β CI/CD should trigger π
- Celebrate! Your Node.js app is now automatically deployed! π
- π Always use environment variables for sensitive data.
- π₯ Use
pm2 status
to monitor your Node.js app in production. - π Set up Nginx reverse proxy for serving your app securely.
- β‘ Use fail2ban or firewalls to protect your VPS.
- π΅οΈ Regularly check
pm2 logs
for debugging.
Want to improve this guide?
Feel free to fork this repo, submit pull requests, or open issues. Contributions are welcome!
This project is licensed under the MIT License β you are free to use and modify it.
Add any relevant screenshots here! πΈ (Optional)
- Name: Vikash Kumar
- Location: India
- What's App: +91 7352514546
- Email: Vik.fstkdvpro@gmail.com
- LinkedIn: Vikash Kumar
- GitHub: Vikash Kumar
- Twitter: @vikashkrdeveloper
- Instagram: @vikashkrdeveloper
- Portfolio: vikashkrdeveloper
- Telegram: @vikashkrdeveloper
- YouTube: Vikash Kumar
Developed by Vikash Kumar
Letβs build cool things together! π
Ab tumhara kaam pura ho gaya, bhai! π If facing any issues, please check the Issues tab or create a new issue.
Feel free to reach out if you have any questions or need help with CI/CD integration in Node.js. Happy coding! π»