Post

Episode 1: Project Setup

In this episode, we'll set up the foundation of our e-commerce app using React and Tailwind CSS.

Episode 1: Project Setup

1. Initialize React App

Install library create-react-app into root NodeJS.

1
npm install create-reate-app -g

Create your project using Create React App:

1
2
npx create-react-app ecommerce-app
cd ecommerce-app

2. Install Tailwind CSS:

Install Tailwind and its required dependencies:

1
2
npm install -D tailwindcss@3.4.1 postcss autoprefixer
npx tailwindcss init -p

3. Configure Tailwind

Update tailwind.config.js:

1
2
3
4
5
6
7
8
9
10
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

Update src/index.css:

1
2
3
@tailwind base;
@tailwind components;
@tailwind utilities;

4. Clean Up Default Files

Remove unnecessary files: Delete logo.svg and contents of App.css

Replace App.js with a simple starter component:

1
2
3
4
5
6
7
8
9
function App() {
  return (
    <div className="text-2xl text-center mt-10">
      Welcome to E-Commerce App!
    </div>
  );
}

export default App;

5. Suggested Architech Structure

ecommerce-app/
├── public/
├── src/
│   ├── assets/         # Images, icons, etc.
│   ├── components/     # Shared UI components
│   ├── pages/          # Home, Cart, Login pages
│   ├── services/       # API calls (e.g., productService.js)
│   ├── utils/          # Helper functions
│   ├── App.js
│   ├── index.css
│   └── main.jsx

6. Install Router & Axios

We’ll need these libraries for routing and API requests:

1
npm install react-router-dom axios
This post is licensed under CC BY 4.0 by the author.