|
| 1 | +# Blog List app |
| 2 | + |
| 3 | +**An app that lets users manage blog links, share, like and comment.** |
| 4 | + |
| 5 | +**[Try it out]()** |
| 6 | + |
| 7 | +Test username/password: **tim / tim** |
| 8 | + |
| 9 | +Frontend: React, Redux, Styled-components, Storybook |
| 10 | + |
| 11 | +Backend: Node, Express, MongoDB, Mongoose |
| 12 | + |
| 13 | +This project started out as my submission in part 7 of the |
| 14 | +[Full Stack course](https://fullstackopen.com/en/part7) |
| 15 | +to learn redux and grew from there. |
| 16 | + |
| 17 | +## Dev build |
| 18 | + |
| 19 | +Requirements (works on version): |
| 20 | + |
| 21 | +- node 11.10 |
| 22 | +- mongodb v3.4 or mongo cloud - sign up for a |
| 23 | + [free account](https://www.mongodb.com/cloud) |
| 24 | + |
| 25 | +Server secrets are stored in `.env` in project root so create the env |
| 26 | +vars like the example below: |
| 27 | + |
| 28 | +``` |
| 29 | +MONGODB_URI=mongodb+srv://tim:<password>@fullstackopen-9zjso.mongodb.net/blog-list?retryWrites=true&w=majority |
| 30 | +PORT=3003 |
| 31 | +SECRET=jsonwebtokensuperdupersecret |
| 32 | +``` |
| 33 | + |
| 34 | +The client uses create-react-app and proxies all backend requests. |
| 35 | +In order for the client to talk to the server, the port chosen above |
| 36 | +needs to match the one inside `package.json` in `/client` |
| 37 | + |
| 38 | +``` |
| 39 | +"proxy": "http://localhost:3003", |
| 40 | +``` |
| 41 | + |
| 42 | +Run `npm i` in `/client` and `/server` |
| 43 | + |
| 44 | +## Running locally |
| 45 | + |
| 46 | +In `/client`: |
| 47 | + |
| 48 | +``` |
| 49 | +npm start |
| 50 | +npm run server |
| 51 | +npm run storybook (for visual testing) |
| 52 | +``` |
| 53 | + |
| 54 | +## Notes |
| 55 | + |
| 56 | +Things I added on top of the project requirements: |
| 57 | + |
| 58 | +- pagination with client caching |
| 59 | +- sort by fields |
| 60 | +- multiple blog deletion |
| 61 | +- form validation |
| 62 | +- a design system...sort of (check out the storybook) |
| 63 | +- notifications |
| 64 | +- mobile responsive |
| 65 | +- react-spring animations |
| 66 | + |
| 67 | +Learnt some notable things: |
| 68 | + |
| 69 | +- Redux |
| 70 | + - normalizing data reduces stale data, improves performance |
| 71 | + - co-locating selectors in reducers makes refactors in state data |
| 72 | + structure changes easier |
| 73 | + - redux middleware scales better for async actions over redux thunks |
| 74 | +- styled-components |
| 75 | + - not needing to name classes is a win |
| 76 | + - easier to remove dead code |
| 77 | + - dynamic styles based on props are convenient |
| 78 | +- React hooks |
| 79 | + - logic reuse and less boiler plate is a major plus |
| 80 | + - a lot of subtle gotchas compared with classes |
0 commit comments