Introducing Code Network - A Social Network πŸ”΅βšͺ️

Introducing Code Network - A Social Network πŸ”΅βšͺ️

The social network developers have been craving

Β·

5 min read

✨ Introduction

Hey everyone,

Today, I am sharing the project I have built for the Netlify X Hashnode hackathon.


πŸ”΅ About Code Network βšͺ️

Code Network is an open-source social network built for developers that allows you to share posts, follow other developers and play a fun game called Tech Trivia. The application is hosted on Netlify which is an awesome hosting service with a bunch of valuable features. The project combines with the positive social aspects of a social network with the fun elements of playing a game.

Try it out the application: Code Network

image.png


πŸ’‘ The Inspiration

I've always wanted to build a social network that is specifically tailored towards developers. I've also been wanting to get into serverless functions and building applications with them. When I saw this hackathon, I thought it would be a perfect opportunity to achieve both. I could build an awesome social network for developers whilst learning lambda functions (through Netlify Functions).

Hence, Code Network was born.


✏️ Features

Here is a list of what you can do on Code Network:

  • Create posts
  • Read other user's posts
  • Comment on people's posts
  • Interact with posts by liking or disliking
  • Follow users
  • Play tech trivia (a fun trivia game)


βš™οΈ Tech Stack

Code Network was built with a JavaScript tech stack including:

  1. React
  2. Redux for state management (via reduxjs/toolkit)
  3. Tailwind CSS for styling
  4. Netlify Serverless Functions for the backend
  5. MongoDB as a DB (through Atlas)
  6. Open Trivia DB API for trivia questions


πŸ‘€ What The Application Looks Like

When you first load onto Code Network, it displays a very nice landing page:

Home Screenshot

You can then create an account through the register page:

Register

Or sign in through the login page:

Login

Once signed up, you are taken to the home page where a introductory modal opens up and runs through a few simple questions to finish your registration:

Welcome Modal 1

Welcome Modal 2

Welcome Modal 3

Welcome Modal 4

You can view the home page which features other people's posts, links to play tech trivia and write a post as well as a list of users to follow:

Home Page

Through the navigation bar you can navigate to the users page (devs), the posts page, the trivia page or your profile through the dropdown menu on the right:

Dropdown Menu

The developers page (/users) lets you see others users and follow/unfollow them:

Developers Page

The posts page (/posts) shows other people's posts and have a form up the top allowing you to write your own:

Posts Page

For each post you can view and write comments as well as like/dislike:

Individual Post

If you own the post, you can edit its details or delete it through post settings:

Editing a post

The tech trivia page (/trivia) lets you play tech trivia which is a trivia game that asks you random questions about technology and tracks your score. You can select how many questions you wish to answer as well as the difficulty of questions:

Trivia Page

Trivia Page With Question

Trivia Page When Game Is Finished

The profile page (/users/:id) shows the user's name and headline and also all of the posts they have made:

Profile Page


πŸ‘Œ Code Quality

To ensure consistent formatting throughout the code base, the code was formatted using prettier via the VS code extension.


πŸ’ͺ Difficulties I Had To Overcome

While building the project i had to overcome a variety of bugs and problems.

To name a few:

  • Netlify Dev not starting up server with no apparent reason why. After numerous hours, I figured out why the issue was happening and was able to fix it.

  • Handling authentication in a neat and organised way was a challenge at first. Since I didn't want to have to check if the user is authenticated on every protected route. To solve this, I created to separate app components (AuthenticatedApp and UnauthenticatedApp) which each help their routes for authenticated users and not authenticated users. I then conditionally rendered each app based off whether the user was authenticated or not. Got the idea from this article.

    return (
          <BrowserRouter>
              {isAuthenticated ? <AuthenticatedApp /> : <UnauthenticatedApp />}
          </BrowserRouter>
      );
    
  • How to display error messages and success messages to the user in an organized manner was another challenge. I didn't want to use an Alert component in every part of the application that would need to handle errors. Fortunately, i discovered a cool package called react-toastify which lets you easily display all sorts of messages to the user in the form of popups. This was then implemented across the application.


🧠 What I Learned Creating The Application?

I am very happy to have participated in this hackathon since I learned a lot whilst building my application and also had a fun time doing so. Some of the things I learned:

  • How lambda functions work thanks to Netlify Functions
  • How to build a quiz style game
  • And licensing a project on GitHub


πŸš€Future Plans

In the future, I intend on adding a ton of cool features to make this application even better.

Some potential future features include:

  • Custom profile pictures via cloudinary image upload
  • Attach code snippets and images to posts
  • Add links to other platforms like GitHub to a user's profile
  • Live messaging with Firebase


πŸ”— Useful Links


πŸ‘‹ Thanks Again

Thanks to Netlify and Hashnode for hosting this amazing hackathon.

Let me know what you think about Code Network in the comments below. If you wish to contribute to this open-source project, feel free to take a look at the contribution guide in the GitHub repo. Thanks for reading this article and have an awesome day! πŸ”΅ βšͺ️

Also, feel free to connect with me on other social platforms:

GitHub: Blake-K-Yeboah

LinkedIn: Blake Yeboah

Twitter: BlakeYeboah

You can also show your support by buying me a coffee πŸ˜ƒ

Did you find this article valuable?

Support Blake Yeboah by becoming a sponsor. Any amount is appreciated!

Β