A robust RESTful API implementation of the RealWorld spec using Spring Boot.
This project implements the RealWorld API specification, ensuring compatibility with any RealWorld frontend implementation.
- Interactive API Docs (Swagger): https://realworld-blog-production.up.railway.app/swagger-ui.html
- API: https://realworld-blog-production.up.railway.app/api
- Quick Test: https://realworld-blog-production.up.railway.app/api/tags
- Java 17
- Spring Boot 3.x
- Spring Security + JWT
- Spring Data JPA
- H2 Database
- Maven
-
User authentication & authorization with JWT
-
CRUD operations for articles
-
Follow/unfollow users
-
Favorite articles
-
Comment system
-
Tag filtering
-
RESTful API design following industry standards
-
JWT-based authentication and authorization
-
Database relationships with Spring Data JPA
-
Exception handling and validation
-
API deployment with Railway
-
Version control with Git/GitHub
✅ All RealWorld API spec tests pass
- Import the Postman collection
- Set environment variable:
APIURL = http://localhost:3000/api - Run collection - all tests pass ✅
Visit: https://realworld-blog-production.up.railway.app/api/tags
Register a new user:
curl -X POST https://realworld-blog-production.up.railway.app/api/users \
-H "Content-Type: application/json" \
-d '{"user":{"username":"testuser","email":"test@example.com","password":"password123"}}'Login:
curl -X POST https://realworld-blog-production.up.railway.app/api/users/login \
-H "Content-Type: application/json" \
-d '{"user":{"email":"test@example.com","password":"password123"}}'Get all articles:
curl https://realworld-blog-production.up.railway.app/api/articlesgit clone https://github.com/EndOfEntropy/RealWorld-Blog
cd RealWorld-Blog
mvn spring-boot:runThe API will be available at http://localhost:3000/api Swagger UI will be available at http://localhost:3000/swagger-ui.html
All endpoints are documented and testable via Swagger UI. Main endpoints include:
Authentication:
POST /api/users- Register userPOST /api/users/login- Login userGET /api/user- Get current userPUT /api/user- Update user
Profiles:
GET /api/profiles/:username- Get profilePOST /api/profiles/:username/follow- Follow userDELETE /api/profiles/:username/follow- Unfollow user
Articles:
GET /api/articles- List articlesPOST /api/articles- Create articleGET /api/articles/:slug- Get articlePUT /api/articles/:slug- Update articleDELETE /api/articles/:slug- Delete articlePOST /api/articles/:slug/favorite- Favorite articleDELETE /api/articles/:slug/favorite- Unfavorite article
Comments:
GET /api/articles/:slug/comments- Get commentsPOST /api/articles/:slug/comments- Add commentDELETE /api/articles/:slug/comments/:id- Delete comment
Tags:
GET /api/tags- Get tags
MIT License
Built with Spring Boot | View Source Code
