A small e-commerce starter built with React, TypeScript, Vite, Tailwind CSS and shadcn-ui. Includes a cart context, responsive navbar and simple product pages.
- Vite
- React
- TypeScript
- Tailwind CSS
- shadcn-ui
- lucide-react (icons)
- npm
Prerequisite: Node.js and npm installed.
-
Clone the repo:
-
Install dependencies:
-
Run dev server:
-
Open the URL shown in the terminal (usually
http://localhost:5173).
npm run dev— start dev server with hot reloadnpm run build— create production build indistnpm run preview— preview the production build locallynpm test— run tests (if configured)
src/— application sourcesrc/components/— UI components (e.g.Navbar.tsx)src/contexts/— React contexts (e.g.CartContext)src/assets/— images and static assetsvite.config.ts— Vite config and aliasestsconfig.json— TypeScript config and path mappings
If you use the @ alias in imports, ensure vite.config.ts and tsconfig.json both map @ to src. Example vite.config.ts:
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
});
5. {
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
},
"include": ["src"]
}