A modern, scalable blog platform built with microservices architecture using Spring Boot, Spring Cloud, and React.
This project implements a microservices architecture with the following components:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React Frontendβ β API Gateway β β Eureka Server β
β (Port 5173) βββββΊβ (Port 8084) βββββΊβ (Port 8761) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βββββββββΌβββββββ ββββββββΌβββββββ βββββββΌβββββββ
β User Service β β Blog Serviceβ β Engagement β
β (Port 8081) β β (Port 8082) β β Service β
ββββββββββββββββ βββββββββββββββ β (Port 8083)β
ββββββββββββββ
β
βββββββββΌβββββββ
β Notification β
β Service β
β (Port 8085) β
ββββββββββββββββ
- Purpose: Service discovery and registration
- Technology: Spring Cloud Netflix Eureka
- Features:
- Service registry for all microservices
- Health monitoring and load balancing
- Automatic service discovery
- Purpose: Single entry point for all client requests
- Technology: Spring Cloud Gateway
- Features:
- Request routing to appropriate microservices
- JWT authentication and authorization
- CORS configuration
- Rate limiting and security filters
- Purpose: User management and authentication
- Technology: Spring Boot, Spring Security, JPA
- Features:
- User registration and login
- JWT token generation and validation
- User profile management
- Role-based access control
- Purpose: Blog content management
- Technology: Spring Boot, Spring Data JPA
- Features:
- Create, read, update, delete blog posts
- Blog categorization and tagging
- Content validation and sanitization
- Author-based blog management
- Purpose: User interactions with blog content
- Technology: Spring Boot, Spring Data JPA
- Features:
- Comments: Nested commenting system with up to 5 levels deep
- Likes: Toggle like/unlike functionality
- Views: Anonymous and authenticated view tracking
- Real-time engagement statistics
- Purpose: Email notifications and event-driven messaging
- Technology: Spring Boot, Spring Mail, Apache Kafka
- Features:
- Email Notifications: Automated email sending via Gmail SMTP
- Event Processing: Kafka consumer for real-time event handling
- Blog Notifications: New blog post alerts to followers
- Engagement Alerts: Milestone notifications (likes, comments, views)
- User Registration: Welcome emails for new users
- Configurable Templates: Customizable email templates
- Rate Limiting: Configurable email sending limits
- Health Monitoring: Comprehensive health checks and metrics
- Purpose: User interface for the blog platform
- Technology: React 19, Vite, TailwindCSS
- Features:
- Responsive modern UI design
- User authentication and registration
- Blog creation and management
- Interactive comment system with nested replies
- Real-time engagement features
- Admin dashboard
- Framework: Spring Boot 3.5.4
- Cloud: Spring Cloud 2025.0.0
- Database: MySQL
- Security: Spring Security + JWT
- Service Discovery: Netflix Eureka
- API Gateway: Spring Cloud Gateway
- Configuration Management: Spring Cloud Config Server
- Message Queue: Apache Kafka
- Email Service: Spring Mail (Gmail SMTP)
- Build Tool: Maven
- Java Version: 24
- Framework: React 19.1.1
- Build Tool: Vite 7.1.0
- Styling: TailwindCSS 4.1.11
- HTTP Client: Axios 1.11.0
- Routing: React Router DOM 7.8.0
- Form Handling: React Hook Form 7.62.0
- Validation: Zod 4.0.17
- Icons: Lucide React 0.539.0
- Java 24 or higher
- Node.js 18 or higher
- MySQL 8.0 or higher
- Maven 3.8 or higher
- Apache Kafka (for notification service)
- Git
git clone <repository-url>
cd MSA/projectCreate MySQL databases for each service:
CREATE DATABASE user_service_db;
CREATE DATABASE blog_service_db;
CREATE DATABASE engagement_service_db;# Start Zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties
# Start Kafka Server
bin/kafka-server-start.sh config/server.propertiescd eureka-server
mvn spring-boot:runWait for Eureka to start completely (check http://localhost:8761)
cd api-gateway
mvn spring-boot:run# Terminal 1
cd user-service
mvn spring-boot:run
# Terminal 2
cd blog-service
mvn spring-boot:run
# Terminal 3
cd engagement-service
mvn spring-boot:run
# Terminal 4
cd notification-service
mvn spring-boot:runcd blog-frontend
npm install
npm run dev- Frontend: http://localhost:5173
- API Gateway: http://localhost:8084
- Eureka Dashboard: http://localhost:8761
- Notification Service: http://localhost:8085
Each service can be configured using the following environment variables:
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_NAME=<service_db_name>
DB_USERNAME=root
DB_PASSWORD=<your_password>
# JWT Configuration
JWT_SECRET=<your_jwt_secret>
JWT_EXPIRATION=86400000
# Service Ports
EUREKA_PORT=8761
GATEWAY_PORT=8084
USER_SERVICE_PORT=8081
BLOG_SERVICE_PORT=8082
ENGAGEMENT_SERVICE_PORT=8083
NOTIFICATION_SERVICE_PORT=8085
# Email Configuration (for Notification Service)
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
# Kafka Configuration
KAFKA_BOOTSTRAP_SERVERS=localhost:9092Key configuration files:
eureka-server/src/main/resources/application.propertiesapi-gateway/src/main/resources/application.propertiesuser-service/src/main/resources/application.propertiesblog-service/src/main/resources/application.propertiesengagement-service/src/main/resources/application.propertiesnotification-service/src/main/resources/application.propertiesconfig-server/src/main/resources/application.properties
POST /auth/register - User registration
POST /auth/login - User login
GET /auth/profile - Get user profile
GET /blogs - Get all blogs (paginated)
POST /blogs - Create new blog
GET /blogs/{id} - Get blog by ID
PUT /blogs/{id} - Update blog
DELETE /blogs/{id} - Delete blog
GET /blogs/user/{userId} - Get blogs by user
# Comments
POST /blogs/{id}/comments - Add comment
GET /public/blogs/{id}/comments - Get comments
PUT /blogs/{id}/comments/{commentId} - Update comment
DELETE /blogs/{id}/comments/{commentId} - Delete comment
# Likes
POST /blogs/{id}/likes/toggle - Toggle like
GET /blogs/{id}/likes/status - Get like status
GET /public/blogs/{id}/likes/count - Get like count
# Views
POST /public/blogs/{id}/views - Record view
GET /public/blogs/{id}/views/count - Get view count
# Health and Status
GET /actuator/health - Service health check
GET /actuator/info - Service information
GET /actuator/metrics - Service metrics
# Email Notifications (Internal)
POST /notifications/blog-created - Send new blog notification
POST /notifications/milestone - Send engagement milestone notification
POST /notifications/user-welcome - Send user registration welcome email
- Responsive Design: Mobile-first approach with TailwindCSS
- Modern UI Components: Clean, intuitive interface
- Dark/Light Theme: User preference support
- Real-time Updates: Live engagement statistics
- Authentication: Login/Register forms with validation
- Blog Management: Create, edit, delete blog posts
- Comment System: Nested comments with visual hierarchy
- User Dashboard: Personal blog management
- Admin Panel: System administration features
- Nested Structure: Up to 5 levels of comment depth
- Visual Indicators: Color-coded depth levels
- User Avatars: Generated gradient avatars
- Real-time Validation: Character limits and content validation
- Responsive Actions: Reply, edit, delete functionality
- JWT Authentication: Stateless authentication across services
- Role-based Access Control: User and admin roles
- CORS Configuration: Proper cross-origin resource sharing
- Input Validation: Comprehensive request validation
- SQL Injection Protection: JPA and parameterized queries
If services can't find each other:
# Check Eureka dashboard at http://localhost:8761
# Ensure all services are registered
# Verify hostname configuration in application.properties# Verify MySQL is running
# Check database credentials in application.properties
# Ensure databases are created# Check API Gateway CORS configuration
# Verify frontend is making requests to gateway (port 8084)
# Check browser developer tools for CORS errors# Check if ports are already in use
netstat -an | findstr :8761
netstat -an | findstr :8084
netstat -an | findstr :8085
# etc.# Check if Kafka is running
# Verify email configuration (MAIL_USERNAME, MAIL_PASSWORD)
# Check notification service logs for email sending errors
# Verify Gmail app password is correctAll services include Spring Boot Actuator for monitoring:
- Health:
/actuator/health - Info:
/actuator/info - Metrics:
/actuator/metrics
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Spring Boot and Spring Cloud communities
- React and Vite development teams
- TailwindCSS for the amazing styling framework
- All contributors and maintainers
Note: This project demonstrates modern microservices architecture patterns and is suitable for learning and production use with proper security configurations.