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

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

A modern web application built with React, TypeScript, and Vite. Perfect for creating type-safe, component-based web applications with high performance and exceptional developer experience.
https://github.com/5h1ngy/bl-vitejs-typescript-react

component-based local-storage offline-first react spa type-safety typescript vite web-app

Last synced: 7 months ago
JSON representation

A modern web application built with React, TypeScript, and Vite. Perfect for creating type-safe, component-based web applications with high performance and exceptional developer experience.

Awesome Lists containing this project

README

          

# ๐Ÿš€ React + TypeScript + Vite

![License](https://img.shields.io/badge/license-MIT-blue.svg)
![React](https://img.shields.io/badge/React-18.x-61DAFB.svg?logo=react)
![TypeScript](https://img.shields.io/badge/TypeScript-4.x-3178C6.svg?logo=typescript)
![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, TypeScript, and Vite. Perfect for creating type-safe, component-based web applications with high performance and exceptional developer experience.

**Topics:** `react` `typescript` `vite` `web-app` `spa` `offline-first` `local-storage` `component-based` `type-safety`

## ๐Ÿ“‹ 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
- ๐Ÿ”’ Type safety with TypeScript
- ๐Ÿ“Š 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
- ๐Ÿ” TypeScript linting with ESLint
- ๐ŸŽจ Code formatting with Prettier
- ๐Ÿงช Testing with Vitest and React Testing Library
- ๐Ÿ–Œ๏ธ Support for transient props pattern in styled components

## ๐Ÿ—‚๏ธ Project Structure

```
bl-vitejs-typescript-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.tsx # Root React component
โ”‚ โ”œโ”€โ”€ main.tsx # Application entry point
โ”‚ โ””โ”€โ”€ index.css # Global styles
โ”œโ”€โ”€ .eslintrc.cjs # ESLint configuration
โ”œโ”€โ”€ tsconfig.json # TypeScript configuration
โ”œโ”€โ”€ tsconfig.node.json # TypeScript configuration for Node
โ”œโ”€โ”€ vite.config.ts # 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:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
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',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
}
```

## ๐Ÿ“š Resources

- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
- [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)