Perfect! Hereβs a fancier, portfolio-ready README with badges, a βTry APIβ section, and clean formatting that will look professional on GitHub:
# Portfolio Backend
[](https://www.oracle.com/java/)
[](https://spring.io/projects/spring-boot)
[](LICENSE)
A Spring Boot backend service for handling contact messages from a portfolio website.
It receives messages from a contact form and sends them via email.
## πΉ Features
- REST API to receive contact messages
- Sends email notifications to the portfolio owner
- Uses Spring Boot, JavaMailSender, and Lombok
- CORS enabled for all origins
---
## π¦ Technologies
- Java 17+
- Spring Boot 3.x
- Spring Web
- Spring Mail
- Lombok
---
## π API Endpoint
### POST `/api/contact/message`
Send a contact message to the portfolio owner.
**Request Body:**
```json
{
"name": "John Doe",
"email": "john@example.com",
"message": "Hello! I am interested in your portfolio."
}Response:
"Message sent successfully!"Add your email credentials in application.properties:
spring.mail.host=smtp.example.com
spring.mail.port=587
spring.mail.username=your-email@example.com
spring.mail.password=your-email-password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=trueEmails will be sent from and to this address. Make sure your email provider allows SMTP access (Gmail requires an App Password).
- Clone the repository:
git clone https://github.com/yourusername/PortfolioBackend.git
cd PortfolioBackend- Build the project:
./mvnw clean install- Run the application:
./mvnw spring-boot:run- Test the API using Postman, curl, or your frontend:
curl -X POST http://localhost:8080/api/contact/message \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","email":"john@example.com","message":"Hello!"}'You can also test the API live from your frontend portfolio or using tools like:
- Modify
@CrossOrigininContactControllerto restrict access if needed. - Ensure your SMTP credentials are correct.