Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.4 #139

Merged
merged 3 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions client/.env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
NEXT_PUBLIC_BASE_PATH=''
NEXT_PUBLIC_BASE_API_URL=http://localhost:3001
NEXT_PUBLIC_FIREBASE_WEB_API_KEY=AIzaSyDAZxPcy_4XMVcZJ0nIupEGBcGZoABlNU4
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN=myphonebook-app-dev.firebaseapp.com
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID=myphonebook-app-dev
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET=myphonebook-app-dev.appspot.com
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID=458788271773
NEXT_PUBLIC_FIREBASE_WEB_APP_ID=1:458788271773:web:a3c1edf29f5b86da8f4674
NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID=G-64M5K063SC
NEXT_PUBLIC_RANDOM_JOKE_API=https://v2.jokeapi.dev/joke/Misc?format=json&safe-mode&type=single
NEXT_PUBLIC_MEDIA_BG1=https://firebasestorage.googleapis.com/v0/b/myphonebook-app.appspot.com/o/assets%2Fimages%2Fpexels-pixabay-101529.jpg?alt=media&token=a7c555b7-1ddb-43cb-82ec-fe9048c6d007
NEXT_PUBLIC_BASE_PATH=''
NEXT_PUBLIC_BASE_API_URL=http://localhost:3001
NEXT_PUBLIC_FIREBASE_WEB_API_KEY=AIzaSyDAZxPcy_4XMVcZJ0nIupEGBcGZoABlNU4
NEXT_PUBLIC_FIREBASE_WEB_AUTHDOMAIN=myphonebook-app-dev.firebaseapp.com
NEXT_PUBLIC_FIREBASE_WEB_PROJECT_ID=myphonebook-app-dev
NEXT_PUBLIC_FIREBASE_WEB_STORAGE_BUCKET=myphonebook-app-dev.appspot.com
NEXT_PUBLIC_FIREBASE_WEB_MESSAGING_SENDER_ID=458788271773
NEXT_PUBLIC_FIREBASE_WEB_APP_ID=1:458788271773:web:a3c1edf29f5b86da8f4674
NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID=G-64M5K063SC
NEXT_PUBLIC_RANDOM_JOKE_API=https://v2.jokeapi.dev/joke/Misc?format=json&safe-mode&type=single
NEXT_PUBLIC_MEDIA_BG1=https://firebasestorage.googleapis.com/v0/b/myphonebook-app.appspot.com/o/assets%2Fimages%2Fpexels-pixabay-101529.jpg?alt=media&token=a7c555b7-1ddb-43cb-82ec-fe9048c6d007
# Uncomment these 2 CHOKIDAR lines if using Docker Desktop and WSL2 on Windows OS
# WATCHPACK_POLLING=true
1 change: 1 addition & 0 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ The following dependecies are used for this project. Feel free to experiment usi
| NEXT_PUBLIC_FIREBASE_WEB_MEASUREMENT_ID | Firebase web measurement ID from the Firebase Project Settings configuration file. |
| NEXT_PUBLIC_MEDIA_BG1 | Firebase storage download URL of the hi-resolution asset file "loginBgResized.jpg" |
| NEXT_PUBLIC_RANDOM_JOKE_API | Access URL to the JokeAPI, a REST API that serves uniformly and well formatted jokes. |
| WATCHPACK_POLLING | Enables hot reload on NextJS apps (tested on NextJS v13.2.1) running inside Docker containers on a Windows host. Set it to `true` if running Docker Desktop with WSL2 on a Windows OS.|

## Firebase Setup and Configuration

