My Phonebook is an online multi-user web application clone of a regular Contacts application found on mobile phones. It will let users securely manage their Contacts by allowing them to create a new Contact, edit or delete existing Contacts, view the information of an existing Contact, and view a list of existing Contacts. Moreover, it will let users search for existing Contact and export Contacts information into a CSV and PDF file.
My Phonebook will consist of a front-end website (client) and a secure REST API running on the backend. It will implement security best practices through a registration and login component. Users will be able to view and manage only the Contacts that they create.
This project will also serve as a practice for catching up and implementing best practices for using React, Firebase, Express and general software development.
Website: https://weaponsforge.github.io/my-phonebook/
Server: https://myphonebook-app.vercel.app/
Website: https://myphonebook-app-dev.web.app/
Server: https://myphonebook-app-dev.vercel.app/
The following dependecies are used for this project. Feel free to experiment using other dependencies and versions.
- Windows 64-bit OS
- nvm version 1.1.9 (for Windows)
-
NOTE: Using nvm is optional if you want to continue using your pre-installed NodeJS.
-
- NodeJS LTS v18.14.2 installed using nvm
- node v18.14.2
- npm v9.5.0
-
NOTE: We will use v18.14.2 for the official production client and server builds but feel free to use other NodeJS versions by setting
"engine-strict=false"
in the.npmrc
file when working on localhost development as needed, but please use v18.14.2 when installing new modules. Do not commit the package.json or package-lock.json files should they change when"engine-strict=false"
.
- Client app
- NextJS 13.2.1
- React 18.2.0
- Firebase 9.17.1
- Server app
- Express 4.18.2
-
Clone this repository.
https://github.com/weaponsforge/my-phonebook.git
-
Follow the instructions on the README files inside the
/client
and/server
directories for more information on configuring and using the client and backend.
We can use Docker to run dockerized client and server apps for local development and production mode. The following methods require Docker and Docker compose correctly installed and set up on your development machine.
The following dependencies are used to build and run the image. Please feel feel free to use other OS and versions as needed.
- Ubuntu 22.04.1
- Docker version 23.0.1, build a5eeb1
- Docker Compose v2.16.0
- Set up the environment variables for the
/client
and/server
directories like mentioned in the Manual Installation section, step no. 2. - Verify that ports 3000 and 3001 are free because the client and server containers will use these ports.
- Stop current-running my-phonebook containers, if any.
docker compose -f docker-compose.dev.yml down docker compose -f docker-compose.prod.yml up
- Stop and delete all docker instances for a fresh start.
-
NOTE: Running this script will delete all docker images, containers, volumes, and networks. Run this script if you feel like everything is piling but do not proceed if you have important work on other running Docker containers.
-
sudo chmod u+x scripts/docker-cleanup.sh ./scripts/docker-cleanup.sh # Answer all proceeding prompts
-
- Edit any of the files under the
/client
or/server
directory after running step no. 2.2 and wait for their live reload onhttp://localhost:3000
(client) andhttp://localhost:3001
(server).# 2.1. Build the client and server containers for localhost development. docker compose -f docker-compose.dev.yml build # 2.2. Create and start the development client and server containers docker compose -f docker-compose.dev.yml up # 2.3. Stop and remove the development containers, networks, images and volumes docker compose -f docker-compose.dev.yml down
The following docker-compose commands build a small client image targeted for creating optimized dockerized apps running on self-managed production servers. An Nginx service serves the frontend client on port 3000. Hot reload is NOT available when editing source codes from the /client
and /server
directories.
-
Follow step numbers 1 - 4 in the Docker for Localhost Development section.
-
Build the client and server containers for production deployment.
-
NOTE: Run this step only once or as needed when housekeeping docker images or if there are new source code updates in the /client or /server directories.
docker compose -f docker-compose.prod.yml build
-
-
Load the production mode apps on
http://localhost:3000
(client) andhttp://localhost:3001
(server) after running step no. 3.1.# 3.1. Create and start the production client and server containers. docker compose -f docker-compose.prod.yml up # 3.2. Stop and remove the production containers, networks, images and volumes docker compose -f docker-compose.prod.yml down
@weaponsforge
20220222