An open API service indexing awesome lists of open source software.

https://github.com/5h1ngy/bl-vitejs-javascript-react

A modern web application built with React, JavaScript, and Vite. Perfect for creating responsive, interactive, and high-performance web applications with a component-based architecture.
https://github.com/5h1ngy/bl-vitejs-javascript-react

component-based javascript local-storage offline-first react responsive spa vite web-app

Last synced: 6 months ago
JSON representation

A modern web application built with React, JavaScript, and Vite. Perfect for creating responsive, interactive, and high-performance web applications with a component-based architecture.

Awesome Lists containing this project

README

          

# ๐Ÿš€ React + JavaScript + Vite

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![React](https://img.shields.io/badge/React-18.x-61DAFB.svg?logo=react)
![JavaScript](https://img.shields.io/badge/JavaScript-ES6+-F7DF1E.svg?logo=javascript)
![Vite](https://img.shields.io/badge/vite-4.x-646CFF.svg?logo=vite)
![ESLint](https://img.shields.io/badge/ESLint-8.x-4B32C3.svg?logo=eslint)

A modern web application built with React, JavaScript, and Vite. Perfect for creating responsive, interactive, and high-performance web applications with a component-based architecture.

**Topics:** `react` `javascript` `vite` `web-app` `spa` `offline-first` `local-storage` `component-based` `responsive`

## ๐Ÿ“‹ Table of Contents
- [Features](#-features)
- [Project Structure](#-project-structure)
- [Recommended IDE Setup](#-recommended-ide-setup)
- [Project Setup](#-project-setup)
- [Package Managers](#-package-managers)
- [ESLint Configuration](#-eslint-configuration)
- [Resources](#-resources)

## โœจ Features

- โš›๏ธ React framework for UI components
- ๐Ÿ“Š Support for dashboard and statistical visualizations
- ๐Ÿ—“๏ธ Ability to implement timeline and calendar views
- ๐Ÿ’พ Data storage in localStorage (100% offline)
- ๐Ÿ“ค Import/export and backup functionality
- ๐Ÿ”„ Hot Module Replacement (HMR) during development
- โšก Ultra-fast build with Vite bundler
- ๐ŸŽจ Component-based architecture
- ๐Ÿ“ฑ Responsive design for all devices
- ๐Ÿงฉ Modular code structure
- ๐Ÿ” JavaScript linting with ESLint
- ๐ŸŽจ Code formatting with Prettier
- ๐Ÿงช Testing with Vitest and React Testing Library

## ๐Ÿ—‚๏ธ Project Structure

```
bl-vitejs-javascript-react/
โ”œโ”€โ”€ public/ # Static assets
โ”œโ”€โ”€ dist/ # Build output directory
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ assets/ # Project assets (images, fonts, etc.)
โ”‚ โ”œโ”€โ”€ components/ # React components
โ”‚ โ”‚ โ”œโ”€โ”€ ui/ # UI components
โ”‚ โ”‚ โ””โ”€โ”€ layout/ # Layout components
โ”‚ โ”œโ”€โ”€ hooks/ # Custom React hooks
โ”‚ โ”œโ”€โ”€ utils/ # Utility functions
โ”‚ โ”œโ”€โ”€ context/ # React context providers
โ”‚ โ”œโ”€โ”€ App.jsx # Root React component
โ”‚ โ”œโ”€โ”€ main.jsx # Application entry point
โ”‚ โ””โ”€โ”€ index.css # Global styles
โ”œโ”€โ”€ .eslintrc.cjs # ESLint configuration
โ”œโ”€โ”€ vite.config.js # Vite configuration
โ”œโ”€โ”€ package.json # Project dependencies and scripts
โ””โ”€โ”€ index.html # HTML template
```

## ๐Ÿ› ๏ธ Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

## ๐Ÿš€ Project Setup

### ๐Ÿ“ฅ Install

```bash
$ pnpm install
```

### ๐Ÿ”ง Development

```bash
$ pnpm dev
```

### ๐Ÿ“ฆ Build

```bash
$ pnpm build
```

### ๐Ÿงช Test

```bash
$ pnpm test
```

## ๐Ÿ“ฆ Package Managers

This project supports multiple package managers. Here's how to use each one:

### NPM

NPM is the default package manager for Node.js.

**Install NPM:**
```bash
# Included with Node.js installation
```

**Setup project with NPM:**
```bash
# Install dependencies
$ npm install

# Run development server
$ npm run dev

# Build application
$ npm run build

# Run tests
$ npm run test
```

**Key features:**
- ๐Ÿ“š Vast package ecosystem
- ๐Ÿ”’ Hierarchical node_modules structure
- ๐Ÿ“‹ Package.json for dependency management

### Yarn

Yarn is a fast, reliable, and secure alternative to NPM.

**Install Yarn:**
```bash
# Install using NPM
$ npm install -g yarn
```

**Setup project with Yarn:**
```bash
# Install dependencies
$ yarn

# Run development server
$ yarn dev

# Build application
$ yarn build

# Run tests
$ yarn test
```

**Key features:**
- โšก Faster installation speeds
- ๐Ÿ“ฆ Offline caching
- ๐Ÿ”’ Better security with checksums
- ๐Ÿ“‹ yarn.lock for deterministic installations

### PNPM

PNPM is a disk-space efficient package manager.

**Install PNPM:**
```bash
# Install using NPM
$ npm install -g pnpm
```

**Setup project with PNPM:**
```bash
# Install dependencies
$ pnpm install

# Run development server
$ pnpm dev

# Build application
$ pnpm build

# Run tests
$ pnpm test
```

**Key features:**
- ๐Ÿ’พ Disk space savings through symlinks
- ๐Ÿš€ Fast installation speeds
- ๐Ÿ”„ Content-addressable storage
- ๐Ÿ“‹ pnpm-lock.yaml for dependency lock

### Comparison

| Feature | NPM | Yarn | PNPM |
|-----------------------|---------|---------|---------|
| Disk usage | High | High | Low |
| Installation speed | Slow | Fast | Fastest |
| Parallel installations| Limited | Yes | Yes |
| Workspace support | Limited | Good | Best |
| Offline mode | Limited | Good | Good |
| Security | Good | Better | Better |

## ๐Ÿ›ก๏ธ ESLint Configuration

This project uses ESLint to ensure code quality. The configuration is located in `.eslintrc.cjs`.

### Basic Configuration

```js
// .eslintrc.cjs
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
```

### For Production Applications

For production applications, you may want to add additional rules:

```js
// Additional rules for production
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'react/prop-types': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
}
```

## ๐Ÿ“š Resources

- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [Vite Documentation](https://vitejs.dev/guide/)
- [ESLint Documentation](https://eslint.org/docs/user-guide/getting-started)
- [NPM Documentation](https://docs.npmjs.com/)
- [Yarn Documentation](https://yarnpkg.com/getting-started)
- [PNPM Documentation](https://pnpm.io/motivation)