Expand Down
33 changes: 18 additions & 15 deletions server/.env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
ALLOW_CORS=1
ALLOWED_ORIGINS=http://localhost:3000,https://my-phonebook-test.web.app
API_RATE_LIMIT=300
CLIENT_WEBSITE_URL=http://localhost:3000
EMAIL=<GMAIL_EMAIL>
CLIENT_USER=<GMAIL_EMAIL>
CLIENT_ID=<OAUTH2_CREDENTIALS_CLIENT_ID_VALUE_HERE>
CLIENT_SECRET=<OAUTH2_CREDENTIALS_SECRET_VALUE_HERE>
REFRESH_TOKEN=<OAUTH2_CREDENTIALS_REFRESH_TOKEN_VALUE_HERE>
REDIRECT_URI=https://developers.google.com/oauthplayground
VERCEL_TOKEN=<OPTIONAL_VERCEL_PERSONAL_ACCESS_TOKEN>
VERCEL_ORG_ID=<OPTIONAL_VERCEL_APP_ORGANIZATION_ID>
VERCEL_PROJECT_ID=<OPTIONAL_VERCEL_APP_PROJECT_ID>
FIREBASE_SERVICE_ACC=<YOUR-FIREBASE-PROJ-SERVICE-ACCOUNT-JSON-CREDENTIALS-ONE-LINER-NO-SPACES>
FIREBASE_PRIVATE_KEY=<PRIVATE-KEY-FROM-FIREBASE-SERVICE-ACCOUNT-JSON-WITH-DOUBLE-QUOTES>
ALLOW_CORS=1
ALLOWED_ORIGINS=http://localhost:3000,https://my-phonebook-test.web.app
API_RATE_LIMIT=300
CLIENT_WEBSITE_URL=http://localhost:3000
EMAIL=<GMAIL_EMAIL>
CLIENT_USER=<GMAIL_EMAIL>
CLIENT_ID=<OAUTH2_CREDENTIALS_CLIENT_ID_VALUE_HERE>
CLIENT_SECRET=<OAUTH2_CREDENTIALS_SECRET_VALUE_HERE>
REFRESH_TOKEN=<OAUTH2_CREDENTIALS_REFRESH_TOKEN_VALUE_HERE>
REDIRECT_URI=https://developers.google.com/oauthplayground
VERCEL_TOKEN=<OPTIONAL_VERCEL_PERSONAL_ACCESS_TOKEN>
VERCEL_ORG_ID=<OPTIONAL_VERCEL_APP_ORGANIZATION_ID>
VERCEL_PROJECT_ID=<OPTIONAL_VERCEL_APP_PROJECT_ID>
FIREBASE_SERVICE_ACC=<YOUR-FIREBASE-PROJ-SERVICE-ACCOUNT-JSON-CREDENTIALS-ONE-LINER-NO-SPACES>
FIREBASE_PRIVATE_KEY=<PRIVATE-KEY-FROM-FIREBASE-SERVICE-ACCOUNT-JSON-WITH-DOUBLE-QUOTES>
# Uncomment these 2 CHOKIDAR lines if using Docker Desktop and WSL2 on Windows OS
# CHOKIDAR_USEPOLLING=true
# CHOKIDAR_INTERVAL=1000
5 changes: 3 additions & 2 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ The following dependecies are used for this project. Feel free to experiment usi
| ALLOW_CORS | Allow Cross-Origin Resource Sharing (CORS) on the API endpoints.<br><br>Default value is `1`, allowing access to domains listed in `ALLOWED_ORIGINS`.<br> Setting to `0` will make all endpoints accept requests from all domains, including Postman. |
| ALLOWED_ORIGINS | IP/domain origins in comma-separated values that are allowed to access the API if `ALLOW_CORS=1`.<br> Include `http://localhost:3000` by default to allow CORS access to the **/client** app. |
| API_RATE_LIMIT | It's the maximum number of allowed API requests on the server per `API_WINDOW_MS_MINUTES`. <br>Users will receive a `429 - Too many requests` server error after hitting the limit.<br>The limit will reset after API_WINDOW_MS_MINUTES minutes, after which users can resume making API requests. |
| CLIENT_WEBSITE_URL | Online base URL of the frontend website i.e., `http://localhost:3000` |
| EMAIL, CLIENT_USER | Google email configured for sending email and OAuth2 |
| CLIENT_ID | Google OAuth2 client ID. |
| CLIENT_SECRET | Google OAuth2 client secret. |
| REFRESH_TOKEN | Google OAuth2 refresh token. |
| REDIRECT_URI | Redirect URI for the Google OAuth2 exchange.<br>Default value is https://developers.google.com/oauthplayground |
| FIREBASE_SERVICE_ACC | The project's private key file contents, condensed into one line and minus all whitespace characters.<br><br>The service account JSON file is generated from the Firebase project's **Project Settings** page, on **Project Settings** -> **Service accounts** -> **Generate new private key** |
| FIREBASE_PRIVATE_KEY | The `private_key` entry from the service account JSON file.<br> <blockquote> **NOTE:** Experiment wrapping this value in double-quotes on WINDOWS OS localhost. Some systems may or may not require the double-quotes (i.e., Ubuntu).</blockquote> |
| FIREBASE_WEB_API_KEY | |
| CLIENT_WEBSITE_URL | |
| CHOKIDAR_USEPOLLING | Enables hot reload on `nodemon` running inside Docker containers on a Windows host. Set it to `true` if running Docker Desktop with WSL2 on a Windows OS. |
| CHOKIDAR_INTERVAL | Chokidar polling interval. Set it along with `CHOKIDAR_USEPOLLING=true` if running Docker Desktop with WSL2 on a Windows OS. Default value is `1000`. |

4. Run the localhost express web server for development:<br>
`npm run dev`
Expand Down
Loading