Skip to main content

Built a Good Website with VITE & REACT? Now What? 🎉

 


Congratulations on building your first website using React 🌟 Creating a functional and aesthetically pleasing website is a huge milestone, but you might be wondering: what’s next? How do you make your website accessible to the world? This blog will guide you through two essential steps to take your project live-uploading it to GitHub 💻 and deploying it using GitHub Pages 🌐.

GitHub is a powerful platform for storing and sharing your code. By uploading your website files to GitHub, you not only create a backup but also make collaboration and deployment much easier. Here’s how to do it:

  1. Log in to your GitHub account. If you don’t have one, create an account first.

  2. Click on the “New” button in the top-left corner or navigate to Create a New Repository.

  3. Give your repository a meaningful name (e.g., my-website).

  4. Add an optional description and decide whether to make it public or private.

  5. Check the box to initialize the repository with a README file if desired.

  6. if you have an existing repository just make sure you have pushed all changes

  7. Open your project folder locally on your computer.

  8. If you’re using Git for version control, open a terminal in the project directory and initialize Git:

  9. Add all your files to the repository:

  10. Commit your changes:
  • git commit -m "Initial commit"

  1. Link your local repository to the GitHub repository by adding the remote URL (replace your-username and your-repository with your details):

  1. Push your files to GitHub:
  • git push -u origin main
  1. If your default branch isn’t main, use the branch name you created instead.

Now your website’s code is safely stored on GitHub. 📦 The next step is to deploy it.

GitHub Pages is a free and simple way to host your static website directly from your GitHub repository. Follow these steps to get your website live:

create new action file for the code

  1. Once enabled, GitHub Pages will provide a URL for your live site https://your-username.github.io/your-repository/
  2. Note that it might take a few minutes for your website to go live.
name: Build and Deploy on: push: branches: [ "main" ] pull_request: branches: [ "main" ] workflow_dispatch: # Manual trigger from GitHub UI jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '18' - name: Install dependencies run: npm install - name: Build React App run: npm run build - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist

If you have a custom domain, you can link it to your GitHub Pages site by adding a CNAME file to your repository or configuring your domain's DNS settings. GitHub's documentation provides detailed steps for this process.

get your domain from service provider add its name in the “name section”

and it will give you a cname record copy it go tyo your dns provider and paste it make sure you are selecting lowest ttl and click update

DNS takes time to update after it is done anyone can acess your site

By uploading your website to GitHub and deploying it with GitHub Pages, you’ve made your project accessible to the world. It’s a big step forward in your web development journey, and it gives you a foundation to share, improve, and build upon your work. Happy coding! 🚀

Share this with your friends

Loved it click the button to subscribe


Originally published at https://balasaisigireddy.substack.com.

Comments

Popular posts from this blog

How to install and configure termux on Android

Note: don’t install from the Google Play Store, it is a highly stripped-down version of the original The options present in my own priority order Download from GitHub releases Download using Fdroid download from GitHub releases Just go to GitHub releases , download the APK, and install it. We will see configuration steps later ! The only downside is you need to redownload on each release download using FDroid You can use Fdroid as package manager instead of Google play store Now download completed what’s next setup the nearest mirrors using termux-change-repo setup the storage using termux-setup-storage Do update and upgrade termux configure nearest mirrors Run termux-change-repo And it will scan all the nearest repos and configure the default one which is the nearest setup storage using termux-setup-storage It usually asks for some permissions and do some storage setup don’t remember what is actually do but used it to fix a problem some time ago do some PKG update and upgrade Run com...

Decoupling APIs Using Message Queues: Building Fault-Tolerant Applications 🚀

  Decoupling APIs Using Message Queues: Building Fault-Tolerant Applications 🚀 In the fast-paced world of modern software 🌐, seamless communication between services is a cornerstone of effective system design. However, what happens when your API sends a request, and the server at the other end is busy—or worse, the request gets dropped? 😱 It’s a scenario many developers dread, but with proper design patterns, you can make your applications robust and fault-tolerant. One of the most powerful tools to address this challenge is Message Queues (MQs) 📨. In this blog, we’ll explore how decoupling APIs using MQs can transform your application into a more resilient system 💪. The Problem: Busy Servers and Dropped Requests ❌ In traditional client-server architecture, a client sends a request to the server, and the server processes it synchronously. This works fine until: The server is overwhelmed : High traffic spikes 📈 can cause bottlenecks. Requests are time-sensitive : A de...

🚀 Say Hello to UV: The Game-Changing Python Project Manager! 🎉

  Ready to turbocharge your Python development? Introducing UV , the all-in-one Python package and project manager that's rewriting the rules! ⚡ Built with blazing-fast Rust, UV replaces tools like pip , pip-tools , poetry , pyenv , and more — all while being 10-100x faster . Whether you're installing dependencies, managing Python versions, or publishing your projects, UV makes it a breeze. Backed by Astral — the creators of Ruff — UV is here to revolutionize how you work with Python. 🐍✨ 🌟 Why UV Will Be Your New Favorite Tool 🚀 All-in-One Convenience Replace a dozen tools with UV, your one-stop solution for Python package management, virtual environments, and more! ⚡️ Insane Speed Get things done 10-100x faster than traditional tools like pip . 🐍 Python Version Pro? Yes, You! Install, switch, and manage Python versions with a single command. Never worry about compatibility again! 🛠️ Tools Made Easy Install and run Python-based CLI tools like a pro — ...