@ali_samir/create-react-stack
v1.1.3
Published
π A modern React project generator with Vite, TypeScript, Tailwind CSS, and TanStack Query
Maintainers
Readme
π @ali_samir/create-react-stack
β‘ The fastest way to create modern React applications with a complete, production-ready stack.
Create React Stack is a powerful CLI tool that generates modern React applications with Vite, TypeScript, Tailwind CSS, TanStack Query, and all the essential tools you need to build amazing web applications.
β¨ Features
- π Lightning Fast: Powered by Vite for instant development and optimized builds
- π‘οΈ Type Safe: Full TypeScript support with strict type checking
- π¨ Beautiful UI: Tailwind CSS with custom design system and responsive components
- π‘ Smart Data Fetching: TanStack Query for efficient server state management
- π§ Code Quality: ESLint and Prettier configured with React and TypeScript best practices
- π Production Ready: GitHub Actions CI/CD, optimized builds, and deployment-ready configuration
- π± Responsive Design: Mobile-first approach with modern UI components
- π― Developer Experience: Hot reload, TypeScript IntelliSense, and comprehensive tooling
π¦ Installation & Usage
Quick Start
npx @ali_samir/create-react-stack my-app
cd my-app
npm run devThat's it! Your React app is ready to go. π
Advanced Usage
# Create app with custom name
npx @ali_samir/create-react-stack my-awesome-app
# Skip dependency installation
npx @ali_samir/create-react-stack my-app --skip-install
# Get help
npx @ali_samir/create-react-stack --helpπ What's Included
Your new React app comes with:
my-app/
βββ public/ # Static assets
βββ src/
β βββ components/ # Reusable React components
β β βββ Header.tsx
β β βββ Hero.tsx
β β βββ Features.tsx
β β βββ ApiExample.tsx
β β βββ Footer.tsx
β βββ services/ # API services and utilities
β β βββ api.ts
β βββ App.tsx # Main application component
β βββ main.tsx # Application entry point
β βββ index.css # Global styles with Tailwind
βββ .eslintrc.cjs # ESLint configuration
βββ .prettierrc # Prettier configuration
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ vite.config.ts # Vite configuration
βββ package.json # Dependencies and scriptsπ οΈ Available Scripts
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors
npm run format # Format code with Prettier
npm run format:check # Check code formattingπ Example Usage
Basic Component
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div className="p-6 bg-white rounded-lg shadow-md">
<h2 className="text-2xl font-bold mb-4">Counter: {count}</h2>
<button onClick={() => setCount(count + 1)} className="btn btn-primary">
Increment
</button>
</div>
);
}Data Fetching with TanStack Query
import { useQuery } from "@tanstack/react-query";
import { fetchRandomUser } from "./services/api";
function UserProfile() {
const { data, isLoading, error } = useQuery({
queryKey: ["user"],
queryFn: fetchRandomUser,
});
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error loading user</div>;
return (
<div className="card">
<h3>
{data.name.first} {data.name.last}
</h3>
<p>{data.email}</p>
</div>
);
}π¨ Styling
The project uses Tailwind CSS with a custom design system:
// Pre-configured utility classes
<button className="btn btn-primary">Primary Button</button>
<button className="btn btn-secondary">Secondary Button</button>
<div className="card">Card Content</div>π§ Configuration
TypeScript
The project includes strict TypeScript configuration with path mapping:
// Use path mapping for cleaner imports
import { Button } from "@/components/Button";
import { api } from "@/services/api";ESLint
Pre-configured with React, TypeScript, and Tailwind rules:
npm run lint # Check for issues
npm run lint:fix # Auto-fix issuesPrettier
Code formatting with Tailwind plugin:
npm run format # Format all files
npm run format:check # Check formattingπ Deployment
Vercel (Recommended)
- Push your code to GitHub
- Connect your repository to Vercel
- Deploy with zero configuration
Netlify
- Build your project:
npm run build - Deploy the
distfolder to Netlify
Docker
FROM node:18-alpine as builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]π€ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone the repository
git clone https://github.com/alisamirali/create-react-stack.git
cd create-react-stack
# Install dependencies
npm install
# Test the CLI locally
node bin/create-react-stack.js test-app --skip-installπ License
This project is licensed under the MIT License - see the LICENSE file for details.
β Show Your Support
If you find this project helpful, please give it a star! β
π Acknowledgments
- Vite - Next generation frontend tooling
- React - A JavaScript library for building user interfaces
- TypeScript - Typed JavaScript at any scale
- Tailwind CSS - A utility-first CSS framework
- TanStack Query - Powerful data synchronization for React
Made with β€οΈ by the community
