Skip to content

Latest commit

 

History

History
99 lines (58 loc) · 2.86 KB

Deployment.md

File metadata and controls

99 lines (58 loc) · 2.86 KB

Deployment of Angular Applications

Deploying Angular applications involves packaging your app and hosting it on a web server. This document outlines the deployment processes for two popular platforms: Firebase and Netlify. Each platform offers unique advantages and can be selected based on specific project requirements.

Table of Contents


Deploying to Firebase

Firebase Hosting provides fast and secure hosting for your web app, static and dynamic content, and microservices. It is production-grade web content hosting for developers. Here is how you can deploy your Angular application to Firebase:

Prerequisites

  • A Firebase account.
  • The Firebase CLI installed (npm install -g firebase-tools).

Steps for Deployment

  1. Log in to Firebase

    From your terminal, use the Firebase CLI to log in:

    firebase login
  2. Initialize Firebase in Your Project

    Navigate to your project directory and run:

    firebase init

    Select 'Hosting', configure the Firebase project you want to use, and specify the dist/your-project-name as your public directory.

  3. Build Your Angular App

    Make sure your project is production-ready by building it:

    ng build --prod
  4. Deploy to Firebase

    Deploy your application using the Firebase CLI:

    firebase deploy

    Your application is now hosted on Firebase, and you will be provided with a URL to access it.

Deploying to Netlify

Netlify is an excellent solution for deploying static sites and client-side applications. It integrates continuous deployment services with Git repositories for a seamless update process.

Prerequisites

  • A Netlify account.
  • Your application committed to a Git repository (GitHub, GitLab, or Bitbucket).

Steps for Deployment

  1. Build Your Angular App

    Run a production build of your app:

    ng build --prod
  2. Push Your Code to a Git Repository

    Ensure your code, including the dist/ directory, is pushed to your Git repository.

  3. Set Up Netlify

    • Log in to your Netlify account and go to the 'Sites' tab.
    • Click 'New site from Git' and select your Git provider.
    • Choose your repository and branch to deploy.
  4. Configure Build Settings

    Set the build command to ng build --prod and the publish directory to dist/your-project-name.

  5. Deploy Your Site

    Netlify will automatically deploy your site and provide you with a URL to access it.


By following these steps, you can deploy your Angular applications to either Firebase or Netlify, ensuring they are accessible online with minimal setup. Each platform offers powerful features for hosting web applications, including automatic HTTPS, global CDN, and continuous deployment.