This is an educational project. The main idea is to demonstrate how one can build a scalable social network using Node.js, React, and Sql with Javascript.
This is a full stack project, the backend end uses Node.js with Express, and a MySql database. The frontend is React, with redux utilized for state management. We also utalize Firebase Cloud Storage to hold images, files, and user avatars.
Make Posts: post your favorite designs and thier files to share with others!
Download Files: See a design you like? Feel free to download and then print it!
Home Page: See the designs, and download files from your friends, and those that you follow on the network!
Discover Page: Gives you the opportunity to find new people, and discover popular posts on the network.
Discover People: Discover other 3D print designers, follow them, and use their designs!
Top Posts: Discover the top designs across the network!
Avatars: upload an avatar for your profile!
The Repo contains two main directories:
- client
- contains the react app comprising the frontend, and uses a middleware proxy to connect to the backend for requests
- server
- contains the express app that handles data being sent to frontend, and CRUD operations in the SQL db
- Clone the project
- Cd into server and npm install
- Cd into client folder and npm install
- Cd back into server
Now that the project is installed with dependencies...
- Create a Firebase Project for this app by following these instructions: https://firebase.google.com/docs/storage/web/start
- Download your preferred solution stack for hosting local Sql Servers (MAMP, WAMP, XAMPP).
OR - Setup an Amazon Auroura SQL db for use in the app
- Follow this article instructions to setup, inititalize, and then configue Auroura to allow inbound connections.
https://stackabuse.com/using-aws-rds-with-node-js-and-express-js/
- Start your solution stack, and navigate to localhost/phpmyadmin and log in
- Use MySql Workbench or command line to create a table with the included DB_Creator SQL file.
note: all Amazon Auroura info can be found under instance dashboard note: all firebse info can be found under project settings
Server Env file should contain:
- RDS_HOSTNAME = (Amazon Auroura RDS hostname or localhost if running on your machine)
- RDS_PORT = (Amazon Auroura port or local sql port: 3306)
- RDS_DB_NAME = (name of database) 4 .RDS_USERNAME =(Amazon Auroura username or username for sql server)
- RDS_PASSWORD = (Amazon Auroura password or password for sql server)
- PORT = (port for backend to run on)
Client Env contains Firebase Connection Keys that can be found in your Firebase Project Settings: - do not change ENV names React requires env names to start with REACT_APP_ -
- REACT_APP_API_KEY = (Firebase API Key)
- REACT_APP_AUTH_DOMAIN = (Firebase Auth domain)
- REACT_APP_DATABASE_URL = (Firebase databse url)
- REACT_APP_PROJECT_ID = (Firebase project ID)
- REACT_APP_STORAGE_BUCKET = (Firebase Storage Bucket ID)
- REACT_APP_MESSAGING_SENDER_ID = (Firebase messaging sender ID)
- REACT_APP_APP_ID = (Firebase App ID)
- REACT_APP_MEASUREMENT_ID =(Firebase measurment ID)
- cd inside of /server run command npm run dev
- wait to see db connected in console. (if this does not appear your ENV keys may be incorrect or if using Auroura check inboud connection rules).
- In client/src/setupProxy, set the target to be the location of the server (for example if you set server port to 5000, use http://localhost:5000)
- cd into /client and run npm start.
For this project I will be providing intructions on how to host via heroku.
- Make a heroku account: https://www.heroku.com/
- For detailed intructions on how to perpare a codebase for heroku follow these intructions:
https://devcenter.heroku.com/articles/preparing-a-codebase-for-heroku-deployment#1-track-your-codebase-in-a-git-repository
- cd inside of /server run heroku create
- create Procfile in server root specifying command to start server (https://devcenter.heroku.com/articles/procfile)
- make sure you are on master branch of the project and push to heroku with command git push heroku master
- navigate to the project console in the heroku
- add sever env vars to heroku under project settings (https://devcenter.heroku.com/articles/config-vars)
- Restart Dynos and check logs to see if db connected
- cd inside of /client run heroku create
- create Procfile in client root specifying command to start client (https://devcenter.heroku.com/articles/procfile)
- go into client/src/setupProxy and set the target to the heroku url for the server (then push changes to master)
- make sure you are on master branch of the project and push to heroku with command git push heroku master
- navigate to the project console in the heroku
- add client env vars to heroku under project settings (https://devcenter.heroku.com/articles/config-vars)
- Restart Dynos and check logs to see if frontend connected