Complete guide for setting up and developing CryptoScope locally.
- Prerequisites
- Backend Development
- Frontend Development
- Full Stack Development
- Code Quality
- Testing
- Troubleshooting
| Tool | Version | Install Link |
|---|---|---|
| Rust | 1.80+ | rustup.rs |
| Node.js | 20+ | nodejs.org |
| Git | Latest | git-scm.com |
Linux:
sudo apt-get install -y pkg-config libssl-devmacOS:
xcode-select --install
brew install opensslWindows:
- Install Visual Studio Build Tools
- Install OpenSSL for Windows
# Clone repository
git clone https://github.com/HanSoBored/CryptoScope
cd CryptoScope
# Install build dependencies (Linux)
sudo apt-get install -y pkg-config libssl-dev# Development mode
cargo run
# With verbose logging
RUST_LOG=debug cargo run
# Release build
cargo run --release# Run tests
cargo test
# Format code
cargo fmt
# Lint code
cargo clippy -- -D warnings
# Generate password hash for admin auth
cargo run --bin generate-hash
# Check for outdated dependencies
cargo outdated- Make changes to
src/files - Run
cargo runto test - Format with
cargo fmt - Lint with
cargo clippy - Test with
cargo test
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install# Development server (requires backend on port 3000)
npm run dev
# Build for production
npm run build
# Production preview
npm run start
# Lint code
npm run lint- Start backend on port 3000 (see above)
- Make changes to
frontend/src/files - Auto-refresh happens automatically in dev mode
- Lint with
npm run lint - Build with
npm run buildbefore committing
Run both services simultaneously:
# Terminal 1: Start backend
cd CryptoScope
cargo run
# Terminal 2: Start frontend
cd CryptoScope/frontend
npm run dev| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3001 | Web UI |
| Backend API | http://localhost:3000 | REST API |
| API Docs | http://localhost:3000/api-docs/swagger-ui | Swagger UI |
Backend:
- Uses
cargo runwhich auto-recompiles on file changes - For faster reload, install
cargo-watch:cargo install cargo-watch cargo watch -x run
Frontend:
- Next.js dev server auto-refreshes on changes
- Fast Refresh preserves component state
# Format all code
cargo fmt
# Run linter with strict warnings
cargo clippy -- -D warnings
# Check for security issues
cargo audit# Navigate to frontend
cd frontend
# Format code
npm run format
# Run linter
npm run lint
# Type check
npm run type-checkSet up automatic linting before commits:
# Install Husky
npm install -D husky
npx husky install
# Add pre-commit hook
npx husky add .husky/pre-commit "npm run lint && npm run format"# Run all tests
cargo test
# Run specific test
cargo test test_name
# Run with output
cargo test -- --nocapture
# Run tests with coverage (requires cargo-tarpaulin)
cargo tarpaulin --out Htmlcd frontend
# Run tests
npm test
# Run with coverage
npm test -- --coverage# Start backend
cargo run
# In another terminal, test API
curl http://localhost:3000/health
curl http://localhost:3000/api/v1/exchangesRust build fails:
# Clean build cache
cargo clean
cargo build
# Update Rust
rustup updateFrontend build fails:
# Clear node modules
cd frontend
rm -rf node_modules package-lock.json
npm installBackend won't start:
# Check if port 3000 is in use
sudo lsof -i :3000
# Check .env file
cat .envFrontend can't connect to backend:
# Verify backend is running
curl http://localhost:3000/health
# Check API URL configuration
cat frontend/.env.local| Error | Solution |
|---|---|
openssl-sys build error |
Install OpenSSL dev packages |
node-sass build error |
Use sass instead or update Node |
| Port already in use | Kill process or change port |
| Module not found | Run npm install or cargo build |
- Deployment Guide - Docker deployment
- Configuration Guide - Environment variables
- API Reference - API endpoints