|
1 |
| -<h1 align="center">👻 SnapChat clone</h1> |
| 1 | +<h1 align="center">👻 SnapChat Clone</h1> |
2 | 2 |
|
3 |
| -<h2 align="center"> |
4 |
| - <a href="https://google.com">[LIVE DEMO]</a> |
5 |
| -</h2> |
6 |
| -<p align="middle"> |
7 |
| - <a href="public/github/snapchat.mp4"> |
8 |
| - <img src="public/github/snapchat.gif" width="400" /> |
9 |
| - </a> |
10 |
| -</p> |
11 |
| -<p align="middle"> |
12 |
| - 👆Click the image for a video showing what you can currently do! |
13 |
| -</p> |
| 3 | +# ⚡️Breakdown |
14 | 4 |
|
15 |
| -# ⚡️ Breakdown |
| 5 | +<div style="overflow:hidden;vertical-align:top"> |
| 6 | + <p style="float:left;width:35%;margin:0"> |
| 7 | + <a href="public/github/snapchat.mp4"> |
| 8 | + <img src="public/github/snapchat.gif" /> |
| 9 | + <br /> |
| 10 | + 👆Click to see all implemented features |
| 11 | + </a> |
| 12 | + </p> |
| 13 | + <div style="float:left;width:50%"> |
| 14 | + |
| 15 | + <h2 align="center"> |
| 16 | + <a href="https://google.com">[LIVE DEMO]</a> |
| 17 | + </h2> |
16 | 18 |
|
17 | 19 | - Built with `React`
|
18 | 20 | - Functional components using hooks
|
19 | 21 | - Feature based folder structure
|
20 | 22 | - `common` directory for shared components
|
21 | 23 | - Bootstraped using `Create React App`
|
22 | 24 | - Global state management via `Redux`
|
23 |
| - - Follows the modular [ducks](https://github.com/erikras/ducks-modular-redux) proposal to bundle action types, creators and reducers all in one file |
| 25 | + - Follows the modular [ducks](https://github.com/erikras/ducks-modular-redux) proposal to bundle action types, creators and reducers all in one file (reducing the need to jump around) |
24 | 26 | - Flat state tree (avoids deeply nested properties)
|
25 | 27 | - Follows official Redux styleguide recomendations for naming actions and action types, e.g. `camera/photosFetched` vs `SET_PHOTOS`
|
26 | 28 | - Uses `thunk` middleware for async operations
|
27 | 29 | - Type checked with `Typescript`
|
28 | 30 | - Unit tested with `Jest` and `Enzyme`
|
29 |
| -- End-to-end tested in `Cypress` |
| 31 | +- End-to-end tested with `Cypress` |
30 | 32 | - Custom component library showcased in `Storybook`
|
31 | 33 | - Linted using `Eslint`
|
32 | 34 | - Code is auto formatted using `Prettier` (ran as a pre-commit git hook) before it gets pushed to the repo
|
| 35 | +- Feels close to a native app if you "add to homescreen" on mobile |
| 36 | + |
| 37 | +<h2 align="center"> |
| 38 | + <a href="https://google.com">[LIVE DEMO]</a> |
| 39 | +</h2> |
| 40 | + |
| 41 | + </div> |
| 42 | +</div> |
33 | 43 |
|
34 | 44 | # 💿 Installation
|
35 | 45 |
|
36 | 46 | Run these commands in the terminal:
|
37 | 47 |
|
38 |
| -- `> git clone [email protected]:TowhidKashem/snapchat-clone.git` |
39 |
| -- `> cd snapchat-clone` |
40 |
| -- `> npm install` |
41 |
| - - This will: |
42 |
| - - Install the dependencies in package.json |
43 |
| - - Checkout [jeelizFaceFilter](https://github.com/jeeliz/jeelizFaceFilter_) package (used for filters) and set it to the last version this project was tested and confirmed to work with |
44 |
| - - Run `gulp` to concatenate, minify and transpile the files located in `public/filters/source/*.js` into a single file called `filters.min.js` |
45 |
| -- This part is optional but strongly recomended, without it you won't be able to view any of the snap map features: |
46 |
| - - Make a Mapbox account and [get a free API key](https://docs.mapbox.com/help/glossary/access-token/) |
47 |
| - - Rename the `.env.sample` file at the root of the project to just `.env` |
48 |
| - - Inside enter your new API key, for example: |
49 |
| - - Before: `REACT_APP_MAP_BOX_API_KEY=<REPLACE_WITH_API_KEY>` |
50 |
| - - After: `REACT_APP_MAP_BOX_API_KEY=az.xyz123` |
51 |
| -- `> npm start` |
52 |
| - - The app should open automatically in your browser at `https://localhost:3000/` |
53 |
| - - In Chrome you will receive a "Your connection is not private" error |
54 |
| - - Click "Advanced" > "Proceed to localhost (unsafe)" |
| 48 | +1. `> git clone [email protected]:TowhidKashem/snapchat-clone.git` |
| 49 | +2. `> cd snapchat-clone` |
| 50 | +3. `> npm install` |
| 51 | + |
| 52 | +- This will: |
| 53 | + - Install the dependencies in package.json |
| 54 | + - Checkout [jeelizFaceFilter](https://github.com/jeeliz/jeelizFaceFilter_) package (used for the filters) and set it to the last version this project was tested and confirmed to work with |
| 55 | + - Run `gulp` to concatenate, minify and transpile the files located in `public/filters/source/*.js` into a single file called `filters.min.js` |
| 56 | + |
| 57 | +4. This part is optional but strongly recomended, without it you won't be able to view any of the snap map features: |
| 58 | + |
| 59 | + - Make a Mapbox account and [get a free API key](https://docs.mapbox.com/help/glossary/access-token/) |
| 60 | + - Rename the `.env.sample` file at the root of the project to just `.env` |
| 61 | + - Inside enter your new API key, for example: |
| 62 | + - Before: `REACT_APP_MAP_BOX_API_KEY=<REPLACE_WITH_API_KEY>` |
| 63 | + - After: `REACT_APP_MAP_BOX_API_KEY=xy.abc123` |
| 64 | + |
| 65 | +5. `> npm start` |
| 66 | + |
| 67 | +- The app should open automatically in your browser at `https://localhost:3000/` |
| 68 | + - In Chrome you will receive a "Your connection is not private" error |
| 69 | + - Click "Advanced" > "Proceed to localhost (unsafe)" |
| 70 | + - You'll get this warning because the app uses a self signed `https` certificate. The `getUserMedia` API used by the camera requires the `https` protocol so we run the dev server in https mode. |
55 | 71 |
|
56 | 72 | <p align="middle">
|
57 | 73 | <img src="public/github/https-step-1.png" width="400" />
|
58 | 74 | <img src="public/github/https-step-2.png" width="400" />
|
59 | 75 | </p>
|
60 | 76 |
|
61 |
| -You'll get this warning because the app uses a self signed `https` certificate. The `getUserMedia` API used by the camera requires the `https` protocol so we run the dev server in https mode. |
62 |
| - |
63 |
| -- After this you will be prompted to give access to your webcam, click "Allow" |
| 77 | +6. After this you will be prompted to give access to your webcam, click "Allow" |
64 | 78 |
|
65 | 79 | <p align="middle">
|
66 |
| - <img src="public/github/camera-access.png" width="400" /> |
| 80 | + <img src="public/github/camera-access.png" width="300" /> |
67 | 81 | </p>
|
68 | 82 |
|
69 |
| -- You're all set up! |
| 83 | +7. You're all set! |
70 | 84 |
|
71 | 85 | # 🦮 Guides
|
72 | 86 |
|
73 |
| -Not all the buttons are actionable, many of them are there just for show since this is a minimal demo. The video at the top of this README shows all the things you can currently do. |
| 87 | +<div style="overflow:hidden"> |
| 88 | + <img src="public/github/guide.png" width="150" style="float:left;margin-right:20px" /> |
| 89 | + |
| 90 | +Not all the buttons are actionable, many of them are there just for show since this is a minimal demo. [This video]() shows all the things you can currently do. |
74 | 91 |
|
75 | 92 | Where it's not obvious which buttons actually work I added a red box-shadow as guide:
|
76 | 93 |
|
77 |
| -<p align="middle"> |
78 |
| - <img src="public/github/guide.png" width="300" /> |
79 |
| -</p> |
| 94 | +</div> |
80 | 95 |
|
81 | 96 | # 🛠 Tooling
|
82 | 97 |
|
83 |
| -- The app has it's own component library and uses Storybook to showcase them. You can run Storybook using the command `npm run storybook`. |
84 |
| - |
85 | 98 | <p align="middle">
|
86 |
| - <img src="public/github/storybook.png" width="600" /> |
| 99 | + <img src="public/github/storybook.png" width="400" /> |
| 100 | + <img src="public/github/redux-extension.png" width="400" /> |
87 | 101 | </p>
|
88 | 102 |
|
89 |
| -- The Redux Devtools Extension is implemented in the app, it makes things like viewing the state, state flow and debugging much easier, you can install the browser extension [here](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en) or [here](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/). |
90 |
| - |
91 |
| -<p align="middle"> |
92 |
| - <img src="public/github/redux-extension.png" width="600" /> |
93 |
| -</p> |
| 103 | +- The app has it's own component library and uses Storybook to showcase it. You can run Storybook using the command `npm run storybook`. |
| 104 | +- The Redux Devtools Extension is implemented in the app, it makes things like viewing the state, state flow and debugging much easier, to use it you need to install the browser extension [here](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en) or [here](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/). |
94 | 105 |
|
95 | 106 | # 🧪 Testing
|
96 | 107 |
|
@@ -119,17 +130,25 @@ There are two types of tests in the app (end to end and unit).
|
119 | 130 |
|
120 | 131 | ## Unit tests:
|
121 | 132 |
|
| 133 | +<div style="overflow:hidden"> |
| 134 | + <img src="public/github/unit-tests.png" width="150" style="float:left;margin-right:40px" /> |
| 135 | + |
122 | 136 | - All the shared components in the `common` directory have unit tests inside their respective folders. They end with a `*.test.tsx` extension.
|
123 |
| - - To run the unit test suite use the command `npm run test` then enter `a` to run all tests |
124 |
| - - These tests are also automatically run on each commit, if there are any failures the commit will also fail |
| 137 | +- To run the unit test suite use the command `npm run test` then enter `a` to run all tests |
| 138 | +- These tests are also automatically run on each commit, if there are any failures the commit will also fail |
| 139 | +</div> |
125 | 140 |
|
126 |
| -<p align="middle"> |
127 |
| - <img src="public/github/unit-tests.png" width="400" /> |
128 |
| -</p> |
| 141 | +# 📝 Misc Notes |
| 142 | + |
| 143 | +- In addition to running on the localhost domain the app is also available on your network at `https://192.168.0.185:3000` (useful for viewing on mobile) |
| 144 | +- If you want to make changes to the filter files, run the command `cd filters && gulp watchJS` to watch for changes |
| 145 | +- If you want to browse the production build run the commands `npm run build && npm run serve`, then navigate to `http://localhost:5000` locally or `http://192.168.0.185:5000` on the network |
| 146 | +- Webpack root dir is set to `src` which means we can use clean import paths like these `import Foo from common/Foo` vs messy relative paths like `import Foo from ../../common/Foo` |
| 147 | +- This is purely a front end demo project, the "api" is nothing but a bunch of hard coded json files located in `/public/api/*.json`. All data is dummy data! |
129 | 148 |
|
130 | 149 | # ⚠️ Contributing
|
131 | 150 |
|
132 |
| -**Please note I will not be accepting PR's on this project** since it is part of my personal portfolio. You're more than welcome to fork and maintain your own version if you like! |
| 151 | +Please note **I will not be accepting PR's on this project** since it is part of my personal portfolio. You're more than welcome to fork and maintain your own version if you like! |
133 | 152 |
|
134 | 153 | # ⚖️ License
|
135 | 154 |
|
|
0 commit comments