Thank you for your interest in contributing! This document provides guidelines and instructions for contributing.
- Bun >= 1.0
- Docker and Docker Compose
- PostgreSQL client tools (for local testing)
- Access to S3/R2/S3-compatible storage (for integration testing)
# Clone the repository
git clone https://github.com/johnnybui/postgres-backup-s3.git
cd postgres-backup-s3
# Install dependencies
bun install
# Copy environment example
cp env.example .env
# Edit .env with your configuration
# Run in development mode
bun run src/index.ts.
├── src/
│ └── index.ts # Main TypeScript application
├── backup.sh # Backup shell script
├── restore.sh # Restore shell script
├── run.sh # Entry point script
├── Dockerfile # Docker build configuration
├── docker-compose.example.yml # Example compose file
└── README.md # Documentation
-
Create a branch
git checkout -b feature/your-feature-name
-
Make your changes
- TypeScript changes:
src/index.ts - Shell scripts:
backup.sh,restore.sh - Documentation:
README.md
- TypeScript changes:
-
Test your changes
# Run locally bun run src/index.ts # Build Docker image make build # Test with Docker Compose make run make logs
-
Test backup/restore
# Test one-time backup make test-backup # List backups make list-backups # Test restore make test-restore BACKUP_FILE=postgres/db_2025-10-06.sql.gz
- TypeScript: Follow standard TypeScript conventions
- Shell scripts: Use shellcheck for linting
- Formatting: Use Prettier for TypeScript
# Format code
make format
# Type check
make lintBefore submitting a PR, test:
- One-time backup works
- Scheduled backup works (test with short interval)
- Multiple database backup works
- Parallel backup works
- Restore works for each storage type:
- AWS S3
- Cloudflare R2
- S3-Compatible (Minio)
- Encryption/decryption works
- Auto-cleanup works
- Custom format backup/restore works
# Test with R2
STORAGE_TYPE=R2
R2_ACCOUNT_ID=your-id
# Test with Minio
STORAGE_TYPE=COMPATIBLE
S3_ENDPOINT=http://minio:9000
# Test with AWS S3
STORAGE_TYPE=S3
S3_REGION=us-west-1- Update
README.mdfor user-facing changes - Update
CHANGELOG.mdfollowing Keep a Changelog format - Add inline comments for complex logic
- Update environment variable documentation
When filing a bug report, include:
- Environment details (OS, Docker version, etc.)
- Configuration (sanitize sensitive data!)
- Expected behavior
- Actual behavior
- Logs (with timestamps)
- Steps to reproduce
For feature requests, please:
- Check existing issues first
- Describe the use case
- Explain why it would be useful
- Consider backward compatibility
-
Fork the repository
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Commit your changes Follow the commit message format:
feat: ✨ add parallel restore support - Implement parallel restore using pg_restore -j - Add PARALLEL_RESTORE_JOBS env var - Update documentation -
Push to your fork
git push origin feature/amazing-feature
-
Open a Pull Request
- Use a clear title
- Reference any related issues
- Describe what changed and why
- Include testing steps
-
Code Review
- Address review comments
- Keep the PR focused and small
- Squash commits if requested
Use conventional commits:
type(scope): emoji description
- Detailed change 1
- Detailed change 2
Types:
feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringchore: Maintenance taskstest: Test changes
Examples:
feat(storage): ✨ add Oracle Cloud support
fix(backup): 🐛 fix encryption for custom format
docs: 📝 add DigitalOcean Spaces example
refactor(shell): ♻️ simplify storage type detection
chore(deps): ⬆️ update bun to 1.1.0
make builddocker buildx build --platform linux/amd64,linux/arm64 \
-f Dockerfile \
-t ghcr.io/johnnybui/postgres-backup-s3:latest .docker run --rm \
-e POSTGRES_DATABASE=test \
-e POSTGRES_HOST=localhost \
ghcr.io/johnnybui/postgres-backup-s3:latest- Never commit credentials or secrets
- Use
.envfor local configuration - Report security issues privately (see SECURITY.md if exists)
- Keep dependencies updated
By contributing, you agree that your contributions will be licensed under the MIT License.
Your contributions make this project better for everyone. Thank you for taking the time to contribute!
- Open an issue for questions
- Check existing issues and discussions
- Read the documentation thoroughly
Happy coding! 🚀