Skip to content

Backend of a crypto exchange simulator with account creation, login, and transaction simulation using Spring Security.

License

Notifications You must be signed in to change notification settings

sbrunomello/simdex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Spring

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


💡 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
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

git clone https://github.com/sbrunomello/simdex.git
cd simdex
mvn spring-boot:run

Backend will run on:
http://localhost:8080


🧪 Example Requests

Register

POST /auth/register
{
  "username": "mello",
  "password": "123456",
  "email": "[email protected]",
  "firstName": "Bruno",
  "lastName": "Mello"
}

Get BTC Price

GET /api/v2/price
→ name: Bitcoin | price: 69234.56

🧩 Frontend

Simdex is designed to work with:
👉 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
    Built with ⚙️ by Mello

About

Backend of a crypto exchange simulator with account creation, login, and transaction simulation using Spring Security.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages