This project is a core banking application that allows users to manage customer accounts, perform transactions, and handle user operations. Users can also be created and managed within the system.
- Node.js (v14.x or later)
- npm (v6.x or later)
- MySQL
- Git
-
Clone the repository:
git clone https://github.com/yourusername/BankApp.git
-
Navigate to the backend directory:
cd BankApp/backend
-
Install dependencies:
npm install
-
Set up the database:
- Ensure MySQL is installed and running.
- Log in to MySQL and create the database:
CREATE DATABASE core_banking; CREATE USER 'root'@'localhost' IDENTIFIED BY 'your-mysql-password'; GRANT ALL PRIVILEGES ON core_banking.* TO 'root'@'localhost'; FLUSH PRIVILEGES;
-
Configure environment variables:
- Create a
.env
file in thebackend
directory and add the following content:DB_HOST=localhost DB_USER=root DB_PASSWORD=your-mysql-password DB_NAME=core_banking JWT_SECRET=your-jwt-secret EMAIL_USER=your-email EMAIL_PASS=your-email-password
- Create a
-
Run database migrations:
node -e 'require("./config/database").sync({ force: false })'
-
Start the backend server:
npm start
-
Navigate to the frontend directory:
cd ../frontend
-
Create the
docs
directory:mkdir docs
-
Move frontend files to the
docs
directory:mv * docs/
-
Serve the frontend using Nginx:
- Copy the frontend files to the Nginx web root directory:
sudo cp -r docs/* /var/www/html/
- Copy the frontend files to the Nginx web root directory:
-
Configure Nginx:
- Create a new Nginx configuration file:
sudo nano /etc/nginx/sites-available/default
- Add the following content to the file:
server { listen 80; server_name your-ec2-public-ip; location / { root /var/www/html; index index.html index.htm; try_files $uri $uri/ /index.html; } location /api/ { proxy_pass http://localhost:3000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
- Save and close the file.
- Create a new Nginx configuration file:
-
Restart Nginx:
sudo systemctl restart nginx
- Frontend: Open your browser and navigate to
http://your-ec2-public-ip
. - Backend: The backend API is accessible at
http://your-ec2-public-ip/api
.
-
GitHub Pages Deployment:
- If you prefer to deploy the frontend using GitHub Pages, ensure your frontend files are in the
docs
directory and configure GitHub Pages to serve from thedocs
directory.
- If you prefer to deploy the frontend using GitHub Pages, ensure your frontend files are in the
-
Environment Variables:
- Ensure all necessary environment variables are set in the
.env
file for both local development and production environments.
- Ensure all necessary environment variables are set in the
-
Database Connection Issues:
- Ensure MySQL is running and the credentials in the
.env
file are correct. - Check the MySQL user permissions and ensure the database exists.
- Ensure MySQL is running and the credentials in the
-
Nginx Configuration:
- Verify the Nginx configuration file for any syntax errors.
- Ensure Nginx is restarted after making changes to the configuration file.