Coder Social home page Coder Social logo

mydiary's Introduction

Landing

Class 41 final project

This is the final project of our team for the HackYourFuture curriculum. We used the MERN stack and the agile methodology under control of our mentors. A quick guide to what we built:

The project 'My diary' is a social networking website developed by Team 2 of class 41. It provides a platform for users to create personal diaries and share their stories with friends and the community. Users can sign up and create profiles, add friends, and search for other users and posts. The website provides offers a variety of features and menu sections:

  • My Diary: Create your own personal diary and share your stories with friends, or create private posts just for yourself. Express yourself, capture your thoughts, and keep your memories in one place. You can even enhance your posts by adding photos to make them even more memorable and engaging.

    My posts page screenshot

  • Friends: Connect with friends by adding them to your friends list. Utilize the search functionality to find and connect with other users based on their first name, last name, birthday, country, or email. Expand your social circle and stay connected.

  • Feeds: Stay updated with the latest posts and activities from your friends. Explore a dynamic feed that displays posts, photos, and updates from the people you follow.

  • Search: Discover new users and posts through our comprehensive search functionality. Search for specific users posts or explore popular tags to find posts related to your interests. It's a great way to explore and engage with the community.

  • Settings: Customize your profile! Personalize your experience and manage your account settings with ease.

Additionally, our website is moderated by a dedicated team to ensure a safe and enjoyable environment. Our moderators have the ability to ban any inappropriate content to maintain a positive user experience for all.

Experience the power of social networking and connect with others through our user-friendly interface, designed to provide a smooth and engaging experience. Start sharing your stories, discovering new connections, and exploring a vibrant community on our social networking website.

Experience the full potential of our website with our interactive demo, where you can explore its captivating features using the demo login credentials: username "[email protected]" and password "12345678".

Click here for the Demo version

1. Setup

First, to setup all the directories run the following in the main directory:

npm install

npm run setup

The first command will install cypress and some small libraries needed for running the rest of the commands. The second will go into the client and server directories and set those up to be ran.

In the client and server directory there are two .env.example files. Create a copy and rename that to .env. Then follow the instructions in those files to fill in the right values.

To run the app in dev mode you can run the following command in the main directory:

npm run dev

2. Code structure

client
├── public
└── src
|   └── __tests__
|   └── __testUtils__
|   └── assets
|   └── components
|   └── context
|   └── hooks
|   └── pages
|       └── __tests__
|   └── util
|   index.jsx
cypress
|   └── fixtures
|   └── integration
|   └── plugins
|   └── support
server
└── src
    └── __tests__
    └── __testUtils__
    └── controllers
    └── db
    └── middleware
    └── models
    └── routes
    └── util
    index.js

2.1 Client structure

  • public || public facing client code
  • __tests__ || any jest tests for specific components will be in a __tests__ folder on the same level
  • __testUtils__ || any code that is only being used in the tests is put in the __testUtils__ folder to separate that away from the rest of the code
  • components || all of our shared components that are used over multiple pages
  • hooks || all of our custom hooks
  • pages || the page components of our app, any routing will go between these components
  • pages/components || components used specifically on those pages
  • util || any utility functions that can be used anywhere on the client side
  • index.jsx || the start point of the client

2.2 Cypress structure

  • fixtures || any data/files that cypress needs can be placed here
  • integration || all of our tests are in here, separated in folders based on the pages in our app
  • plugins || any plugins for our cypress configuration can be placed here
  • support || custom commands and other support files for cypress can be placed here

2.3 Server structure

  • __tests__ || any jest tests for the api endpoints as that is our testing strategy for the backend
  • __testUtils__ || any code that is only being used in the tests is put in the __testUtils__ folder to separate that away from the rest of the code
  • controllers || all of our controller functions that interact with the database
  • db || all of our configuration for the database
  • models || all of our mongoose models will be placed here
  • routes || code to match up the API with our controllers
  • util || any utility functions that can be used anywhere on the server side
  • index.js || the start point of the server

3. Stack / external libraries

The base stack of the app is a MERN stack (Mongoose, Express, React, Node). Next to that we make use of the following extras:

3.1 Configuration libraries

  • dotenv || To load the .env variables into the process environment. See docs
  • webpack / html-webpack-plugin || To bundle our React app and create a static app to host. See docs
  • husky || To run our tests and linter before committing. See docs
  • eslint || To check our code. We have different configurations for frontend and backend. You can check out the configuration in the .eslintrc.(c)js files in the respective client and server folders. See docs
  • prettier || To automatically format our code. See docs
  • concurrently || To run commands in parallel. See docs

For more information on how these work together including the automatic deployment to heroku, have a look at our detailed DEV file.

3.2 Client-side libraries

  • @testing-library/* || We use React Testing Library to write all of our tests. See docs
  • jest || To run our tests and coverage. See docs
  • jest-fetch-mock || To mock out the backend for our testing purposes. See docs
  • prop-types || To type-check our components. See docs

3.3 Server-side libraries

  • nodemon || To automatically restart the server when in development mode. See docs
  • jest || To run our tests and coverage. See docs
  • supertest || To more easily test our endpoints. See docs
  • mongodb-memory-server || To mock out our database in our backend tests. See docs
  • cors || To open up our API. See docs
  • mongoose || To add schemas to our database. See docs
  • cloudinary || A cloud-based service for managing and delivering images and other media files. See docs
  • express-fileupload || A middleware for handling file uploads in Express.js. See docs
  • bcrypt || A library used for hashing passwords and performing password hashing functions. See docs
  • jsonwebtoken || A library for generating and verifying JSON Web Tokens (JWTs) in Node.js. The jsonwebtoken library provides functions to generate tokens, verify their authenticity, and extract the payload information. See docs
    To protect certain routes or endpoints that require authentication, we use the jsonwebtoken library along with custom middleware. The middleware verifies the integrity and authenticity of the JWT provided in the Authorization header of the request. If the token is valid, it allows access to the protected resource; otherwise, it returns an appropriate error response.

mydiary's People

Contributors

andryushik avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.