create account

Introducing Wishqus - A platform for making public wishes by singhpratyush

View this thread on: hive.blogpeakd.comecency.com
· @singhpratyush ·
$0.92
Introducing Wishqus - A platform for making public wishes
#### Repository

https://github.com/singhpratyush/wishqus

# 1. Introduction

[Wishqus](https://wishqus.com/) is a platform where people can share their wishes and see wishes from others. It has three major display modes - 
1. **Trending Wishes**: Most upwished wishes from previous 3 days.

2. **Latest Wishes**: Live wishes as they are created on the platform.

3. **Wishes by User**: All wishes that have been made by a user.

# 2. Technology Overview

The project is built using [React](https://reactjs.org) and [Firebase](https://firebase.google.com). It was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app) and uses [UIKit](https://getuikit.com/) for styling components.

### 2.1. Auth Flow

Wishqus uses Firebase for authorization and supports Google Sign In only. Using the firebase SDK, it becomes quite easy to implement auth flow - 

```js
import * as firebase from 'firebase';

firebase.initializeApp({
  // Firebase config goes here
});

let login = () => {
  let provider = new firebase.auth.GoogleAuthProvider();
  firebase.auth().signInWithPopup(provider);
}
```

This method uses a popup window for authenticating the user. The app reads user's UID, profile image and full display name only and modifies none.

### 2.2. Format of Firebase Storage

Firebase's Realtime Database is used for storing all the details related to a user. The structure of the database looks something like this - 
```
{
  "suggestions": [
    // An array of suggestions that come up in the wish input area
    ...
  ],
  "users": {
    "<user-id>": {
      "displayName": "<user-full-name>",
      "photoURL": "<url-to-user-photo>",
      "uid": "<user-id>",
      "wishes": {
        "<wish-id>": {
          // Wish object
          ...
        },
        // More wishes by the user
        ...
      }
    },
    // More users
    ...
  },
  "wishes": {
    "<wish-id>": {
      "createdAt": <utc-time>,
      "text": "<text-of-wish>",
      "upwishes": {
        "<user-id>": true,
        // More users
        ...
      },
      "user": {
        // Basic user object
        ...
      }
    },
    // More wishes
    ...
  },
}
```

This structure allows us to fire many reliable queries from the end user client - 

1. **Getting Trending Wishes**: Trending wishes can be fetched by getting all the wishes from previous three days (using Firebase) and sorting them based on the number of upwishes (on the client side).
2. **Getting Latest Wishes**: This becomes easy as a key in `wishes` object tells us about the time when a wish was created.
3. **Getting Wishes by a User**: This can be retrieved by making firebase query about the user.

### 2.3 Firebase Database Rules

Having proper database rules is very important for a Firebase project as it protects unauthorized/invalid modification of data. The rule used for the project looks something like this - 

```
{
  "rules": {
    "users": {
      "$uid": {
        ".write": "$uid === auth.uid",  // Only I can write on my user profile
        ".read": true,
        "wishes": {
          "$wishId": {
          	"upwishes": {
            	"$upwishUid": {
	              ".read": true,
	              ".write": "$upwishUid === auth.uid",  // Only upwish if authorized user is upwishing
	            },
              ".indexOn": ["createdAt"],  // For faster time based queries
	          }
          }
        }
      }
    },
    "wishes": {
      ".read": true,
      ".write": "auth.uid !== null",  // Only authorized users can create wishes
      ".indexOn": ["createdAt"],  // Faster time based queries
    },
    "suggestions": {  // All can read but no one can write except from admin panel
      ".read": true,
      ".write": false,
    }
  }
}
```

### 2.4 Firebase + Redux

Using Firebase with redux makes development much simple. We can simply listen to the firebase database using the SDK and update the redux store when needed. The updated store will seemlessly render the components that need rerendering, making the experience much fast for the user. Here is an example from the project which shows working of Firebase ref with redux actions - 

```js
import React from 'react';

class WishList extends React.Component {
	constructor(props) {
		super(props);
		this.startWishUpdate();
	}

	startWishUpdate() {
		this.databaseRef && this.databaseRef.off();
		this.databaseRef = this.props.getDatabaseRef();
		this.databaseRef.on('value', snapshot => {
			// Call action to update redux state
			this.props.wishActions.setWishes(this.props.category, snapshot.val());
		});
	}

	componentWillReceiveProps(nextProps) {
		if (this.props.cetegory !== nextProps.category) { 
			// Need to show wish for new category now
			this.startWishUpdate();
		}
	}

	componentWillUnmount() {
		// Stop listening to ref
		this.databaseRef.off();
	}
	...
}
```

# 3. Screenshots

**Trending Wishes**
![Trending wishes on the platform.png](https://ipfs.busy.org/ipfs/QmRAa5mZCuqA7Zg7DPD6hXdydeLSBQDv6VmZFbkGsG5FUb)

**User Profile**
![User profile view.png](https://ipfs.busy.org/ipfs/QmWZqKTqZcZbFdtf85Qu6FbfiPkN9X3N8K1RAYnRFc31hQ)


# 4. Roadmap and Future Plans

In future, I am planning to add the following features - 

1. **Donation system**: For now, I am looking for direct PayPal links in a wish, but I came across various projects regarding online donations and they look promising. This is one of the main motivation point of the project for me as it may open new possibilities for many people.
2. **Hashtags**: For a more immersive experience, hashtags are important. This would help other find/target a specific set of people and look for their interests on the platform.
3. **Replies to Wishes**: This feature would increase user engagement on the platform and come up with a more relevant feedback mechanism.
4. **Rewish**: A user would be able to add other's wishes in their list.
5. **Twitter Integration**: A user would be able to make wishes directly from Twitter by mentioning our account. Users would also be able to post wishes directly on Twitter as they create them.
6. **Follow**: A user would be able to follow other users, hence enabling them to look at what their friends are wishing for.
7. **Weekly Email Updates**: Most of the time, people do not have enough time to go to a new platform and see what others are up to, they already have Facebook, Twitter, YouTube, and whatnot. Having a weekly email which would keep them engaged would help them stay up to date.
8. **IDK, You tell me**: This is an open source project and I request you the community to give their input on how they want the product to look like. So if you have any idea, please [open an issue](https://github.com/singhpratyush/wishqus/issues/new) and let's discuss things over there.

# 5. Contributing to the Project

Contributing to the project is quite simple. If you see something that you would like to fix or if there is a new feature you would like to add, open an issue through [Github issue tracker for the project](https://github.com/singhpratyush/wishqus/issues) (if it doesn't exist already) and create a Pull Request if you would like to send a patch.

I am currently looking for a helping hand that could help me write some test cases for the project. Nobody loves writing tests but if you are interested, let's talk.

#### Github Account

https://github.com/singhpratyush
👍  , , , , , , , , , , , , , ,
properties (23)
authorsinghpratyush
permlinkintroducing-wishqus-a-platform-for-making-public-wishes
categoryutopian-io
json_metadata{"community":"busy","app":"busy/2.4.0","format":"markdown","tags":["utopian-io","development","wishqus","technology","firebase"],"links":["https://github.com/singhpratyush/wishqus","https://wishqus.com/","https://reactjs.org","https://firebase.google.com","https://github.com/facebookincubator/create-react-app","https://getuikit.com/","https://github.com/singhpratyush/wishqus/issues/new","https://github.com/singhpratyush/wishqus/issues","https://github.com/singhpratyush"],"users":["singhpratyush"]}
created2018-06-05 12:08:03
last_update2018-06-05 12:08:03
depth0
children2
last_payout2018-06-12 12:08:03
cashout_time1969-12-31 23:59:59
total_payout_value0.733 HBD
curator_payout_value0.183 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,379
author_reputation7,035,648,262,478
root_title"Introducing Wishqus - A platform for making public wishes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id59,362,858
net_rshares282,832,118,047
author_curate_reward""
vote details (15)
@gregory.latinier ·
$4.53
I'm sorry but this contribution doesn't follow the guidelines

"To be considered for potential reward, Bug Fixes and New Features should be submitted via Pull Requests. The Pull Request should have been merged within the past 14 days."

Your commit history is more than 20 days old.
What I find strange too is that there are 4 people on the team according to the README and yet only 1 contributor made commits.

Also if you're developing as a team you should consider using pull requests so that members can review each other code. Otherwise what's the point of a team ?

A few observations nonetheless.
- yours `dependencies`contains packages that should be in  `devDependencies`

- https://github.com/singhpratyush/wishqus/blob/master/src/components/WishList/index.js#L22 => did you really debug your code ? this will be always true ;) `cetegory` vs `category`

- Why naming a file with `.container` when they are in the `containers` folder ?

- You're using  `index.js` for components but not for containers

- I think you've inverted the roles of components and containers => you can check this article: https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0
You've bootstraped your project from Create React App and yet you didn't follow the author advice :D

I think I'll stop here!

Best of luck for your code refactoring if you want an utopian upvote !

Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/3/1332344).

---- 
Need help? Write a ticket on https://support.utopian.io/. 
Chat with us on [Discord](https://discord.gg/uTyJkNm). 
[[utopian-moderator]](https://join.utopian.io/)
👍  ,
properties (23)
authorgregory.latinier
permlinkre-singhpratyush-introducing-wishqus-a-platform-for-making-public-wishes-20180605t145649061z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://github.com/singhpratyush/wishqus/blob/master/src/components/WishList/index.js#L22","https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0","https://join.utopian.io/guidelines","https://review.utopian.io/result/3/1332344","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2018-06-05 14:56:48
last_update2018-06-05 14:56:48
depth1
children1
last_payout2018-06-12 14:56:48
cashout_time1969-12-31 23:59:59
total_payout_value3.398 HBD
curator_payout_value1.129 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,867
author_reputation34,278,323,818,021
root_title"Introducing Wishqus - A platform for making public wishes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,383,872
net_rshares1,496,894,969,657
author_curate_reward""
vote details (2)
@utopian-io ·
Hey @gregory.latinier
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.

**Contributing on Utopian**
Learn how to contribute on <a href="https://join.utopian.io">our website</a>.

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlink20180605t230930659z
categoryutopian-io
json_metadata{"tags":["utopian.tip"],"app":"utopian-io"}
created2018-06-05 23:09:30
last_update2018-06-05 23:09:30
depth2
children0
last_payout2018-06-12 23:09:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length416
author_reputation152,955,367,999,756
root_title"Introducing Wishqus - A platform for making public wishes"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,443,197
net_rshares0