Skip to content

bansalgaurav852/agency-web-landing-page

Repository files navigation

Vite React.js Project

Welcome to the Vite React.js project! This project is bootstrapped with Vite to ensure a fast and efficient development environment for building modern React.js applications.

Table of Contents

Introduction

Vite is a next-generation, front-end tool that provides a highly optimized development experience for modern web projects. Vite React.js projects come with fast server startup, hot module replacement (HMR), and optimized builds for production, making the development experience smoother and more efficient.

Requirements

Before starting, ensure that you have the following installed on your local machine:

  • Node.js (14.x or higher): Install Node.js
  • npm (comes with Node.js) or yarn (alternative package manager):
    • To install npm: Included with Node.js installation
    • To install Yarn: npm install --global yarn

Installation

  1. Clone the repository: Clone the project repository using Git:
    git clone <repository-url>
    cd <project-folder>
    
  2. Install project dependencies: After cloning the repository, you need to install the required packages.
  npm install 
  yarn install

Running the Project

To run the development server and start working on the project:

  1. Start the development server:

Using npm:

npm run dev

Or using Yarn:

yarn dev 
  1. Access the app: Once the development server is up and running, open your browser and navigate to:
http://localhost:5173

Vite may automatically open the app in your default browser as well.

Building for Production

When you're ready to deploy your application, use the following command to create a production build:

Using npm:

npm run build

Or using Yarn:

yarn build

The built files will be stored in the dist/ directory. You can deploy this directory to your preferred hosting service.

To test the production build locally, you can use the following command:

Using npm:

npm run preview

Or using Yarn:

yarn preview

This will start a local server to preview the production build.

Project Structure

The project structure is organized as follows:

.
├── node_modules/       # All installed dependencies
├── public/             # Static files like images, fonts, etc.
├── src/                # Main source files for the project
│   ├── assets/         # Application assets such as images and icons
│   ├── components/     # React components of the app
│   ├── App.jsx         # Main App component
│   ├── main.jsx        # Entry point for the app
│   └── index.css       # Global styles
├── .gitignore          # Files to be ignored by Git
├── index.html          # HTML template for the app
├── package.json        # Project metadata and dependencies
├── vite.config.js      # Vite configuration
└── yarn.lock / package-lock.json  # Dependency lock file
  • public/: This folder contains static files such as images, icons, or fonts. Files here are not processed by Vite and will be copied as-is.
  • src/: This is where your main application code lives. The entry point of the app is main.jsx. App.jsx: The main React component that defines the structure of your application. Available Scripts In the project directory, you can run the following scripts:
npm run dev / yarn dev

Starts the development server on http://localhost:5173, with Hot Module Replacement (HMR) enabled.

npm run build / yarn build

Builds the app for production, optimizing assets for faster loading times. The final build output will be in the dist/ folder.

npm run preview / yarn preview

Runs a local server to preview the production build.

npm run lint / yarn lint

Lints the code according to the project's linting rules (ESLint or similar tools, if configured).

Learn More To learn more about Vite and React.js, check out the following resources:

Vite Documentation React Documentation