|
1 |
| -# instaclone - in progress |
| 1 | +# instaclone |
2 | 2 |
|
3 | 3 | Instaclone is an Instagram clone written using the MERN stack + TypeScript.
|
4 | 4 |
|
5 | 5 | This is a final project after having completed [Full Stack Open 2022](https://fullstackopen.com/).
|
6 | 6 |
|
7 |
| -To check out the work completed so far, switch to the `dev` branch! |
8 |
| - |
9 | 7 | ### How to navigate this project
|
10 | 8 | #### Frontend
|
11 | 9 | - The frontend uses [RTK Query](https://redux-toolkit.js.org/rtk-query/overview). The [api slice](https://github.com/lyncasterc/instaclone/blob/dev/frontend/src/app/apiSlice.ts)
|
12 | 10 | handles data-fetching and caching. Here's an [example of data-fetching logic using RTK Query](https://github.com/lyncasterc/instaclone/blob/dev/frontend/src/common/hooks/useAuth.ts) in my `useAuth.ts` hook.
|
13 |
| -- [Mantine](https://mantine.dev/) is used for the styles. Check out the [`BottomNavBar`](https://github.com/lyncasterc/instaclone/tree/dev/frontend/src/common/components/BottomNavBar) for an example! |
14 |
| -- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) with [MSW](https://mswjs.io/) for unit and integration tests. Here's an [example](https://github.com/lyncasterc/instaclone/blob/dev/frontend/src/test/int/login.test.tsx)! |
| 11 | +- [Mantine](https://mantine.dev/) is used for styling. |
| 12 | +- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/) with [MSW](https://mswjs.io/) for unit and integration tests. Here's an [example](https://github.com/lyncasterc/instaclone/blob/dev/frontend/src/test/int/httpRefreshInterceptor.test.tsx) of a test I wrote to ensure that my HTTP interceptor for refreshing an expired access token is working. |
15 | 13 | - [Cypress](https://docs.cypress.io/) for e2e tests. Here's an [example](https://github.com/lyncasterc/instaclone/blob/dev/frontend/cypress/integration/navbar.spec.ts)!
|
16 | 14 |
|
17 | 15 | #### Backend
|
18 | 16 | - Uses a in-memory MongoDB server for testing and some development. [Check it out!](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/mongo/test-mongodb.ts) However, I'm using a Docker Mongo container for the majority of the development of this app. Here's the [docker-compose file.](https://github.com/lyncasterc/instaclone/blob/dev/backend/docker-compose.dev.yml)
|
19 |
| -- I seperate the Mongo querying logic from the Express routing logic. Each model has it's own _service_ ([User service example](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/services/user-service.ts)) and router ([User router example](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/routes/users.ts)). |
20 |
| -- Uses JWT for authentication. Here's the [login route](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/routes/login.ts) and the [`authenticator` custom middleware](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/utils/middleware.ts) used for protecting certain routes. |
21 |
| -- Uses [Cloudinary](https://cloudinary.com/documentation) for image uploading. Here's the [`cloudinary.ts` file](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/utils/cloudinary.ts) I've written so far (work in progress, but image uploading is working). |
22 |
| -- Integration tests using [Jest](https://jestjs.io/) and [supertest](https://github.com/visionmedia/supertest). [Example](https://github.com/lyncasterc/instaclone/blob/dev/backend/test/login-api.test.ts). |
23 |
| - |
24 |
| -### Things to do: |
25 |
| -- Core functionality of Instagram: |
26 |
| - - ~Creating accounts, logging in~ |
27 |
| - - ~Editing user profile, uploading profile image~ |
28 |
| - - ~Creating, viewing and deleting posts~ |
29 |
| - - ~following/unfollowing users~ |
30 |
| - - Commenting on posts, replying to comments |
31 |
| - - Liking posts and comments |
32 |
| - - Notification system |
33 |
| - - Searching for users. |
34 |
| -### To run on your machine: |
35 |
| -- clone this repo, then run `git checkout dev` to switch to the dev branch. |
36 |
| -- Run `cd frontend` to switch to the `frontend` directory. |
37 |
| -- run `npm run server:dev` to run the backend server. This also starts up an in-memory MongoDB server. |
38 |
| -- In a different terminal in the `frontend` directory, run `npm start.` |
39 |
| - |
40 |
| - |
41 |
| - |
| 17 | +- I seperate the Mongo querying/business logic from the Express routing logic. Each model has it's own _service_ ([User service example](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/services/user-service.ts)) and router ([User router example](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/routes/users.ts)). |
| 18 | +- Uses JWT and bycrypt for authentication and implements a refresh token/access token flow. Here's the [router handling authentication](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/routes/auth.ts) and the [`authenticator` custom middleware](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/utils/middleware.ts) used for protecting certain routes. |
| 19 | +- Uses [Cloudinary](https://cloudinary.com/documentation) for image uploading. Here's the [`cloudinary.ts` file](https://github.com/lyncasterc/instaclone/blob/dev/backend/src/utils/cloudinary.ts) I've written to work with the Cloudinary Upload API. |
| 20 | +- Integration tests using [Jest](https://jestjs.io/) and [supertest](https://github.com/visionmedia/supertest). [Example](https://github.com/lyncasterc/instaclone/blob/dev/backend/test/auth-api.test.ts). |
0 commit comments