Pulse
A Reddit-style community API in Spring Boot: email-verified signup, stateless JWT auth, communities and posts.
- Role
- Solo: backend engineering
- Year
- 2024
- Status
- Archived
- Type
- Backend & APIs
01Problem
Why it exists
I wanted to build the unglamorous middle of a backend from an empty project: a signup that has to be verified, authentication without server state, and a domain with real relationships between users, communities and posts.
02Approach
How I went about it
A conventionally layered Spring application, kept strict. Controllers accept and return DTOs, services own the transactions, and compile-time mappers translate between the two so persistence entities never leak into the API.
03Architecture
Decisions that shaped it
Diagram aboveRequest path: a stateless filter in front of a layered Spring application.
01
Signup is a two-step state
A new account is stored disabled. A verification token is persisted and emailed as an activation link; Spring Security refuses the login until the link has enabled the account.
02
A stateless filter in front of everything
Login returns a signed token. A once-per-request filter validates it ahead of the standard authentication filter, and every route outside the auth namespace requires it.
03
A hard DTO boundary
MapStruct generates the mapping code at compile time, including derived fields such as the number of posts in a community, so there is no reflection and no hand-written copying.
04
A two-stage container build
Dependencies are resolved in a builder stage and only the packaged jar is copied into the runtime image.
04Build
What it does
- Signup, account verification and login endpoints
- Create and list communities, fetch a community by id
- Create posts; read them by id, by community or by author
- Not-found and domain errors modelled as explicit exception types
- Service
- Java 17 · Spring Boot 3.2 · Spring Security · Spring Data JPA
- Data
- MySQL · Hibernate
- Supporting
- JJWT · MapStruct · Spring Mail + Thymeleaf · springdoc OpenAPI
- Delivery
- Docker (multi-stage build) · Maven
05Outcome
Where it stands
It did its job: assembling a Spring Security filter chain by hand is the fastest way to understand one.
What is not there: votes and comments exist as entities and repositories but have no service or endpoint, and the test suite is only the context-load test. I stopped at that point and have left the repository as it was.
Checked against the repository on 11 November 2026