Skip to content

sekak/pinterest-clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

39 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Med-Spire

πŸ“Œ Pinterest Clone β€” Built with the MERN Stack

Med-Spire is a full-stack Pinterest Clone application developed using the MERN stack: MongoDB, Express.js, React, and Node.js. It replicates core Pinterest features such as:

  • πŸ” User authentication

  • πŸ“Έ Image uploads via ImageKit

  • πŸ“Œ Pinboard creation and browsing

  • πŸ“± Fully responsive design

The project also includes component testing using Vitest and utilizes various modern libraries to ensure clean, efficient, and scalable development.

πŸš€ Features

  • User Authentication (Register, Login, Logout)

  • Create and Save Pins

  • Upload Images

  • Responsive Masonry Grid Layout

  • Like and Comment on Pins

  • User Profiles

  • Search Functionality

  • Fully Tested Components with Vitest

πŸ› οΈ Tech Stack

Frontend

  • React.js

  • Tailwind CSS – for responsive and fast styling

  • React Router DOM – for routing

  • React Query - for state management

  • Axios – for API calls

  • Material-UI – for beautiful icons

  • Imagekit.io – for image uploading and download

  • Vitest + React Testing Library – for unit/component testing

Backend

  • Node.js

  • Express.js

  • MongoDB with Mongoose

  • JWT (JSON Web Tokens) – for authentication

  • bcrypt – for password hashing

  • Sharp – to convert large images in common formats to smaller

πŸ“‚ Project Structure

πŸ“¦ clone-pinterest
β”œβ”€β”€ clients
β”‚   β”œβ”€β”€ public
β”‚   β”œβ”€β”€ src
β”‚   β”‚   β”œβ”€β”€ components
β”‚   β”‚   β”œβ”€β”€ routes
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   └── main.jsx
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ backend
β”‚   β”œβ”€β”€ controllers
β”‚   β”œβ”€β”€ models
β”‚   β”œβ”€β”€ routes
β”‚   β”œβ”€β”€ utils
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── index.js
β”‚
β”œβ”€β”€ README.md
└── docker-compose.yml

πŸ§ͺ Testing

This project uses Vitest along with React Testing Library to verify that components function correctly and the UI renders as expected.

▢️ Run Tests from CLI

cd client
npm run test

This command runs all unit and component tests in the terminal.

🧭 Visual Test Dashboard (UI)

To open the Vitest UI dashboard:

cd client
npm run test:ui

This will launch a visual interface where you can explore test results interactively.

🧰 Installation & Setup

  1. Clone the repository:

    git clone https://github.com/sekak/pinterest-clone.git
    cd pinterest-clone
    
  2. Set up the frontend:

     cd client
     npm install -f
    

🌐 Frontend Environment Setup

To configure the frontend environment, you need to define two environment variables:

VITE_URL_ENDPOINT_KIT=
VITE_API_BASE_URL=http://localhost:3000/api

πŸ”§ Step 1: Get the ImageKit URL Endpoint

  1. Go to https://imagekit.io and log in to your account.

  2. On the Dashboard, click on the β€œURL Endpoint” icon in the top-right corner.

  3. Navigate to:
    Configuration β†’ URL Endpoint

  4. You will see your existing URL endpoint. You can either:

    • Use the existing one

    • Or click β€œAdd New” to create a new endpoint

πŸ“Œ Copy the full URL (e.g., https://ik.imagekit.io/your_folder) and paste it into your .env file:

VITE_URL_ENDPOINT_KIT=https://ik.imagekit.io/your_folder

▢️ Step 2: Start the Front-end

Once your .env file is ready, run the development server:

npm run dev

Your app will now use the correct API base URL and ImageKit endpoint for uploading and rendering images.

3: Set up the Back-end:

cd backend
npm install

🌐 Back-end Environment Setup

To configure the back-end environment, create a .env file in the /backend folder and add the following variables:

MONGO=your_mongo_connection_string

CORS_ORIGIN=http://localhost:5173

JWT_SECRET=your_jwt_secret

IK_URL_ENDPOINT=your_imagekit_url_endpoint

IK_PUBLIC_KEY=your_imagekit_public_key

IK_PRIVATE_KEY=your_imagekit_private_key

PORT=3000

πŸ” Variable Descriptions & Setup

  • MONGO – MongoDB connection string

  • CORS_ORIGIN – Frontend origin allowed to access the backend

    • Use http://localhost:5173 for development

    • Use http://localhost:4173 when building for production

    • This secures the connection between the client and server.

  • JWT_SECRET – A secret string used to sign JSON Web Tokens

    • Choose a strong, unique string. Keep it secret.
  • IK_URL_ENDPOINT – ImageKit URL endpoint

    • This should match the one used in the frontend.

    • See the frontend setup section for steps to obtain it.

  • IK_PUBLIC_KEY & IK_PRIVATE_KEY – ImageKit API keys

    • Log in to ImageKit.io

    • Go to the Dashboard β†’ Developer Options

    • Copy both the public and private keys and add them to your .env file.

  • PORT – Server port (default: 3000)

    • Use this to define the port your Express app will run on. 3000.

▢️ Start the Back-end

Once your .env file is ready, run the development server:

npm start

🐳 Run the Project with Docker Compose

Instead of running the frontend and backend separately, you can run everything with Docker using the following command:

sudo docker compose up --build

Once the containers are built and running, open your browser and visit:

πŸ‘‰ http://localhost:4173

πŸ“Έ Screenshots

Screenshot from 2025-05-11 12-47-00 Screenshot from 2025-05-11 12-48-16 Screenshot from 2025-05-11 12-48-36 Screenshot from 2025-05-11 12-48-46 Screenshot from 2025-05-11 12-48-53 Screenshot from 2025-05-11 12-48-04

Responsive

Screenshot from 2025-05-11 12-47-36 Screenshot from 2025-05-11 13-09-02 Screenshot from 2025-05-11 13-08-50 Screenshot from 2025-05-11 13-08-42 Screenshot from 2025-05-11 13-08-31

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published