This project is a beginner-to-intermediate Spring Boot application designed to help students understand how real-world web applications are built using the Spring ecosystem.
You will develop a fully functional blog platform where users can:
- Register and log in securely ๐
- Create and manage blog posts โ๏ธ
- Comment on posts ๐ฌ
- Organize content using categories ๐ท๏ธ
By the end of this assignment, you will have built an application that closely resembles production-grade Java web applications, following clean architecture and best practices.
By completing this project, students will gain hands-on experience with:
โ Spring Boot โ application configuration, auto-configuration, and project structure โ Spring MVC โ controllers, request mapping, and model-view separation โ Spring Data JPA โ ORM, repositories, and database interaction โ Spring Security โ authentication, authorization, and password hashing โ Thymeleaf โ server-side rendering and dynamic HTML templates โ RESTful design โ clean and predictable URL patterns โ Relational database modeling โ entities, relationships, and constraints
- ๐ Registration: Anonymous users can create accounts (username, email, password)
- ๐ Authentication: Secure login and logout using Spring Security
- ๐ก๏ธ Authorization: Only authenticated users may create, edit, or delete content
- โ Create Posts: Authenticated users can write blog posts with titles, content, and categories
- ๐ View Posts: Anyone (including anonymous users) can read posts
- โ๏ธ Edit Posts: Users may edit only their own posts
- ๐๏ธ Delete Posts: Users may delete only their own posts
- ๐ท๏ธ Categorization: Posts may belong to one or more categories
- โ Add Comments: Authenticated users can comment on any post
- โ๏ธ Edit Comments: Users can edit their own comments
- ๐๏ธ Delete Comments: Users can delete their own comments
- ๐๏ธ View Comments: Everyone can see comments under posts
Design the following tables with proper constraints and relationships.
| Column | Type | Constraints |
|---|---|---|
| id | Long | ๐ Primary Key, Auto-increment |
| username | String | Unique, Not Null, Max 50 |
| String | Unique, Not Null, Valid format | |
| password | String | Not Null (BCrypt-hashed) |
| created_at | LocalDateTime | Not Null, Default: now |
| enabled | Boolean | Default: true |
| Column | Type | Constraints |
|---|---|---|
| id | Long | ๐ Primary Key |
| title | String | Not Null, Max 200 |
| content | Text | Not Null |
| author_id | Long | ๐ FK โ Users(id) |
| created_at | LocalDateTime | Not Null |
| updated_at | LocalDateTime | Nullable |
| Column | Type | Constraints |
|---|---|---|
| id | Long | ๐ Primary Key |
| content | Text | Not Null, Max 1000 |
| post_id | Long | ๐ FK โ Posts(id) |
| author_id | Long | ๐ FK โ Users(id) |
| created_at | LocalDateTime | Not Null |
| updated_at | LocalDateTime | Nullable |
| Column | Type | Constraints |
|---|---|---|
| id | Long | ๐ Primary Key |
| name | String | Unique, Not Null |
| description | String | Nullable |
| Column | Type | Constraints |
|---|---|---|
| post_id | Long | FK โ Posts(id) |
| category_id | Long | FK โ Categories(id) |
| ๐ Composite Primary Key |
- ๐ค User โ Posts: One-to-Many
- ๐ค User โ Comments: One-to-Many
- ๐ Post โ Comments: One-to-Many
- ๐ Post โ Categories: Many-to-Many
| Method | Endpoint | Purpose |
|---|---|---|
| GET | / |
Home page |
| GET | /posts |
View all posts |
| GET | /post/{id} |
View single post |
| GET | /category/{id} |
Posts by category |
| GET | /register |
Registration page |
| POST | /register |
Register user |
| GET | /login |
Login page |
| POST | /login |
Login processing |
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /post/new |
Create post form |
| POST | /post/new |
Save new post |
| GET | /post/{id}/edit |
Edit post |
| POST | /post/{id}/edit |
Update post |
| POST | /post/{id}/delete |
Delete post |
| POST | /post/{id}/comment |
Add comment |
| POST | /comment/{id}/edit |
Edit comment |
| POST | /comment/{id}/delete |
Delete comment |
| GET | /logout |
Logout |
/profileโ User profile page/my-postsโ Userโs own posts/categoriesโ All categories
- Use
@Entity,@Id,@GeneratedValue - Define relationships properly
- Apply constraints (
nullable,unique) - Use Lombok where appropriate
Entities: User, Post, Comment, Category
- Extend
JpaRepository - Add meaningful query methods
- Encapsulate business logic
- Perform validation
- Handle exceptions cleanly
- Configure authentication
- Use
BCryptPasswordEncoder - Protect routes
- Customize login/logout
- Use
@Controller - Map endpoints with
@GetMapping/@PostMapping - Pass data via
Model
Use:
th:text,th:each,th:if- Form binding (
th:object) - Security expressions (
sec:authorize) - Layout fragments
- Test all flows
- Validate security rules
- Handle edge cases
- Add error pages (403, 404, 500)
- Spring Web
- Spring Data JPA
- Spring Security
- Thymeleaf + Security Extras
- Validation
- H2 / MySQL / PostgreSQL
- Lombok (optional)
- Database connection
- Hibernate DDL auto
- Thymeleaf settings
- Server port
- Pagination ๐
- Search ๐
- User profiles ๐ค
- Likes โค๏ธ
- Rich text editor โจ
- Image uploads ๐ผ๏ธ
- Roles (ADMIN / USER) ๐ก๏ธ
- Email verification ๐ง
- Password reset ๐
- REST API ๐
Students must submit:
- โ Git repository
- ๐
README.md - ๐๏ธ Database schema or SQL
- ๐ธ Screenshots
- โ๏ธ Short reflection document
| Category | Weight |
|---|---|
| Functionality | 40% |
| Code Quality | 25% |
| Database Design | 15% |
| Security | 10% |
| UI/UX | 10% |
- Spring Boot Docs
- Spring Data JPA Guide
- Spring Security Reference
- Thymeleaf Docs
- Baeldung Tutorials
โจ Good luck! This project mirrors real enterprise Spring applications, so treat it as both a learning exercise and a portfolio piece.