Skip to content

📋 A Full-stack data display app with React frontend and Express-MongoDB-Node.js backend

Notifications You must be signed in to change notification settings

AndrewJBateman/mern-stack-data

Repository files navigation

⚡ MERN Full Stack Tracker

  • Mongo Express React Node (MERN) full-stack app, integrates React frontend with Node.js backend
  • Code from @EdRohDev with code changes and commenting added
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

📚 Backend

  • MongoDB Atlas used as the backend database - requires mongodb to be running
  • Mongoose query models used to interact with the database
  • Note: I used 'my ip address' as the whitelist network access in MongoDB.Atlas but this required daily updating when my ip address changed - otherwise with a non-matching ip address the backend simply did not work. Better to use the localhost address to avoid this problem but may be less secure.
  • Node.js routes used with controller functions
  • Nodejs diagram

📚 Frontend

  • React reducers functions that take the current state and an action as arguments, and return a new state result. In other words, (state, action) => newState.

📷 Screenshots

Backend screenshot Frontend screenshot

📶 Backend Technologies

📶 Frontend Technologies

💾 Setup - Backend

  • Install backend dependencies using npm i
  • Install nodemon globally if you don't already have it
  • Register with MongoDB Atlas, create & configure a database cluster and add connection string to .env file (see .env.example file)
  • Run npm run dev for a dev server
  • Backend data can be viewed using Thunder Client using urls for example: localhost:1337/kpi/kpis

💾 Setup - Frontend

  • Change to /client directory run npm run dev. Frontend will open at http://localhost:5173/

💻 Code Examples

  • Use React hook useMemo to cache results of data mapping
  const revenue = useMemo(() => {
    const revenueData =
      data &&
      data[0].monthlyData.map(({ month, revenue }) => {
        return {
          name: month.substring(0, 3),
          revenue: revenue,
        };
      });
    console.log("revenueData", revenueData);
    return revenueData;
  }, [data]);

🆒 Features

  • graph data stored in cache and derived from database data using map functions

📋 Status & To-Do List

  • Status: Working
  • To-Do: add commenting

👏 Inspiration

📁 License

  • N/A.

✉️ Contact

Releases

No releases published

Packages

No packages published