From a8b736df69ae42bf69da6ad4939378b9816de593 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Oct 2025 19:43:01 +0530 Subject: [PATCH 1/3] docs: added Hindi transaltion of README intro + Overview --- README.hi.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README.hi.md diff --git a/README.hi.md b/README.hi.md new file mode 100644 index 0000000..e200f16 --- /dev/null +++ b/README.hi.md @@ -0,0 +1,20 @@ +🌐 HacktoberBlog - स्प्रिंग बूट बैकएंड + +HacktoberBlog के बैकएंड रिपॉज़िटरी में आपका स्वागत है – यह एक साधारण ब्लॉगिंग प्लेटफ़ॉर्म है जो Spring Boot और Firebase Firestore के साथ बनाया गया है। यह प्रोजेक्ट शुरुआती लोगों के लिए अनुकूल है और Hacktoberfest के दौरान आपकी पहली ओपन-सोर्स कॉन्ट्रिब्यूशन के लिए परफेक्ट है! 🎉 + +📌 प्रोजेक्ट अवलोकन +यह HacktoberBlog की बैकएंड सर्विस है। यह निम्नलिखित APIs प्रदान करता है: + +👤 यूज़र को बनाना, अपडेट करना, डिलीट करना और लिस्ट करना +📝 ब्लॉग पोस्ट बनाना और प्राप्त करना +❤️ ब्लॉग को लाइक करना +💬 ब्लॉग पर कमेंट करना +📧 नए यूज़र्स को वेलकम ईमेल भेजना + +यह प्रोजेक्ट निम्नलिखित तकनीकों पर आधारित है: + +- Java + Spring Boot +- Firebase Firestore (NoSQL DB) +- Firebase Admin SDK +- Spring Boot Actuator & Mail +- Lombok (क्लीन कोड के लिए) From f7fb0b465cbcb1f2627f16f70b73eef188a78f92 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Oct 2025 22:39:34 +0530 Subject: [PATCH 2/3] docs(hi): move Hindi translation to docs/hi/README.md as requested --- README.md => docs/hi/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => docs/hi/README.md (100%) diff --git a/README.md b/docs/hi/README.md similarity index 100% rename from README.md rename to docs/hi/README.md From a05b4c869fd62978d82f63fdfb4affcfee9b1b8b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 1 Oct 2025 23:11:07 +0530 Subject: [PATCH 3/3] chore: resolve merge conflict for README.md --- README.md | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1f306f6 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +# 🌐 HacktoberBlog - Spring Boot Backend + +Welcome to the backend repository for **HacktoberBlog** – a simple blogging platform built with **Spring Boot** and **Firebase Firestore**. This project is beginner-friendly and perfect for your first open-source contribution during **Hacktoberfest**! 🎉 + +--- + +## 📌 Project Overview + +This is the **backend service** for HacktoberBlog. It provides APIs to: + +- 👤 Create, update, delete, and list users +- 📝 Create and retrieve blog posts +- ❤️ Like a blog +- 💬 Comment on a blog +- 📧 Send welcome emails to new users + +Built using: +- Java + Spring Boot +- Firebase Firestore (NoSQL DB) +- Firebase Admin SDK +- Spring Boot Actuator & Mail +- Lombok for clean code + +--- + +## 🗂️ Project Structure + +``` +src/ +└── main/ +├── java/com/hacktober/blog/ +│ ├── blog/ → Blog service logic +│ ├── user/ → User service logic +│ ├── email/ → Email service logic +│ ├── config/ → Firebase initialization +│ └── utils/ → Utility functions (e.g., password encoding) +└── resources/ +└── application.properties +``` + +--- + +## 📘 API Documentation + +Interactive API documentation is available out of the box thanks to Swagger UI and the generated OpenAPI specification. + +1. Run the application locally: + +```bash +./mvnw spring-boot:run +``` + +2. Open [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html) in your browser to explore and try the endpoints. + +The raw OpenAPI document can be downloaded from [http://localhost:8080/v3/api-docs](http://localhost:8080/v3/api-docs) for integration with other tools. + +--- +## 🚀 Getting Started + +### 1. Prerequisites + +- Java 17+ +- Maven +- Email SMTP (Gmail or others) +- Firebase Project (Firestore + Service Account) + +### 2. Clone the repo + +```bash +git clone https://github.com/HacktoberBlog/SpringBootBackend.git +cd SpringBootBackend +``` + +### 3. Firebase Setup + +- Go to Firebase Console + +- Create a project + +- Enable Firestore + +- Generate a Service Account Key JSON file + +- Save the file in a secure path, e.g., /etc/secrets/firebaseServiceAccountKey.json + +### 4. Configure Email + +Edit src/main/resources/application.properties: + +``` +spring.mail.host=smtp.gmail.com +spring.mail.port=587 +spring.mail.username=your_email@gmail.com +spring.mail.password= 16 char app key such as abcd efgh ijkl mnop +spring.mail.properties.mail.smtp.auth=true +spring.mail.properties.mail.smtp.starttls.enable=true +redis.password= your redis db password +``` + +#### Getting Keys/Passwords for Email, DB, etc. +Gmail 16 char App Key: You can get the app key by navigating to google myaccount settings->search app passwords->give an app name-> create and copy the key + +Redis Password: You can create a free db on [Redis](https://redis.io/). Once your db is created, click on the "Connect using Redis CLI, Client, or Insight" button. There you will be able to view your password (view/hide it using eye icon) + + +### 🔑 Setup Secrets (Environment Variables) + +To run the project, you must provide your secrets as environment variables. +These are used in `application.properties` via Spring's placeholder system: + +| Variable Name | Description | Example Value | +|---------------------------------|-----------------------------------------------|--------------------------------| +| `spring.mail.username` | Your email for sending welcome emails. | `your_email@gmail.com` | +| `spring.mail.password` | Your 16-char app key for the email account. | `abcd efgh ijkl mnop` | +| `redis.password` | The password for your Redis database. | `yourRedisDbPassword123` | + + +## ⚠️ **NOTE:** +**🚫 DO NOT PUSH** the changes made in `application.properties`, `RedisConfig`, and `FirestoreService`. +🔒 _Keep your secrets safe!_ 🔒 + +## 🚀 Live Demo +🎉 The project is now LIVE! Check it out here: [HacktoberBlog Deployment](https://springbootbackend-onuz.onrender.com) 🌟 \ No newline at end of file