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 (क्लीन कोड के लिए) diff --git a/docs/hi/README.md b/docs/hi/README.md new file mode 100644 index 0000000..1f306f6 --- /dev/null +++ b/docs/hi/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