REST API for a blog built with Spring Boot (layered controller/service/repository), PostgreSQL + Flyway migrations, and JWT-based authentication.
- JDK 17+
- Docker + Docker Compose
Start Postgres:
docker compose up -dRun the API (serves under /api/v1):
./mvnw spring-boot:runIf ./mvnw is not executable:
chmod +x mvnwThere is a Bruno collection checked into the repo at docs/bruno/.
- Open Bruno
- Import/open the collection folder:
docs/bruno/ - Set variables used by requests:
baseUrl(example:http://localhost:8080)token(fromPOST /api/v1/auth/login, required for admin endpoints)authorId(required to create articles; seedocs/bruno/README.md)
To create an admin user for testing (so you can call POST/PATCH/DELETE endpoints), set these env vars before starting the API:
APP_ADMIN_USERNAMEAPP_ADMIN_EMAILAPP_ADMIN_PASSWORD
If you don't set any APP_ADMIN_* env vars, the API will seed a default admin user on startup:
- username:
admin - email:
admin@example.com - password:
admin
This project uses Springdoc.
- Swagger UI:
http://localhost:8080/api/v1/swagger-ui/index.html - OpenAPI JSON:
http://localhost:8080/api/v1/v3/api-docs
Unit tests:
./mvnw testIntegration tests (*IT.java, may require Docker):
./mvnw verifyflowchart LR
C[Client] -->|HTTP| API[Spring Boot API
api/v1]
API -->|JPA| DB[(PostgreSQL)]
API -->|Flyway migrations| DB
API <-->|JWT| AUTH[Auth endpoints]
MIT — see LICENSE.