This guide will help you set up the BitaURL development environment and get the application running locally. BitaURL consists of three main components: the backend API (Spring Boot), frontend web application (React), and admin panel (React).
- Node.js 18+ and npm/yarn
- Java 17+ (OpenJDK recommended)
- Maven 3.8+
- MongoDB 6.0+
- Redis 7.0+
- Git for version control
- Docker and Docker Compose (for containerized development)
- MongoDB Compass (database GUI)
- Postman (API testing)
- VS Code or IntelliJ IDEA (recommended IDEs)
The fastest way to get BitaURL running locally is using Docker Compose:
# Clone the repository
git clone https://github.com/bitaurl/bitaurl.git
cd bitaurl
# Start all services with Docker Compose
docker-compose up -d
# Wait for services to start (about 2-3 minutes)
docker-compose logs -f
# Access the applications
# Frontend: http://localhost:3000
# Admin Panel: http://localhost:3001
# Backend API: http://localhost:8080
# MongoDB: localhost:27017
# Redis: localhost:6379# Clone the repository
git clone https://github.com/bitaurl/bitaurl.git
cd bitaurl
# Create environment files
cp frontend/.env.example frontend/.env.local
cp backend/src/main/resources/application-dev.yml.example backend/src/main/resources/application-dev.yml# Install MongoDB (macOS with Homebrew)
brew tap mongodb/brew
brew install mongodb-community@6.0
# Start MongoDB
brew services start mongodb/brew/mongodb-community
# Create database and user
mongosh
> use bitaurl
> db.createUser({
user: "bitaurl_user",
pwd: "bitaurl_password",
roles: ["readWrite"]
})# Install Redis (macOS with Homebrew)
brew install redis
# Start Redis
brew services start redis
# Test Redis connection
redis-cli ping
# Should return: PONGcd backend
# Install dependencies and run tests
mvn clean install
# Run the application in development mode
mvn spring-boot:run -Dspring-boot.run.profiles=development
# Or run with specific configuration
mvn spring-boot:run -Dspring-boot.run.arguments="--spring.profiles.active=development"The backend will start on http://localhost:8080
# backend/src/main/resources/application-dev.yml
spring:
profiles:
active: development
data:
mongodb:
uri: mongodb://bitaurl_user:bitaurl_password@localhost:27017/bitaurl
database: bitaurl
redis:
host: localhost
port: 6379
timeout: 2000ms
security:
oauth2:
client:
registration:
google:
client-id: your_google_client_id
client-secret: your_google_client_secret
server:
port: 8080
app:
jwt:
secret: your_jwt_secret_key_for_development
access-token-expiration: 900000 # 15 minutes
refresh-token-expiration: 604800000 # 7 days
cors:
allowed-origins: http://localhost:3000,http://localhost:3001
file-storage:
provider: local
local:
upload-dir: ./uploads
rate-limit:
requests-per-minute: 1000
burst-capacity: 2000
logging:
level:
com.urlshortener: DEBUG
org.springframework.security: DEBUGcd frontend
# Install dependencies
npm install
# Start development server
npm startThe frontend will start on http://localhost:3000
# frontend/.env.local
REACT_APP_API_URL=http://localhost:8080
REACT_APP_RAZORPAY_KEY=rzp_test_your_key_here
REACT_APP_GOOGLE_CLIENT_ID=your_google_client_id
REACT_APP_SENTRY_DSN=your_sentry_dsn_for_error_tracking
REACT_APP_ENVIRONMENT=developmentcd admin-panel
# Install dependencies
npm install
# Start development server
npm startThe admin panel will start on http://localhost:3001
# admin-panel/.env.local
REACT_APP_API_URL=http://localhost:8080
REACT_APP_ENVIRONMENT=development# Run the database seeder script
cd backend
mvn spring-boot:run -Dspring-boot.run.arguments="--spring.profiles.active=development --seed-data=true"Or manually create an admin user:
// Connect to MongoDB
mongosh mongodb://localhost:27017/bitaurl
// Create admin user
db.users.insertOne({
email: "admin@bitaurl.com",
name: "Admin User",
passwordHash: "$2b$10$rZ8Q8Q8Q8Q8Q8Q8Q8Q8Q8O", // password: admin123
role: "SUPER_ADMIN",
plan: "ENTERPRISE",
emailVerified: true,
active: true,
createdAt: new Date(),
updatedAt: new Date()
});# Load sample data for development
cd scripts
./load-sample-data.shcurl http://localhost:8080/api/v1/healthExpected response:
{
"status": "UP",
"timestamp": "2024-01-30T10:15:30Z",
"components": {
"database": {"status": "UP"},
"cache": {"status": "UP"}
}
}- Open
http://localhost:3000in your browser - You should see the BitaURL homepage
- Try creating an account or logging in
- Open
http://localhost:3001in your browser - Login with admin credentials:
admin@bitaurl.com/admin123 - You should see the admin dashboard
# Test user registration
curl -X POST http://localhost:8080/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com",
"password": "password123",
"confirmPassword": "password123"
}'
# Test URL creation (after getting auth token)
curl -X POST http://localhost:8080/api/v1/urls \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-d '{
"originalUrl": "https://example.com",
"title": "Test URL"
}'bitaurl/
├── backend/ # Spring Boot API
│ ├── src/main/java/ # Java source code
│ ├── src/main/resources/ # Configuration files
│ └── src/test/ # Test files
├── frontend/ # React web application
│ ├── src/ # React source code
│ ├── public/ # Static assets
│ └── package.json # Dependencies
├── admin-panel/ # React admin interface
│ ├── src/ # React source code
│ └── package.json # Dependencies
├── docs/ # Documentation
├── scripts/ # Utility scripts
└── docker-compose.yml # Docker setup
cd backend
# Run with hot reload
mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=development"
# Run tests
mvn test
# Run specific test class
mvn test -Dtest=UrlServiceTest
# Generate test coverage report
mvn jacoco:report
# Build for production
mvn clean package -DskipTestscd frontend
# Start development server with hot reload
npm start
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Build for production
npm run build
# Lint code
npm run lint
# Format code
npm run format# Connect to database
mongosh mongodb://localhost:27017/bitaurl
# View collections
show collections
# Query users
db.users.find().pretty()
# Query URLs
db.urls.find({userId: ObjectId("...")}).pretty()
# Create index
db.urls.createIndex({shortCode: 1}, {unique: true})
# Drop collection (be careful!)
db.analytics.drop()# Connect to Redis
redis-cli
# View all keys
KEYS *
# Get cached URL
GET url:abc123
# Clear all cache
FLUSHALL
# Monitor Redis commands
MONITOR# Find process using port 8080
lsof -i :8080
# Kill process
kill -9 <PID>
# Or use different port
mvn spring-boot:run -Dserver.port=8081# Check MongoDB status
brew services list | grep mongodb
# Restart MongoDB
brew services restart mongodb/brew/mongodb-community
# Check MongoDB logs
tail -f /usr/local/var/log/mongodb/mongo.log# Check Redis status
brew services list | grep redis
# Restart Redis
brew services restart redis
# Test connection
redis-cli ping# Check Node.js version
node --version
# Use Node Version Manager (nvm)
nvm install 18
nvm use 18# Check Java version
java -version
# Set JAVA_HOME (macOS)
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
# Add to ~/.zshrc or ~/.bash_profile
echo 'export JAVA_HOME=$(/usr/libexec/java_home -v 17)' >> ~/.zshrc# Backend tests
cd backend && mvn test
# Frontend tests
cd frontend && npm test
# E2E tests (requires all services running)
cd frontend && npm run test:e2e# Create test database
mongosh
> use bitaurl_test
> db.createUser({
user: "bitaurl_test_user",
pwd: "bitaurl_test_password",
roles: ["readWrite"]
})- Review the Architecture Documentation
- Understand the API Documentation
- Check out the Frontend Documentation
- Follow the Contributing Guidelines
- Review the Security Documentation
- Understand the Testing Strategy
- Learn about Deployment Options
- Set up Monitoring & Analytics
- GitHub Issues: Report bugs and request features
- Discussions: Ask questions and share ideas
- Discord: Join our developer community
- Email: developers@bitaurl.com
- Postman Collection: Download API Collection
- Sample Data: Use
scripts/load-sample-data.sh - Database Schema: See Database Documentation
You're now ready to start developing with BitaURL! If you encounter any issues, please check the troubleshooting section or reach out to our community for help.