Welcome to the Password Generator app! This repository contains a password generation tool designed to provide you with strong and secure passwords. This README.md file will guide you through the setup and usage of the app, including its backend API, database setup, and frontend development.
- Password Generator App
The Password Generator app is a powerful tool that helps you generate strong and secure passwords to enhance your online security. It consists of a backend API built using Express.js, a database setup using Docker Compose, and a frontend developed with React.
To get started with the Password Generator app, follow these installation steps:
-
Clone the Repository: Begin by cloning this repository to your local machine using the following command:
git clone https://github.com/noodlescripter/password-generator.git
-
Navigate to the Project Directory: Change your working directory to the root of the cloned repository:
cd Password-Generator
-
Install Dependencies: Install the required dependencies for the app by navigating to the
backend/api
andpassword-generator
(frontend) directories and executing the following commands:cd backend/api npm install cd ../../password-generator npm install
-
Set Up Database: Navigate to the
db
directory and make the required changes to thedocker-compose.yml
file, such as specifying the username and password for your database.
Before starting any component, ensure that the database is up and running. Follow these steps:
-
Navigate to the Database Directory: Open a terminal and navigate to the
db
directory:cd db
-
Start the Database: Run the following command to start the Docker Compose setup:
docker-compose up -d
This will initialize and start the database container.
After the database is up and running, follow these steps to start the backend API server:
-
Navigate to the API Directory: Open a new terminal window and navigate to the
backend/api
directory:cd backend/api
-
Run the API Server: Start the server using the following command:
npm run server start api.json
The Express server will start and be accessible at
http://localhost:8999
.
To start the frontend development server, follow these steps:
-
Navigate to the Frontend Directory: Open another terminal window and navigate to the
password-generator
directory:cd password-generator
-
Install and Start the Frontend: Install the required dependencies (if not done already) and start the frontend app:
npm install npm start
The frontend development server will start, and you can access the app in your web browser at
http://localhost:3000
.
The Password Generator app relies on environment variables to manage its configuration settings. You'll need to create .env
files in both the backend/api
and root directories to provide the necessary configuration values.
-
Create
.env
File: In the root directory of the project, create another.env
file inbackend/api
-
Set Environment Variables: Inside the
.env
file, provide values for any additional environment variables that your application might require.In
backend/api/.env
:PORT=8999 DATABASE_URL=mongodb://username:password@your_server_ip:27017/pwdgenerator
Default DB credentials : admin/pass123
In
password-generator/.env
:REACT_APP_API_URL=http://your-server-ip:8999
Replace
your-server-ip
with the actual IP address of the machine running your backend API. To access the app from other devices in the network, replacelocalhost
with your machine's IP address.
Remember that environment variables should not be hard-coded in your codebase, especially sensitive information like database connection strings or API keys. Utilize the .env
files to keep this information secure and separate from your source code.
To generate passwords using the app, follow these steps:
-
Ensure that the backend API server and the database are up and running.
-
Open a web browser and navigate to
http://your-server-ip:3000
to access the Password Generator app's frontend. -
Follow the on-screen instructions to generate strong and secure passwords based on your preferences.
Certainly! Adding a section to the README.md for stopping the servers is important for the overall usage documentation. Here's the updated version with the information you provided:
When you're done using the Password Generator app, you'll need to properly shut down the servers. Follow these steps to stop both the database and backend API servers:
To stop the MongoDB database container, follow these steps:
-
Navigate to the Database Directory: Open a terminal and navigate to the
db
directory:cd db
-
Stop the Database Container: Run the following command to stop the MongoDB container:
docker-compose down
This will shut down and remove the database container.
To stop the backend API and frontend servers, follow these steps:
-
Navigate to the API Directory: Open a terminal and navigate to the
backend/api
directory:cd password-generator
-
Stop the API Server and App Server: Run the following command to stop the API server:
npm run server stop all
With these steps, you will have successfully stopped all the servers associated with the Password Generator app.
We welcome contributions to the Password Generator app! If you find issues or have ideas for improvements, please feel free to submit pull requests or create issues in this repository.
This project is licensed under the MIT License. You are free to use, modify, and distribute the code as per the terms of the license.
Thank you for using the Password Generator app! If you have any questions or need further assistance, please don't hesitate to reach out.