๐ค Contributing to MyZubster: Developer Guide
Complete guide for developers who want to contribute โ from setup to PR
๐ What is This Guide?
This guide is designed to help developers contribute to MyZubster. Whether you're a beginner or an experienced open-source contributor, you'll find everything you need:
โ
Setup โ Clone, install, and run the project
โ
Workflow โ Fork, branch, commit, and PR
โ
Code standards โ Style, linting, and testing
โ
PR process โ What to expect and how to get merged
โ
Community โ How to communicate and collaborate
๐งฉ Prerequisites
Requirement Version Check Command
Node.js v18+ node -v
npm v9+ npm -v
Git Latest git --version
Docker Latest (optional) docker --version
GitHub Account Free Sign up
๐ฆ Step 1: Fork the Repository
1.1 Fork the Main Repository
Go to: github.com/DanielIoni-creator/myzubster
Click the Fork button (top right).
1.2 Clone Your Fork
bash
Clone your fork (replace YOUR_USERNAME)
git clone https://github.com/YOUR_USERNAME/myzubster.git
cd myzubster
1.3 Add Upstream Remote
bash
Add the original repository as upstream
git remote add upstream https://github.com/DanielIoni-creator/myzubster.git
Verify remotes
git remote -v
origin https://github.com/YOUR_USERNAME/myzubster.git (fetch)
origin https://github.com/YOUR_USERNAME/myzubster.git (push)
upstream https://github.com/DanielIoni-creator/myzubster.git (fetch)
upstream https://github.com/DanielIoni-creator/myzubster.git (push)
๐๏ธ Step 2: Setup Development Environment
2.1 Clone All Submodules
bash
Clone all submodules recursively
git submodule update --init --recursive
2.2 Install Dependencies
bash
Gateway
cd gateway
npm install
cd ..
Marketplace
cd marketplace
npm install
cd ..
AI Assistant (if working on it)
cd ai-assistant
npm install
cd ..
Mobile App (optional)
cd app
npm install
cd ..
2.3 Configure Environment Variables
bash
Gateway
cp gateway/.env.example gateway/.env
Marketplace
cp marketplace/.env.example marketplace/.env
AI Assistant
cp ai-assistant/.env.example ai-assistant/.env
Edit each .env file with your values (use your own secrets).
๐ง Step 3: Run the Project
3.1 Start MongoDB
bash
Using Docker
docker run -d -p 27017:27017 --name mongodb mongo:6
Or use local MongoDB
mongod --dbpath ~/data/db
3.2 Start All Services
Terminal 1 โ Gateway:
bash
cd gateway
npm run dev
Terminal 2 โ Marketplace:
bash
cd marketplace
npm run dev
Terminal 3 โ AI Assistant:
bash
cd ai-assistant
npm run dev
Terminal 4 โ Mobile App (optional):
bash
cd app
npm start
3.3 Verify Everything Works
bash
Gateway health check
curl http://localhost:3000/api/health
Marketplace health check
curl http://localhost:4000/api/health
AI Assistant
๐ฟ Step 4: Branching Strategy
4.1 Branch Naming Convention
Branch Type Prefix Example
Feature feature/ feature/add-pgp-encryption
Bug Fix fix/ fix/escrow-release-bug
Documentation docs/ docs/update-api-reference
Hotfix hotfix/ hotfix/security-patch
Refactor refactor/ refactor/optimize-db-queries
4.2 Create a Branch
bash
Always create from main
git checkout main
git pull upstream main
Create feature branch
git checkout -b feature/your-feature-name
๐ Step 5: Code Standards
5.1 Code Style
We follow ESLint + Prettier for JavaScript/React code.
bash
Run linter
npm run lint
Run linter with auto-fix
npm run lint:fix
Run prettier
npm run format
Configuration files:
.eslintrc.js โ ESLint rules
.prettierrc โ Prettier rules
.editorconfig โ Editor settings
5.2 Commit Message Convention
We follow Conventional Commits:
Type Description
feat: New feature
fix: Bug fix
docs: Documentation update
style: Code style (formatting, missing semicolons)
refactor: Code refactoring
test: Adding/updating tests
chore: Maintenance tasks
ci: CI/CD changes
Examples:
text
feat: add PGP encryption for messages
fix: resolve escrow release timeout issue
docs: update API documentation for orders endpoint
refactor: optimize database queries for dashboard
test: add unit tests for escrow service
5.3 Commit Message Structure
text
():
Example:
text
feat(pgp): add key generation and encryption
- Implemented PGP key generation with 4096-bit RSA
- Added encrypt/decrypt functions
- Integrated with user profile
Closes #123
๐งช Step 6: Testing
6.1 Run Tests
bash
Run all tests
npm test
Run tests with coverage
npm test -- --coverage
Run specific test file
npm test -- auth.test.js
Run tests in watch mode
npm test -- --watch
6.2 Write Tests
We use Jest for testing. Create tests in tests/ or tests/ folders.
Example Test:
javascript
const request = require('supertest');
const app = require('../server');
describe('Auth API', () => {
it('should register a new user', async () => {
const res = await request(app)
.post('/api/auth/register')
.send({
email: 'test@example.com',
password: 'test123',
username: 'testuser',
name: 'Test User'
});
expect(res.statusCode).toBe(201);
expect(res.body).toHaveProperty('token');
expect(res.body.user).toHaveProperty('id');
});
it('should login a user', async () => {
const res = await request(app)
.post('/api/auth/login')
.send({
email: 'test@example.com',
password: 'test123'
});
expect(res.statusCode).toBe(200);
expect(res.body).toHaveProperty('token');
});
});
6.3 Test Coverage Requirements
Metric Requirement
Statements 80%+
Branches 75%+
Functions 80%+
Lines 80%+
๐ Step 7: Pull Request Process
7.1 Before Submitting PR
bash
Pull latest changes
git pull upstream main
Resolve conflicts if any
git merge upstream/main
Run tests
npm test
Run linter
npm run lint
Build the project
npm run build
Push to your fork
git push origin feature/your-feature-name
7.2 Create Pull Request
Go to your fork on GitHub
Click "Compare & pull request"
Fill in the PR template
Request review from maintainers
Link any related issues
7.3 PR Template
markdown
Description
Brief description of the changes.
Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
- [ ] Test
- [ ] Other
Checklist
- [ ] I have tested my changes
- [ ] I have updated the documentation
- [ ] I have added tests for my changes
- [ ] All tests pass locally
- [ ] My code follows the project's style guide
- [ ] My commits follow the Conventional Commits spec
Related Issues
Closes #123
Screenshots (if applicable)
Add screenshots here.
Additional Context
Add any other context here.
7.4 PR Review Process
Step Who Description
1 Contributor Opens PR with description
2 CI Automated tests and linting run
3 Maintainer Reviews code and provides feedback
4 Contributor Addresses feedback and updates PR
5 Maintainer Approves and merges PR
6 CI Deploys to staging
๐ Step 8: Code Review Guidelines
8.1 What We Look For
Aspect What We Check
Functionality Does it work as expected?
Code Quality Is it clean, readable, and maintainable?
Performance Are there any bottlenecks?
Security Are there any vulnerabilities?
Testing Are there sufficient tests?
Documentation Is it well-documented?
Style Does it follow the style guide?
8.2 Giving Feedback
Be constructive โ Focus on the code, not the person
Be specific โ Give examples when possible
Be kind โ Everyone is learning
Ask questions โ Understand the intent behind the code
Suggest improvements โ Offer alternatives when appropriate
8.3 Receiving Feedback
Stay open-minded โ Feedback is about improving the code
Ask clarifying questions โ If you don't understand
Explain your reasoning โ If you disagree
Be grateful โ People are spending time to help you
๐ ๏ธ Step 9: Tooling Setup
9.1 Recommended VS Code Extensions
Extension Purpose
ESLint JavaScript linting
Prettier Code formatting
GitLens Git history and blame
Thunder Client API testing
Docker Docker support
Tailwind CSS IntelliSense Tailwind support
9.2 VS Code Settings
json
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
]
}
9.3 Git Hooks (Husky)
We use Husky to enforce commit standards:
bash
Install husky
npm install -D husky
npx husky install
Add pre-commit hook
npx husky add .husky/pre-commit "npm test"
Add commit-msg hook
npx husky add .husky/commit-msg 'npx commitlint --edit $1'
๐ Step 10: Community Guidelines
10.1 Code of Conduct
We follow the Contributor Covenant Code of Conduct. Be respectful, inclusive, and kind.
10.2 Communication Channels
Channel Purpose
GitHub Issues Bug reports and feature requests
GitHub Discussions Q&A and community conversations
DEV.to Blog posts and tutorials
Discord (coming soon) Real-time chat
10.3 Issue Reporting
Bug Report Template:
markdown
Description
Brief description of the bug.
Steps to Reproduce
- Go to...
- Click on...
- See error...
Expected Behavior
What should happen.
Actual Behavior
What actually happens.
Environment
- OS: Windows/Linux/macOS
- Browser: Chrome/Firefox/Safari
- Version: v0.4.0
Screenshots (if applicable)
Add screenshots here.
Additional Context
Add any other context here.
Feature Request Template:
markdown
Description
Brief description of the feature.
Use Case
Why is this feature useful?
Proposed Solution
How should it work?
Alternatives
Any alternative solutions?
Additional Context
Add any other context here.
๐ Step 11: Documentation Standards
11.1 README Updates
When adding new features or changing APIs, update the relevant README files:
README.md โ Main project overview
gateway/README.md โ Gateway documentation
marketplace/README.md โ Marketplace documentation
app/README.md โ Mobile app documentation
ai-assistant/README.md โ AI Assistant documentation
11.2 API Documentation
When adding or changing API endpoints, update:
marketplace/README.md (API section)
docs/api-reference.md (if exists)
11.3 Inline Code Documentation
javascript
/**
- Function description
- @param {string} param1 - Description of param1
- @param {number} param2 - Description of param2
- @returns {Promise} Description of return value
*/
async function myFunction(param1, param2) {
// ...
}
โ Step 12: Checklist Before Submitting
โก I have tested my changes โก I have updated the documentation โก I have added tests for my changes โก All tests pass locally โก My code follows the project's style guide โก My commits follow the Conventional Commits spec โก I have checked for merge conflicts โก I have linked relevant issues โก I have filled in the PR template โก I am ready for review๐ Troubleshooting
"Cannot connect to MongoDB"
bashCheck if MongoDB is running
docker ps | grep mongodb
Start MongoDB
docker start mongodb
"Port already in use"
bashFind and kill process
sudo lsof -i :4000
sudo kill -9 [PID]Or change port in .env
echo "PORT=4001" >> marketplace/.env
"Tests failing"
bashCheck test output for details
npm test -- --verbose
Run specific test
npm test -- auth.test.js
Update snapshots
npm test -- -u
"Linting errors"
bashRun linter with auto-fix
npm run lint:fix
Run prettier
npm run format
๐ Quick Reference Card
Command Description
git clone Clone repository
npm install Install dependencies
npm run dev Start development server
npm test Run tests
npm run lint Run linter
npm run format Format code
npm run build Build for production
git checkout -b feature/name Create new branch
git add . Stage changes
git commit -m "feat: message" Commit changes
git push origin branch Push to GitHub
git pull upstream main Pull latest changes
git merge upstream/main Merge upstream changes
๐ ResourcesMyZubster GitHub: github.com/DanielIoni-creator/myzubster Contributor Covenant: contributor-covenant.org Conventional Commits: conventionalcommits.org Jest Documentation: jestjs.io ESLint: eslint.org Prettier: prettier.io๐ฏ Next Steps
Find an issue โ Check out open issues Start small โ Look for good-first-issue or help-wanted tags Ask questions โ Use GitHub Discussions Submit PR โ Follow the PR process Keep contributing โ There's always more to do!๐ฌ Join the Community
GitHub: github.com/DanielIoni-creator DEV.to: dev.to/danielioniBuilt with โค๏ธ for privacy, freedom, and decentralization.
Happy contributing! ๐
Top comments (0)