Complete guide to setting up and running the Cryptocurrency Wallet & Trading Engine Simulator.
java -version # Should show Java 21
mvn -version # Should show Maven 3.9+
docker --version # Should show Docker 20.10+
docker-compose --version # Should show docker-compose 2.0+git clone <repository-url>
cd crypto-wallet-engineStart PostgreSQL, Zookeeper, and Kafka:
docker-compose up -d postgres zookeeper kafkaWait for services to be healthy (check logs):
docker-compose logs -fYou should see:
- PostgreSQL:
database system is ready to accept connections - Zookeeper:
binding to port 0.0.0.0/0.0.0.0:2181 - Kafka:
started (kafka.server.KafkaServer)
mvn clean packageThis will:
- Download dependencies
- Compile Java code
- Run unit tests
- Package JAR file
Option A: Maven
mvn spring-boot:runOption B: JAR
java -jar target/crypto-wallet-engine-1.0.0-SNAPSHOT.jarOption C: Docker
docker-compose up --build appCheck health endpoint:
curl http://localhost:8080/actuator/healthExpected response:
{"status":"UP"}Edit src/main/resources/application.properties:
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/crypto_wallet
spring.datasource.username=crypto_user
spring.datasource.password=crypto_password
# Kafka
spring.kafka.bootstrap-servers=localhost:9092
# Risk Engine
crypto.risk.max-exposure-usdt=100000
crypto.risk.enabled=trueEdit docker-compose.yml to customize:
- Database credentials
- Kafka settings
- Port mappings
IntelliJ IDEA:
- File → Open → Select project directory
- Maven will auto-import dependencies
- Set JDK 21 in Project Structure
- Enable annotation processing for Lombok and MapStruct
Eclipse:
- File → Import → Maven → Existing Maven Projects
- Select project directory
- Configure Java 21 in project properties
VS Code:
- Install Java Extension Pack
- Open project folder
- Maven will auto-detect
The application uses JPA with spring.jpa.hibernate.ddl-auto=update, so the schema is created automatically on first run.
To reset the database:
docker-compose down -v # Remove volumes
docker-compose up -d postgresTopics are auto-created on first use. To manually create:
docker exec -it crypto-kafka kafka-topics.sh --create \
--bootstrap-server localhost:9092 \
--topic order-placed-events \
--partitions 3 \
--replication-factor 1mvn testIntegration tests use Testcontainers (requires Docker):
mvn verify- Start the application
- Run Gatling:
mvn gatling:testView results in target/gatling/
Error: Port 8080 is already in use
Solution:
# Find process using port 8080
lsof -i :8080 # macOS/Linux
netstat -ano | findstr :8080 # Windows
# Kill process or change port in application.properties
server.port=8081Error: Connection refused or Connection timeout
Solution:
- Check PostgreSQL is running:
docker-compose ps postgres
- Check connection string in
application.properties - Verify credentials match
docker-compose.yml
Error: Bootstrap broker localhost:9092 disconnected
Solution:
- Check Kafka is running:
docker-compose ps kafka
- Check Kafka logs:
docker-compose logs kafka
- Verify Kafka is ready:
docker exec crypto-kafka kafka-broker-api-versions --bootstrap-server localhost:9092
Error: Could not resolve dependencies
Solution:
- Clear Maven cache:
rm -rf ~/.m2/repository mvn clean install - Check internet connection
- Verify Maven settings.xml
Error: Could not find a valid Docker environment
Solution:
- Ensure Docker is running
- Check Docker daemon:
docker ps
- Verify Docker socket permissions (Linux)
Set these in production:
SPRING_DATASOURCE_URL=jdbc:postgresql://prod-db:5432/crypto_wallet
SPRING_DATASOURCE_USERNAME=prod_user
SPRING_DATASOURCE_PASSWORD=<secure-password>
SPRING_KAFKA_BOOTSTRAP_SERVERS=kafka-prod:9092
SPRING_PROFILES_ACTIVE=productiondocker build -t crypto-wallet-engine:latest .
docker run -d \
-p 8080:8080 \
-e SPRING_DATASOURCE_URL=... \
-e SPRING_KAFKA_BOOTSTRAP_SERVERS=... \
crypto-wallet-engine:latestConfigure health checks:
curl http://localhost:8080/actuator/health- Read API Documentation to learn how to use the APIs
- Check Architecture Overview to understand the design
- Review Testing Guide for testing strategies