TradeHub
Barter marketplace with a two-sided confirmation protocol
- Role
- Design & backend
- Period
- 2025 —
- Status
- In development
- Links
- —
By the numbers
22 - phase confirmation protocol
5+5+ - microservices
00 - single-sided cancellation paths
Overview
A barter marketplace. With no money involved there is no escrow; trust between the parties is established through a two-sided confirmation protocol. It goes live once the CI/CD pipeline is complete.
- Two-phase handshake: a trade can't settle unless both sides confirm, making the single-sided cancellation attack impossible by design.
- The outbox pattern keeps trade state safe even if a service dies mid-transaction.
- Google OAuth2 and role-based access control span 5+ services.
01
Problem
Because no money changes hands in barter, the escrow mechanism of classic marketplaces does not apply. If one party confirms shipping and the other never confirms receipt, the system must still determine the transaction state consistently. This had to be solved before any interface work.
02
Approach
I modelled the trade as a two-phase handshake: both sides first lock the offer, then both confirm delivery. No phase can be undone unilaterally; the state machine rejects invalid transitions.
State transitions are published to Kafka through a transactional outbox; notification, reputation and inventory services consume them. Even if a service crashes, the trade state is safe in the database.
Google OAuth2 for identity, role-based access control for authorization; more than five services share the same security model.
03
Architecture
- Client
- Web uygulaması
- Google OAuth2
- Core
- Takas servisi (durum makinesi)
- İlan servisi
- Kullanıcı servisi
- Events
- Outbox
- Kafka
- Consumers
- Bildirim
- İtibar
- Envanter
- Data
- PostgreSQL
- Redis
04
Key decisions
- 01
Make the attack impossible instead of detecting it
Rather than catching single-sided cancellation after the fact, the protocol simply never allows it as a transition. Correctness comes from the state machine, not from a checklist.
- 02
Every state transition is an event
The trade service knows only its own state; every other service reacts to Kafka events. Adding a new service changes nothing in the existing ones.
Outcome
The trade protocol and the five services are complete and pass their tests. It goes live once the deployment pipeline is finished.
What I learned
“Defining the valid state transitions before the interface surfaced the faulty scenarios at design time.”
Related projects
BackendPrivate repoTaskify
Five microservices, sub-20ms real-time synchronization
Task management across five decoupled microservices, with Redis and Kafka syncing state between active users at sub-20ms latency.
- 5
- microservices
- <20ms
- sync latency
- Java
- Spring Boot
- Redis
- Kafka
- PostgreSQL
- Docker
Open
SaaSLiveCestaLex
An AI legal assistant for lawyers: case-law search, drafting, contract review and UYAP in one app
cestalex.com tries to put a Turkish lawyer's daily work in one place. You search more than 12 million decisions from Yargıtay, the Constitutional Court, Danıştay and the regional courts in your own words, draft petitions in an editor that cites its sources, upload a contract and get the risky clauses flagged, and pull hearings and deadlines from UYAP into a calendar. I built the whole backend.
- 12M+
- decisions from six official sources
- 12+
- modules: search, drafting, contracts, calendar…
- Java 21
- Spring Boot
- PostgreSQL
- Kafka
- Redis
- Qdrant
Open
SaaSLiveCestaLaw
An AI legal assistant built on ECHR case law: precedent matching, application forms, seven languages
cestalaw.com is for lawyers preparing applications to the European Court of Human Rights. You upload your petition as a PDF, the system finds the closest precedents among more than 200,000 ECHR judgments, you talk strategy with the chatbot, and the assistant fills in the official application form for you to approve. It works in Turkish, English, German, French, Spanish, Italian and Russian. It's the first product we launched, in May 2026.
- 200K+
- ECHR judgments
- 7
- languages: TR, EN, DE, FR, ES, IT, RU
- Java 21
- Spring Boot
- React
- Kafka
- Redis
- PostgreSQL
Open