Green Market Place is a sustainable product website designed with principles of sustainable web development and user-friendly design. This e-commerce platform not only allows users to explore and purchase sustainable products but also educates them about the product development process. To further its mission of promoting sustainability, the platform features a blog section where users can read and contribute content about sustainability.
A detailed project overview is available in this video presentation.
- E-commerce Functionality: Browse and purchase sustainable products.
- Education on Sustainability: Gain insights into the production process of items.
- Integrated Blog System: Read and write articles related to sustainability.
- Sustainable Web Development Practices: Designed with eco-friendly web principles.
The project consists of a single repository hosting both backend and frontend codebases.
- Framework: Built on Express.js.
- Database: Uses MongoDB for storing data.
- Environment Configuration: The
.env
file must include the following:MONGO_URI
: Connection string to your MongoDB instance.JWT_SECRET
: Secret key for signing JSON Web Tokens (JWT).
- Node.js Version: The project uses Node.js version
v22.9.0
, specified in the.nvmrc
file for environment consistency. - Code Quality Tools:
- Prettier: For consistent code formatting.
- ESLint: This is used to identify and fix JavaScript code issues.
- Framework: Developed using Next.js.
- State Management: Configured with a persistent Redux store using Thunk middleware for efficient state management and asynchronous actions.
- Placement: The frontend code is located in the
frontend
folder within the repository.
green-market-place/
├── bin/ # Application entry point
├── config/ # Configuration files
├── controllers/ # Route controllers
├── frontend/ # Frontend assets
├── middlewares/ # Custom middleware
├── models/ # Mongoose models
├── public/ # Static files (CSS, JS, images)
├── routes/ # Application routes
├── schemas/ # Data schemas
├── swagger/ # API documentation
├── tests/ # Unit and integration tests
├── app.js # Main application file
├── package.json # Project metadata and dependencies
└── README.md # Project documentation
- Node.js - Backend: Ensure you have
v22.9.0
installed (recommended to use nvm). - Node.js - Frontend: Ensure you have
v20.18.1
installed (recommended to use nvm). - Git: For cloning the repository.
- MongoDB: A running MongoDB instance (local or cloud).
- Package Manager: Either npm or yarn.
-
Clone the Repository:
git clone [email protected]:fahad-git/green-market-place.git cd green-market-place
-
Set Node Version:
nvm use
If
nvm
is not installed, install Node.js versionv22.9.0
manually. -
Install Dependencies: Navigate to the root directory and run:
npm install
Repeat the process in the
frontend
directory:cd frontend npm install
-
Configure Environment Variables: In the backend root directory, create a
.env
file and configure the following:MONGO_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/<database-name>?retryWrites=true&w=majority JWT_SECRET=your-secret-key
Replace
<username>
,<password>
,<database-name>
, andyour-secret-key
with your specific details. -
Run the Backend: In the root directory:
npm start
-
Run the Frontend: In the
frontend
directory:npm run dev
-
Access the Application: Open your browser and navigate to
http://localhost:3000
(default port for Next.js).
The backend uses Jest and Supertest for unit and integration testing. Tests are located in the tests
directory in the root folder.
- Install Testing Dependencies (if not already installed):
npm install --save-dev jest supertest
- Run Testss:
npm test
This executes all test suites and generates a coverage report.
- Test Coverage: To view detailed coverage:
npm run test:coverage
The frontend uses Jest and React Testing Library for testing components and Redux logic. Tests are located in the frontend/tests
directory.
- Install Testing Dependencies (if not already installed):
cd frontend npm install --save-dev jest @testing-library/react @testing-library/jest-dom
- Run Testss:
npm test
This runs all frontend test suites in watch mode (use --watchAll=false
for CI environments).
- Test Coverage: To view detailed coverage:
npm run test:coverage



We welcome contributions to improve the Green Market Place! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit changes:
git commit -m "GMP-1234: Add your descriptive message here"
- Push to your branch:
git push origin feature/your-feature-name
- Open a Pull Request.
This project is open-source and available under the MIT License.
"This project, Green Market Place, was developed as part of the Specialization in Web Technology course to fulfil its academic requirements."