Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions Documentation.md

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove Documentation.md file.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
### How to Run

- Clone the repository for this project by running the following command in a terminal:
##### `git clone https://github.com/lugenx/ecohabit.git`
- Open the cloned folder in VS Code. Open the terminal and make sure its pointing to the root of the cloned project.


- Database creation
- Create a mongodb account through the [MongoDB Website](https://www.mongodb.com)
- Create a cluster (by default is Cluster0 which can be used)
- Once the cluster is up, you need to click on the 'Connect' tab and follow the drivers section to retrieve the mongodb connection url and save it for the next steps

<br>

- Running Backend Node JS Application:

- Change the directory to server folder using terminal command: `cd server`
- At the root of the server directory, create an .env file and copy the content from .env.example into the new .env file.
- update the 'MONGODB_URL' property in the .env file with the mongodb connection url saved during Database creation
- In the server directory, you can run:

##### `npm install`

- It'll download all the packages/dependencies as defined in package.json file. Once the system completes this process, we can type below command:

##### `npm start`

- Runs the app in the development mode.
- You can start making http calls to [http://localhost:3001](http://localhost:3001)

- Running Frontend React JS Application:

- Change the directory to client folder using terminal command: `cd client`
- In the client directory, you can run:

##### `npm install`

- It'll download all the packages/dependencies as defined in package.json file. Once the system completes this process, we can type below command:

##### `npm start`

- Runs the app in the development mode.
- Open [http://localhost:3000](http://localhost:3000) to view it in the browser

- The page will reload if you make edits.
- You will also see any lint errors in the console.

- Insert habit dummy data:

- Go back to the MongoDB website to your project you created.
- You will see a 'test' collection populated
- Inside 'test', you will find 'habit' as a subcollection, open it and you can insert the below dummy documents

```
{
category: "Recycle",
description: "Reduce the amount of waste by using reusable bags!",
question: "Which one of these did you use today?",
answerOptions: ["clothbag"],
__v:0
}
```

```
{
category: "Commute",
description: "Carpool with coworker or friends",
question: "How did you commute to work today?",
answerOptions: ["Uber", "Lyft"],
__v:0
}
```

```
{
category: "Recycle",
description: "Separate bin for recycle stuff",
question: "How much did you dump today for recycle",
answerOptions: ["3boxes", "4boxes"],
__v:0
}
```
- Note: When you insert a document, append the above json fields to the already defined unique id in the document

- The link [MongoDB Insert Document](https://www.mongodb.com/docs/manual/tutorial/insert-documents/)
shows how to insert the document in the mongodb manually through the UI



56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,22 @@ If you prefer the command line way of downloading and installing things, then fe
##### `git clone https://github.com/lugenx/ecohabit.git`
- Open the cloned folder in VS Code. Open the terminal and make sure its pointing to the root of the cloned project.

- Running Backend Node JS Application:

- Create Database for development use:

- Create a mongodb account through the [MongoDB Website](https://www.mongodb.com)
- Create a cluster (by default is Cluster0 which can be used)
- Once the cluster is up, you need to click on the 'Connect' tab
- Follow the drivers section to retrieve the mongodb connection url and save it for the next steps
- Connection url - mongodb+srv://(username):(password)@cluster0.xqzlrqf.mongodb.net/(databasename)?retryWrites=true&w=majority
- Replace the username and password you used for the mongo db account and put a databasename (eg. ecohabit)


- Run the backend NodeJS application:

- Change the directory to server folder using terminal command: `cd server`
- At the root of the server directory, create an .env file and copy the content from .env.example into the new .env file.
- Update the 'MONGODB_URL' property in the .env file with the mongodb connection url saved
- In the server directory, you can run:

##### `npm install`
Expand Down Expand Up @@ -80,6 +92,48 @@ If you prefer the command line way of downloading and installing things, then fe
- The page will reload if you make edits.
- You will also see any lint errors in the console.

- Insert habit dummy data:

- Go back to the MongoDB website to your project.
- The collection with the databasename you provided will be present (created when you started the server app)
- Inside the collection, you will find 'habits' as a subcollection
- Open it and you can insert the below dummy documents

```
{
"category": "Recycle",
"description": "Reduce the amount of waste by using reusable bags!",
"question": "Which one of these did you use today?",
"answerOptions": ["Reusable bag", "Plastic bag", "Both", "None"]
}
```

```
{
"category": "Commute",
"description": "Carpool with coworker or friends",
"question": "How did you commute to work today?",
"answerOptions": ["Drived", "Carpooled", "Bike", "Public Transport"]
}
```

```
{
"category": "Recycle",
"description": "Separate your recycble materials",
"question": "Did you separate your recycble materials today?",
"answerOptions": ["Yes", "No"]
}
```

@lugenx lugenx Nov 12, 2023

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just paid attention to the content here, I know this is just test data, but I think it would be nice to have the data closer to something we would really use in real. For example, having Uber or Lyft as ridesharing is not something our habit tracker shoud care about. See the below data as example:

  {
    "category": "Recycle",
    "description": "Reduce the amount of waste by using reusable bags!",
    "question": "Which one of these did you use today?",
    "answerOptions": ["Reusable bag", "Plastic bag", "Both", "None"]
  }
  {
    "category": "Commute",
    "description": "Carpool with coworker or friends",
    "question": "How did you commute to work today?",
    "answerOptions": ["Drived", "Carpooled", "Bike", "Public Transport"]
  }
  {
    "category": "Recycle",
    "description": "Separate your recycble materials",
    "question": "Did you separate your recycble materials today?",
    "answerOptions": ["Yes", "No"]
  }

- Note: When you insert a document, append the above json fields to the already defined unique id in the document

- The link [MongoDB Insert Document](https://www.mongodb.com/docs/manual/tutorial/insert-documents/)
shows how to insert the document in the mongodb manually through the UI


- The page will reload if you make edits.
- You will also see any lint errors in the console.

## Roadmap

- _List any features planned_
Expand Down
5 changes: 5 additions & 0 deletions docs/ideas.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
- environment-friendly online stores (+1)
- environment-friendly events
- environment-friendly alternatives of popular products and services
- When it comes to flying, tracking peoples monthly or half-yearly travels, whether they use economy or business
(business classes emits 3 times more CO2 than economy class)
- Help them to track their energy bills thus help them keep their energy usage as per the need (so less fuel usage and less greenhouse gases emission)

- We could also provide some broader analysis (across the world or across US) as a analytics dashboard tab for them to understand the big picture and also means of attracting people to use the app

- links to environmental charities (+1)
- crowdfunding feature to donate to environmental charities
Expand Down