Thank you for your interest in contributing to Vesting Vault! This guide will help you get the development environment set up and running quickly.
Before you begin, ensure you have the following installed:
- Docker (v20.10 or later)
- Docker Compose (v2.0 or later)
- Git
The fastest way to get started is using Docker Compose:
-
Clone the repository
git clone <repository-url> cd Vesting-Vault
-
Start all services
docker-compose up -d
-
Verify services are running
# Check backend health curl http://localhost:3000/health # Check all services status docker-compose ps
That's it! Your development environment is now running with:
- Backend API: http://localhost:3000
- PostgreSQL Database: localhost:5432
- Redis Cache: localhost:6379
# Start all services in detached mode
docker-compose up -d
# Start services with logs
docker-compose up
# Stop all services
docker-compose down
# Stop services and remove volumes (clean slate)
docker-compose down -v# View all logs
docker-compose logs
# View specific service logs
docker-compose logs backend
docker-compose logs db
docker-compose logs redis
# Follow logs in real-time
docker-compose logs -f backendThe backend service is configured for development with hot-reloading:
# Access the backend container
docker-compose exec backend sh
# Install new dependencies
docker-compose exec backend npm install <package-name>
# Run tests
docker-compose exec backend npm test
# Access database directly
docker-compose exec db psql -U postgres -d vesting_vault# Connect to PostgreSQL
docker-compose exec db psql -U postgres -d vesting_vault
# Create database migrations (if using Sequelize)
docker-compose exec backend npx sequelize-cli migration:create --name migration_name
# Run migrations
docker-compose exec backend npx sequelize-cli db:migrateCopy the example environment file and customize as needed:
cp backend/.env.example backend/.envKey environment variables:
PORT: Backend server port (default: 3000)NODE_ENV: Environment (development/production)DB_HOST: Database host (default: db for Docker)DB_PORT: Database port (default: 5432)DB_NAME: Database name (default: vesting_vault)DB_USER: Database user (default: postgres)DB_PASSWORD: Database password (default: password)
Vesting-Vault/
├── backend/ # Node.js backend application
│ ├── src/
│ │ ├── index.js # Application entry point
│ │ └── database/ # Database configuration
│ ├── Dockerfile # Backend Docker configuration
│ ├── package.json # Node.js dependencies
│ └── .env.example # Environment variables template
├── docker-compose.yml # Docker services configuration
└── CONTRIBUTING.md # This file
If you encounter port conflicts, modify the port mappings in docker-compose.yml:
ports:
- "3001:3000" # Change host port from 3000 to 3001-
Ensure the database service is healthy:
docker-compose ps
-
Check database logs:
docker-compose logs db
-
Verify environment variables in your
.envfile match the database configuration.
If you encounter permission errors, run:
sudo chown -R $USER:$USER .- Use meaningful commit messages following conventional commit format
- Run tests before committing changes
- Check logs when services don't start properly
- Use
docker-compose down -vfor a completely fresh start - Monitor resource usage with
docker stats
Once the backend is running, you can access:
GET /- Welcome messageGET /health- Health check endpoint
If you encounter issues:
- Check the troubleshooting section above
- Review service logs:
docker-compose logs - Ensure Docker and Docker Compose are up to date
- Check that ports 3000, 5432, and 6379 are available
- Use ESLint for JavaScript code formatting
- Follow conventional commit message format
- Write meaningful variable and function names
- Add comments for complex logic
Thank you for contributing to Vesting Vault! 🚀