Description | Features | Result | Thechnologies | Installation | Usage
A social media web app, developed as a group project, that enables users to sign up, log in, update their photos, write, edit, like other posts, delete their own posts and much more.
This project was one of the Makers Academy project where the goup was tasked with working on an existing application. A significant part of the challenge was to familiarise and understand the codebase that was inherited and ultimatly work to improve and extend it - which was successfully achieved.
It's was already possible for a user to:
- Sign up
- Sign in
- Sign out
- View a list of posts
The users can now:
- Sumbit, like and comment on posts
- Delete their own posts
- See a timestamp of when the post was submited
- Hear the 'moangoose' jingle and see web app's logo
- Access their profile page and log out via a nav bar
- Update name, username, password and select new profile icon
- Be required to fill in fields before signing up
- Be alerted when passwords don't match when creating an account
- Asked for confirmation when the user is about to delete their account
- Be alerted the password introduced is not correct.
- User can stay logged in for up to 24h with the use of user authentication cookies.
- Loading page:
- Home page:
- Profile page:
- Confirmation of account deletion:
Here's an overview of the technologies used to build this template application:
MongoDB is a NoSQL database program that stores data in collections of documents (in a format similar to JSON), rather than in tables. The application interacts with MongoDB using a tool called Mongoose.
Express is the Javascript equivalent of Sinatra. The structure of this application will feel quite different to what you're used to but the principles are the same.
React is a hugely popular tool that is used to build engaging front ends. The basic principle is that the front end is split up into components, each of which could include some logic, template structure (HTML) and styling (CSS).
Java script was originally designed to run exclusively in browsers, such as Chrome. Node is a tool that allows you to run Javascript outside the browser and its invention made it possible to build full stack Javascript apps.
We also used...
- Jest for unit testing on the back end.
- Cypress for end-to-end testing and component testing, on the front end.
- Mongoose to model objects in MongoDB.
- Handlebars for the
home
template. - ESLint for linting.
- Nodemon to reload the server automatically.
- Prettier to format the code.
- Clone the repository.
- Navigate to the project directory.
- Open index.html in your web browser to view the menu.
- Install Node Version Manager (NVM)
Then follow the instructions to update your
brew install nvm
~/.bash_profile
. - Open a new terminal
- Install the latest version of Node.js, currently
18.1.0
.nvm install 18
-
Clone to your local machine.
-
Install Node.js dependencies for both FE and BE (API)
; cd api ; npm install ; cd ../frontend ; npm install
-
Install an ESLint plugin for your editor. For example:
linter-eslint
for Atom. -
Install MongoDB
brew tap mongodb/brew brew install [email protected]
Note: If you see a message that says
If you need to have [email protected] first in your PATH, run:
, follow the instruction. Restart your terminal after this. -
Start MongoDB
brew services start [email protected]
-
Further install requirements:
-> for use of cookies attached to the client request object:
npm install cookie-parser
-> for parsing, validating, manipulating and disaying dates in JS:
npm install moment --save
For image upload functionality
npm install multer
- Start the server
Note the use of an environment variable for the JWT secret
; cd api
; JWT_SECRET=SUPER_SECRET npm start
- Start the front end
In a new terminal session...
; cd frontend
; npm start
You should now be able to open your browser and go to http://localhost:3000/signup
to create a new user.
Then, after signing up, you should be able to log in by going to http://localhost:3000/login
.
After logging in, you won't see much but you can create posts using PostMan and they should then show up in the browser if you refresh the page.
Note the use of an environment variable for the JWT secret
- Start the server in test mode (so that it connects to the test DB)
; cd api
; JWT_SECRET=SUPER_SECRET npm run start:test
- Then run the tests in a new terminal session
; cd api
; JWT_SECRET=SUPER_SECRET npm run test
Note the use of an environment variable for the JWT secret
- Start the server in test mode (so that it connects to the test DB)
; cd api
; JWT_SECRET=SUPER_SECRET npm run start:test
- Then start the front end in a new terminal session
; cd frontend
; JWT_SECRET=SUPER_SECRET npm start
- Then run the tests in a new terminal session
; cd frontend
; JWT_SECRET=SUPER_SECRET npm run test
Some people occasionally experience MongoDB connection errors when running the tests or trying to use the application. Here are some tips which might help resolve such issues.
- Check that MongoDB is installed using
mongo --version
- Check that it's running using
brew services list
If you have issues that are not resolved by these tips, please reach out to a coach and, once the issue is resolved, we can add a new tip!