Skip to content

An open-source social network built using the MERN stack, featuring real-time notifications, secure authentication, user permissions management, and rich interactions between users. The platform provides a dynamic environment for communication, with a focus on scalability and ease of use.

License

Notifications You must be signed in to change notification settings

joshmorenx/nodeNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodeNetwork

This is an open-source social network built using the MERN stack (MongoDB, Express, React, Node.js). It includes core features such as user registration, login, and logout. Users can interact through a dynamic feed to share content, explore user profiles, and manage a following system to stay updated with others. The platform also offers a personal gallery for images, a post search bar for easy content discovery, an admin dashboard for managing user permissions, and a secure password recovery system. Notably, the first registered user will always have admin privileges, regardless of explicit permissions. Additionally, the platform includes a robust system for liking and disliking both posts and comments, along with real-time notifications. Users are notified instantly when others interact with their posts or comments (e.g., through likes or dislikes), ensuring they stay engaged with their content, this project does not intend to compete with other social networks, it was just made to grow up my portfolio.

Take a look at the screenshots

First things first

This project uses a frontend environment with Vite, and a backend with Node.js and Express. Follow the steps to configure and run both environments locally.

Clone this repo

Start a new terminal, clone it and wait for it to finish the clone process

git clone https://github.com/joshmorenx/nodeNetwork.git

Then navigate to the cloned repo

cd ./nodeNetwork/

Install the dependencies

In the main folder "./nodeNetwork/", run the following command to install all necessary dependencies to run the project:

npm install

Navigate to server folder and then install server dependencies.

cd server
npm install

Now, go back to the root folder and navigate to client folder and then, install client dependencies.

cd ../client
npm install

Database connection

To connect the new database to the project, it's needed an account for MongoDB Atlas, after creating the account start a new database, after the database is created MongoDB will provide a connection Url, it will look like this example:

"mongodb+srv://username:[email protected]/databaseName?retryWrites=true&w=majority"

Note: this url will be used in a little.

Note: I recommend not to work in the same database as Production one, so create another database named e.g "Tests" or "Developement" and replace the string "databaseName" in the Url for the test database name.

Configuration of the .env files

Two .env files needs to be created, one for the client and another for the server.

.env file in the client folder:

VITE_BACKEND="http://localhost:3000"
VITE_FRONTEND="http://localhost:5173"

.env file in the server folder (Here we will be using the MongoDB given url):

CLIENT_URL="http://localhost:5173"
SERVER_URL="http://localhost:3000"
EMAIL="[email protected]"
MONGO_URL="mongodb+srv://username:[email protected]/databaseName?retryWrites=true&w=majority"
PASSWORD="examplepassword"
PORT=3000
SECRET="secretpassphrase"

Note: Make sure that the "EMAIL" variable string in the .env file from the server side is able to send emails.

Note: The port can be modified, but it is important that the frontend and backend are synchronized in the case of deployment, make sure to add environment variables pointing to the actual servers instead of localhost.

Running the project locally

After the completion of all steps must move to the root folder, before ./server and ./client folders

cd ..
npm start

then visit the Url given by Vite to see it in action.

Deployment Configuration

Note: For deployment, it's recommended to use Vercel for the frontend and Render for the backend.

When deploying the application, make sure the following: Update the environment variables to point to the actual URLs of your frontend and backend servers given from the actual providers. In the index.js file of the server side, add the URL of your frontend to the allowedOrigins array to allow the CORS frontend to consume the APIs, for example:

Frontend EXAMPLE Url given by Vercel: https://node-network-chi.vercel.app

const allowedOrigins = [
    'http://localhost:3000',
    'http://localhost:8080',
    'http://127.0.0.1:8080',
    'http://localhost:5173',
    'https://node-network-chi.vercel.app'
];

Screenshots

Desktop Login

Mobile Login

Desktop Register

Mobile Register

Desktop Password Recovery

Mobile Password Recovery

Desktop Feed dark mode

Comment in a post dark mode

Notifications in real-time Mobile

Notifications in real-time Desktop

Desktop Feed

Mobile Feed

Desktop User Profile

Mobile User Profile

Settings and Admin dashboard

Desktop

Mobile

About

An open-source social network built using the MERN stack, featuring real-time notifications, secure authentication, user permissions management, and rich interactions between users. The platform provides a dynamic environment for communication, with a focus on scalability and ease of use.

Topics

Resources

License

Security policy

Stars

Watchers

Forks