A full-stack Polling Application built with Java, Spring Boot, MySQL, React, and Material UI, designed with clean architecture, secure authentication, and scalable REST APIs.
This project demonstrates modern backend engineering practices (JWT security, layered architecture, DTO pattern) combined with a responsive and user-friendly frontend.
- Java 25
- Spring Boot
- Spring Security (JWT Authentication)
- Spring Data JPA (Hibernate)
- MySQL
- Java Mail Sender
- Lombok
- React.js
- Material UI (MUI)
- Axios
- User Registration & Login
- JWT-based authentication
- Secure API endpoints
- Create a poll (authenticated users)
- View all polls
- View My Polls (user-specific)
- Delete own polls
- Like a poll
- Comment on polls
- Vote on poll options
- Automatic email notification when a poll is created (via Java Mail Sender)
The backend follows a clean layered architecture:
Controller β Service β Repository β Database
β
DTO
- DTO pattern for API communication
- Service layer abstraction
- Exception handling (recommended to extend)
- Stateless authentication using JWT
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/user/polls/ |
Create a poll |
| GET | /api/user/polls/ |
Get all polls |
| GET | /api/user/polls/my-polls |
Get logged-in user's polls |
| GET | /api/user/polls/{id} |
Get poll details |
| DELETE | /api/user/polls/{id} |
Delete poll |
| GET | /api/user/polls/like/{id} |
Like a poll |
| POST | /api/user/polls/comment |
Add comment |
| POST | /api/user/polls/vote |
Vote on poll |
- User registers
- User logs in
- Backend generates JWT token
- Token is sent in headers for secured requests
Authorization: Bearer <JWT_TOKEN>
-
When a user creates a poll:
- Backend triggers Java Mail Sender
- Email is sent to the logged-in user
@RestController
@RequestMapping("/api/user/polls")
@RequiredArgsConstructor
@CrossOrigin("*")
public class PollController {
private final PollService pollService;
@PostMapping("/")
public ResponseEntity<?> postPoll(@RequestBody PollDTO pollDTO){
PollDTO creatdPollDTO = pollService.postPoll(pollDTO);
return new ResponseEntity<>(creatdPollDTO, HttpStatus.CREATED);
}
}git clone https://github.com/nazzmul-anik/polling-app.git
cd polling-app/backendRun the application:
mvn spring-boot:runπΉ Dashboard
πΉ Create Poll Page
πΉ Signu Up Page
πΉ Email Confirmation
πΉ Like & Comment Section
Md Nazmul Hasan Anik
- Backend Developer (Spring Boot)
- Passionate about scalable system design and clean code
β If you find this project useful, consider giving it a star!