https://github.com/nazrankhondokar/spring-boot-3-with-firebase-auth
https://github.com/nazrankhondokar/spring-boot-3-with-firebase-auth
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nazrankhondokar/spring-boot-3-with-firebase-auth
- Owner: NazranKhondokar
- Created: 2025-01-13T14:22:18.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-03-26T08:59:24.000Z (2 months ago)
- Last Synced: 2025-03-26T09:29:19.393Z (2 months ago)
- Language: Java
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🚀 Spring Boot 3 with Firebase Auth & Storage
---
## 📑 Table of Contents
- [Java 17 Installation](#java-17-installation)
- [Git Installation](#git-installation)
- [Clone the Project Using GitHub Token](#clone-the-project-using-github-token)
- [Docker Installation](#docker-installation)
- [PostgreSQL Installation](#postgresql-installation)
- [Environment Variable Configuration](#environment-variable-configuration)
- [Run the Application with Docker Compose](#run-the-application-with-docker-compose)---
## 🔧 Java 17 Installation
To install Java 17 on Ubuntu 24.04, follow these steps:### 1️⃣ **Update the Package Index**
```bash
sudo apt update
```### 2️⃣ **Install Java 17**
```bash
sudo apt install openjdk-17-jdk -y
```### 3️⃣ **Verify the Installation**
```bash
java -version
```
Expected output:
```bash
openjdk version "17.x.x" ...
```---
## 🛠 Git Installation
To install Git on Ubuntu 24.04:### 1️⃣ **Install Git**
```bash
sudo apt install git -y
```### 2️⃣ **Verify the Installation**
```bash
git --version
```
Expected output:
```bash
git version 2.x.x
```---
## 🔑 Clone the Project Using GitHub Token
### 1️⃣ **Generate a GitHub Token**
1. Navigate to [GitHub Tokens](https://github.com/settings/tokens)
2. Create a token and copy it.### 2️⃣ **Clone the Repository**
```bash
git clone https://github.com/bduswork/bitcoinapps_backend.git
```### 3️⃣ **Configure Git**
```bash
git config --global user.email "[email protected]"
git config --global user.name "YourUsername"
```### 4️⃣ **Set Remote with GitHub Token**
```bash
git remote set-url origin https://:@github.com/bduswork/bitcoinapps_backend.git
```---
## 🐳 Docker Installation
### 1️⃣ **Install Docker & Docker Compose**
```bash
sudo apt update && sudo apt install -y docker.io docker-compose
```### 2️⃣ **Verify Installation**
```bash
docker --version
docker-compose --version
```### 3️⃣ **Enable and Start Docker**
```bash
sudo systemctl enable docker
sudo systemctl start docker
```### 4️⃣ **Manually Start Docker Daemon in WSL**
```bash
sudo dockerd &
docker ps
```---
## 🛢 PostgreSQL Installation
### 1️⃣ **Pull the PostgreSQL Docker Image**
```bash
docker pull postgres
```### 2️⃣ **Run a PostgreSQL Container**
```bash
sudo docker run --name postgres_container -e POSTGRES_USER=root -e POSTGRES_PASSWORD=password -e POSTGRES_DB=test_db -p 5432:5432 -d postgres
```### 3️⃣ **Verify Running Container**
```bash
sudo docker ps
```### 4️⃣ **Access PostgreSQL**
#### Using `psql` inside the container:
```bash
docker exec -it postgres_container psql -U root -d test_db
```---
## 🌍 Environment Variable Configuration
### 1️⃣ **Update `.env` File**
- Add a `.env` file in the project directory and update it using the database credentials from above.### 2️⃣ **Configure Firebase Service Account**
1. Go to the [Firebase Console](https://console.firebase.google.com/).
2. Select your project or create a new one.
3. Navigate to **Project Settings** > **Service Accounts**.
4. Click **Generate New Private Key** and download the JSON file.
5. Rename the file to `firebase-service-account.json` and place it in your project directory.---
## 🏃♂️ Run the Application with Docker Compose
### 1️⃣ **Verify Prerequisites**
```bash
sudo docker compose --version
```
Ensure PostgreSQL is not running separately on port `5432` to avoid conflicts.### 2️⃣ **Build and Start Services**
```bash
sudo docker compose build
sudo docker compose up -d
```### 3️⃣ **Check Running Services**
```bash
sudo docker compose ps
```### 4️⃣ **Test Database Connectivity**
```bash
docker exec -it postgres_container psql -U root -d test_db
```
Run a sample query:
```sql
\dt
```### 5️⃣ **Access the Backend API**
Open a browser or use Postman to test:
```bash
http://localhost:8000/swagger-ui/index.html#/
```### 6️⃣ **Stop Services**
```bash
sudo docker compose down
```