create-codewithpablo v1.0.5
CodeWithPablo Starter Kit š
A minimal and professional React + TypeScript + Vite starter kit, pre-configured with:
- ESLint and Prettier for linting and formatting.
- Vitest and Testing Library for unit testing.
- Husky and Commitlint to enforce clean commit messages.
- Useful scripts to maintain code quality.
š Full Documentation: CodeWithPablo Docs
š¦ Installation
š Option 1: Using NPM (Recommended)
npm create codewithpablo my-new-project
š¹ Option 2: Using NPX
npx create-codewithpablo my-new-project
š¹ Option 3: Cloning the Repository (For Full Customization)
git clone https://github.com/your-username/codewithpablo-boilerplate.git
cd codewithpablo-boilerplate
npm install
After installing dependencies, run the following command to ensure Husky hooks have execution permissions:
š§ Post-Installation
This boilerplate includes a postinstall script that ensures Husky hooks have execution permissions automatically.
npm postinstall
However, if you encounter issues, you can run the following command manually:
chmod +x .husky/*
š Usage
š„ Development Mode
npm run dev
Open http://localhost:5173 in your browser.
š§ Linting & Formatting
npm run lint # Check ESLint errors
npm run format # Apply Prettier formatting
npm run check # Run linting, formatting, and type-check in one command
ā Testing
npm run test # Run tests once
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate test coverage report
š Commit Convention
This project follows the Conventional Commits standard. Commit messages should use the following format:
<type>(<optional scope>): <short message>
Common commit types:
feat
: New feature.
fix
: Bug fix.
chore
: Maintenance or minor changes.
docs
: Documentation updates.
test
: Adding or modifying tests.
ci
: Changes to CI/CD configuration.
Examples:
git commit -m "feat(auth): add login functionality"
git commit -m "fix(button): correct padding issue"
git commit -m "chore(lint): configure ESLint and Prettier"
š Husky & Git Hooks
This boilerplate uses Husky to automate checks before commits and pushes.
pre-commit
: Runs linting and type-check before committing.
commit-msg
: Enforces Conventional Commits format.
pre-push
: Runs tests before pushing.
If any check fails, the commit or push will be blocked.
š Project Structure
This boilerplate follows a well-organized folder structure for scalability and maintainability:
codewithpablo-boilerplate/
āāā src/
ā āāā assets/ # Static assets (images, fonts, icons, etc.)
ā āāā components/ # Reusable UI components
ā āāā hooks/ # Custom React hooks
ā āāā layouts/ # Page layouts (e.g., header, sidebar)
ā āāā pages/ # Page-level components (e.g., Home, About)
ā āāā services/ # API calls and external services
ā āāā store/ # Global state management (if needed)
ā āāā utils/ # Utility functions/helpers
ā āāā styles/ # Global styles
ā āāā App.tsx # Root component
ā āāā main.tsx # Entry point
ā āāā router.tsx # React Router configuration (if used)
ā āāā setupTests.ts # Vitest setup file
āāā __tests__/ # Unit tests
āāā public/ # Static files (index.html, favicon, etc.)
āāā .husky/ # Husky hooks
āāā .eslint.config.js # ESLint config
āāā .prettierrc.json # Prettier config
āāā tsconfig.json # TypeScript config
āāā vite.config.ts # Vite config
āāā README.md # Documentation
āāā package.json # Dependencies and scripts
āāā node_modules/ # Dependencies (ignored in Git)
āāā ... #
š Aliases for Importing
This boilerplate supports path aliases for cleaner imports. Instead of writing:
import Home from '../../../pages/Home'
You can use the alias @ to import from src/:
import Home from '@/pages/Home'
Aliases are defined in both:
- vite.config.ts ā for Vite and the app runtime.
- vite.config.ts (test section) ā for Vitest compatibility.
- tsconfig.json ā for TypeScript support.
š¤ Contributing
Contributions are welcome! Please read the Contributing Guide before submitting a pull request.