UNPKG

tsx-stack

Version:

โšก Scaffold a modern React + TypeScript app with your choice of router, state, query, and styling stack

180 lines (127 loc) โ€ข 5 kB
# ๐Ÿš€ TSX-stack **TSX-stack** is a powerful interactive CLI tool that scaffolds modern **React + TypeScript + Vite** projects with fully configurable options for routing, styling, state management, query handling, and optional dev tools โ€” all using TypeScript and best practices out-of-the-box. ## ๐Ÿ“š Table of Contents - [Introduction](#-introduction) - [Features](#-features) - [Installation](#-installation) - [Usage](#-usage) - [Configuration Options](#-configuration-options) - [Generated Structure](#-generated-structure) - [Examples](#-examples) - [Dependencies](#-dependencies) - [Troubleshooting](#-troubleshooting) - [Contributors](#-contributors) - [License](#-license) --- ## ๐Ÿ“– Introduction **TSX-stack** eliminates boilerplate by guiding you through a series of prompts to generate a fully working React + Vite + TypeScript app. It supports major ecosystem libraries and frameworks, making it a perfect tool for both prototyping and production-ready applications. --- ## โœจ Features - โœ… Interactive CLI - โšก Uses **Vite** for fast builds - ๐ŸŽจ Styling options: Tailwind CSS, Material UI, or none - ๐ŸŒ Router options: TanStack Router or React Router - ๐Ÿ”Œ Plug-and-play with state managers: Redux Toolkit, Zustand, or Jotai - ๐Ÿ” Query management via TanStack Query - ๐Ÿงช DevTools support for Tanstack routers and Tanstack queries - ๐Ÿ”” Optional integration of React Toastify - ๐Ÿงฉ Automatically generates Navbar, Footer, Home, and About pages, along with router setup based on user-selected styling --- ## โš™๏ธ Installation ```bash npm install -g TSX-stack ``` Or use directly with `npx`: ```bash npx TSX-stack ``` --- ## ๐Ÿ–ฅ๏ธ Usage Launch the interactive CLI: ```bash npx TSX-stack ``` Follow the prompts to: - Name your project - Choose styling framework - Select routing library - Add state/query libraries - Enable optional devtools/toast notifications Once generated: ```bash cd your-project-name npm install npm run dev ``` --- ## ๐Ÿงฉ Configuration Options During setup, youโ€™ll be prompted for: | Option | Choices | | ------------------ | ----------------------------------------- | | `Project name` | Any valid folder name | | `Styling` | Tailwind CSS, Material UI, None | | `Router` | TanStack Router, React Router, None | | `Router Devtools` | Yes / No (if TanStack Router is selected) | | `State Management` | Redux Toolkit, Zustand, Jotai, None | | `Query Library` | TanStack Query, React Query, None | | `Query Devtools` | Yes / No (if query lib is selected) | | `Toastify` | Yes / No | --- ## ๐Ÿ—‚๏ธ Generated Structure ``` your-app/ โ”œโ”€โ”€ public/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ common/ โ”‚ โ”‚ โ”œโ”€โ”€ Navbar.tsx โ”‚ โ”‚ โ””โ”€โ”€ Footer.tsx โ”‚ โ”œโ”€โ”€ Pages/ โ”‚ โ”‚ โ”œโ”€โ”€ Home.tsx โ”‚ โ”‚ โ””โ”€โ”€ About.tsx โ”‚ โ”œโ”€โ”€ routes/ (if routing is enabled) โ”‚ โ”‚ โ””โ”€โ”€ router.tsx or Layout.tsx โ”‚ โ”œโ”€โ”€ store/ (if Redux is selected) โ”‚ โ”‚ โ””โ”€โ”€ store.ts โ”‚ โ”œโ”€โ”€ App.tsx โ”‚ โ””โ”€โ”€ index.tsx โ”œโ”€โ”€ vite.config.ts โ”œโ”€โ”€ package.json โ””โ”€โ”€ tsconfig.json ``` --- ## ๐Ÿงช Examples ### Example 1: Tailwind + TanStack Router + Zustand ```bash npx TSX-stack ``` _Choose Tailwind, TanStack Router, Zustand, and enable devtools when prompted._ ### Example 2: MUI + React Router + Redux Toolkit + Toastify ```bash npx TSX-stack ``` _Select Material UI, React Router, Redux, and Toastify during prompts._ --- ## ๐Ÿ“ฆ Dependencies Depending on selected options, these libraries may be installed: - **Core:** `react`, `react-dom`, `typescript`, `vite`, `@vitejs/plugin-react` - **Styling:** `tailwindcss`, `@tailwindcss/vite`, `@mui/material`, `@emotion/react` - **Routing:** `@tanstack/react-router`, `@tanstack/router-devtools`, `react-router-dom` - **State Management:** `@reduxjs/toolkit`, `react-redux`, `zustand`, `jotai` - **Query:** `@tanstack/react-query`, `@tanstack/react-query-devtools` - **UI Enhancements:** `react-toastify` --- ## ๐Ÿ› ๏ธ Troubleshooting | Issue | Solution | | -------------------------------- | -------------------------------------------------------------- | | Folder already exists | Choose a different project name or remove the existing folder. | | Module not found during setup | Check your internet connection and rerun the generator. | | Permission errors during install | Try running with elevated permissions or fix directory access. | --- ## ๐Ÿ‘จโ€๐Ÿ’ป Contributors - **Vijaya Suriyan V** โ€” Creator & Maintainer > PRs welcome! Help improve `TSX-stack` by submitting ideas, fixes, or enhancements. --- ## ๐Ÿ“„ License MIT ยฉ Vijaya Suriyan V Feel free to use, modify, and distribute as needed. ---