FollowStats - keep track of your followers and subscribers and get weekly emails
Published: 2022-01-14 02:42:56

[Instructions]: # (To submit to the MongoDB Atlas Hackathon on DEV, please fill out all sections.)


### Overview of My Submission
As part of the [MongoDB Atlas + Dev hackathon](https://dev.to/devteam/announcing-the-mongodb-atlas-hackathon-on-dev-4b6m), I am glad to present [FollowStats](https://followstats.vercel.app/). 
FollowStats enables you to be more intentional about building an audience and helps you to track your followers, subscribers from various platforms periodically. It keeps a daily track of your followers and subscribers count. You can view your growth/ decline of your followers and subscribers in an organized dashboard.
It also sends you a weekly overview of your audience to your email every Monday morning at 09:00.

[Live Application](https://followstats.vercel.app/)
[View Source Code](https://github.com/geekysrm/followstats)

### Submission Category: Action Star

[Note]: # (E-Commerce Creation, Prime Time, Action Star, Automation Innovation, or Choose Your Own Adventure)


### Link to Code {% github https://github.com/geekysrm/follow-stats %}

[Note]: # (Our markdown editor supports pretty embeds. Try this syntax: `{% github link_to_your_repo %}` to share a GitHub repository)


### Additional Resources / Info

#### Screenshots and Video

**User Dashboard**
![User Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ktm0yifuoknzhzpwqnwo.png)

**Settings Page**

![Settings Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bari64vpkix3utaqwz3h.png)

**Weekly Email Report**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcyk52hhzacwrf37qfx8.png)


I have prepared a **demo video** which can be viewed here: [Video Link](https://www.youtube.com/watch?v=7PIJK1eeT4s)

{% youtube 7PIJK1eeT4s %}

#### How to run the application locally:
- The `realm-backend` folder contains the code for MongoDB Realm Functions.
- A Sendgrid API Key is needed to be used in file https://github.com/geekysrm/followstats/blob/main/realm-backend/functions/sendFollowersReport.js#L66.
- The sendgrid email HTML code is here: https://github.com/geekysrm/followstats/blob/main/sendgrid-email-template.html
- Install all dependencies for the frontend: `npm i`
- The root app is a Next.js app which can be run by using: `npm run dev`.
- Auth0 also needs to be configured with GitHub as social login.
- Please create a `env.local` file at the root of the project with the following content:
```
AUTH0_SECRET=<Auth0 secret>
AUTH0_BASE_URL='http://localhost:3000'
AUTH0_ISSUER_BASE_URL=<Auth0 domain>
AUTH0_CLIENT_ID=<Auth0 client ID>
AUTH0_CLIENT_SECRET=<Auth0 client secret>
```

#### My experience
I had previously used MongoDB but was unaware of the cool functionalities like Realm functions, triggers etc.
I was really fascinated by how easy it is to build your backend using MongoDB Realm functions. We can easily import npm packages and use those too. I also used triggers for the first time to fetch followers' count everyday and send email report every Monday.

#### Technologies used
- MongoDB Realm functions for backend
- MongoDB Realm Triggers to keep track of follower count on schedule and send email on Monday
- Auth0 for login
- Taiwind CSS for styling
- Next.js as frontend framework


#### Challenges faced
The major challenge was to figure out the way to fetch followers/ subscribers data from various platforms. I had to try many methods (like using official API, scraping etc.) before I arrived at a method that works. 

#### What's next for FollowStats?
- Add more platforms like Instagram, LinkedIn and newsletter platforms like Mailchimp, Convertkit, Buttondown etc.
- Add charts and graphs to visualize followers' growth.

#### Try it Out
[Live Application](https://followstats.vercel.app/)
[View Source Code](https://github.com/geekysrm/followstats)
Please try this out and give your valuable feedback in the comments below or on [Twitter](https://twitter.com/geekysrm).

Again thanks to @mongodb_staff and @thepracticaldev for this amazing opportunity!