https://github.com/sbrunomello/simdex
Backend of a crypto exchange simulator with account creation, login, and transaction simulation using Spring Security.
https://github.com/sbrunomello/simdex
api-rest blockchain cryptocurrency exchange finance java jwt open-source plataform simulator spring-boot spring-mvc spring-security
Last synced: 4 months ago
JSON representation
Backend of a crypto exchange simulator with account creation, login, and transaction simulation using Spring Security.
- Host: GitHub
- URL: https://github.com/sbrunomello/simdex
- Owner: sbrunomello
- License: mit
- Created: 2023-10-28T02:07:10.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T18:43:40.000Z (about 1 year ago)
- Last Synced: 2025-07-09T12:11:33.656Z (12 months ago)
- Topics: api-rest, blockchain, cryptocurrency, exchange, finance, java, jwt, open-source, plataform, simulator, spring-boot, spring-mvc, spring-security
- Language: Java
- Homepage:
- Size: 121 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


# Simdex โ SIMulated DEXchange (Spring Boot Backend)
**Simdex** is a simulation platform for decentralized crypto exchange logic, built with Spring Boot. It features secure user registration/login, crypto price tracking via CoinMarketCap, and basic portfolio management. Designed as an educational and prototyping project for fullstack blockchain enthusiasts.
> ๐งช This backend powers the [Simdex Frontend](https://github.com/sbrunomello/simdex-web)
---
## ๐ก Key Features
- โ
**User Registration & Login** with Spring Security
- ๐ **JWT Authentication** with token-based sessions
- ๐ **Live Crypto Price Tracking** using CoinMarketCap API
- ๐ผ **User Portfolio Structure** for holding simulated assets
- ๐ฆ Modular architecture with clean domain separation
- ๐งช Ready for REST API testing (Postman/Insomnia)
---
## ๐ Auth System
- `/auth/register` โ creates a new user
- `/auth/login` โ returns JWT token
- Role system via `ERole.ROLE_ADMIN`, extendable
Spring Security is fully configured with:
- AuthenticationManager
- BCrypt password encoding
- TokenService for JWT generation
---
## ๐ Crypto Price Endpoint
- `/api/v2/price` โ Returns real-time BTC price from CoinMarketCap API
- Uses native Java 11+ `HttpClient` and `javax.json` to parse the response
- Requires a valid API key from CMC in the controller
```java
JsonObject cryptoData = jsonObject.getJsonObject("data").getJsonObject("BTC");
JsonNumber price = cryptoData.getJsonObject("quote").getJsonObject("USD").getJsonNumber("price");
```
---
## ๐ Project Structure
```
/controllers
AuthController.java โ login/register endpoints
CMCIntegrationController.java โ price data from CoinMarketCap
SimdexController.java โ basic health/test routes
/domain
user/ โ user, roles, DTOs
crypto/ โ (holdings, portfolio โ WIP)
/repositories
UserRepository.java
/security
SecurityConfig.java
TokenService.java
/resources
application.properties
pom.xml
```
---
## โถ๏ธ How to Run
### Prerequisites
- Java 17+
- Maven
- PostgreSQL (or H2 for dev)
- CoinMarketCap API Key (free plan works)
### Steps
```bash
git clone https://github.com/sbrunomello/simdex.git
cd simdex
mvn spring-boot:run
```
Backend will run on:
`http://localhost:8080`
---
## ๐งช Example Requests
### Register
```http
POST /auth/register
{
"username": "mello",
"password": "123456",
"email": "mello@example.com",
"firstName": "Bruno",
"lastName": "Mello"
}
```
### Get BTC Price
```http
GET /api/v2/price
โ name: Bitcoin | price: 69234.56
```
---
## ๐งฉ Frontend
Simdex is designed to work with:
๐ [`simdex-web`](https://github.com/sbrunomello/simdex-web) โ Angular app for user interface, wallet, and order management
---
## ๐ Roadmap
- [ ] Add real-time price updates via WebSocket
- [ ] User portfolio API (add/remove simulated assets)
- [ ] Simulated buy/sell logic
- [ ] Historical chart tracking (via CMC)
- [ ] Admin dashboard
---
## ๐ฌ Contact
- [GitHub](https://github.com/sbrunomello)
Built with โ๏ธ by Mello