First off, thank you for considering contributing to the Inventory & Billing Management System! 🎉
It's people like you that make this project such a great tool for the community. This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- How Can I Contribute?
- Development Setup
- Style Guidelines
- Commit Guidelines
- Pull Request Process
- Community
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
- Be Respectful: Treat everyone with respect. No harassment, discrimination, or inappropriate behavior.
- Be Collaborative: Work together to resolve conflicts and assume good intentions.
- Be Professional: Keep discussions focused on the project and constructive.
- Be Inclusive: Welcome newcomers and help them get started.
Before contributing, make sure you have:
- A GitHub account
- Git installed on your local machine
- Node.js (v18+) and npm installed
- MongoDB installed locally or access to MongoDB Atlas
- Basic knowledge of:
- JavaScript/TypeScript
- React/Next.js
- Node.js/Express
- MongoDB
- Git version control
Never contributed to open source before? Here are some resources to help:
- How to Contribute to Open Source
- First Timers Only
- How to Contribute to an Open Source Project on GitHub
Look for issues labeled with:
good first issue- Good for newcomershelp wanted- Extra attention neededdocumentation- Documentation improvements
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include:
Bug Report Template:
### Description
[Clear and concise description of the bug]
### Steps to Reproduce
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
### Expected Behavior
[What you expected to happen]
### Actual Behavior
[What actually happened]
### Screenshots
[If applicable, add screenshots]
### Environment
- OS: [e.g., Windows 10, macOS 12.0, Ubuntu 20.04]
- Browser: [e.g., Chrome 96, Firefox 95]
- Node.js version: [e.g., 18.12.0]
- npm version: [e.g., 8.19.0]
### Additional Context
[Any other context about the problem]Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
Feature Request Template:
### Feature Description
[Clear and concise description of the feature]
### Problem it Solves
[Describe the problem this feature would solve]
### Proposed Solution
[Describe how you envision this feature working]
### Alternatives Considered
[Any alternative solutions or features you've considered]
### Additional Context
[Any other context, mockups, or examples]- Check the Issues page
- Look for issues labeled
help wantedorgood first issue - Comment on the issue to express your interest
- Wait for assignment before starting work
- Discuss the feature in an issue first
- Get approval from maintainers
- Follow the development workflow below
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/Inventory-Billing-Management-System.git
cd Inventory-Billing-Management-System- Add the upstream repository:
git remote add upstream https://github.com/ORIGINAL-OWNER/Inventory-Billing-Management-System.git- Create a new branch for your feature/fix:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Keep your branch up to date:
git fetch upstream
git rebase upstream/maincd backend
npm install
cp .env.example .env
# Configure your .env file
npm run devcd frontend
npm install
cp .env.example .env.local
# Configure your .env.local file
npm run dev# Backend tests
cd backend
npm test
# Frontend tests
cd frontend
npm test
# Linting
npm run lintWe use ESLint and Prettier for code formatting. Key conventions:
// Use meaningful variable names
const userProfile = await getUserProfile(userId);
// Use async/await over promises
async function fetchData() {
try {
const data = await api.get('/endpoint');
return data;
} catch (error) {
console.error('Error fetching data:', error);
throw error;
}
}
// Destructure when possible
const { name, email, role } = user;
// Use template literals for string concatenation
const message = `Welcome ${name}!`;
// Comment complex logic
// Calculate the discount based on user tier and purchase amount
const discount = calculateTieredDiscount(user.tier, purchaseAmount);// Use functional components with TypeScript
interface ButtonProps {
label: string;
onClick: () => void;
variant?: 'primary' | 'secondary';
}
export const Button: React.FC<ButtonProps> = ({
label,
onClick,
variant = 'primary'
}) => {
return (
<button
className={`btn btn-${variant}`}
onClick={onClick}
>
{label}
</button>
);
};
// Use custom hooks for logic
const useAuth = () => {
const [user, setUser] = useState(null);
// ... authentication logic
return { user, login, logout };
};// RESTful endpoints
GET /api/products // List all products
GET /api/products/:id // Get single product
POST /api/products // Create product
PUT /api/products/:id // Update product
DELETE /api/products/:id // Delete product
// Consistent error responses
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
}
// Consistent success responses
{
"success": true,
"data": {
// ... response data
},
"pagination": {
"page": 1,
"limit": 10,
"total": 100
}
}/* Use Tailwind utility classes */
<div className="flex items-center justify-between p-4 bg-white rounded-lg shadow-md">
/* Custom CSS when necessary */
.custom-animation {
animation: slideIn 0.3s ease-in-out;
}
/* Component-specific styles in modules */
.button {
@apply px-4 py-2 font-semibold text-white bg-blue-500 rounded hover:bg-blue-600;
}We follow the Conventional Commits specification:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, semicolons, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or modifying testsbuild: Build system or dependency changesci: CI/CD configuration changeschore: Other changes that don't modify src or test files
# Feature
git commit -m "feat(auth): add password reset functionality"
# Bug fix
git commit -m "fix(products): resolve inventory count issue"
# Documentation
git commit -m "docs(readme): update installation instructions"
# With body
git commit -m "feat(reports): add export to PDF functionality
- Added PDF generation library
- Created export service
- Updated UI with export button
- Added tests for export functionality
Closes #123"- Update your branch:
git fetch upstream
git rebase upstream/main- Run tests:
npm test
npm run lint-
Update documentation if needed
-
Self-review your code
## Description
[Describe your changes]
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
## Testing
- [ ] I have tested my changes locally
- [ ] All tests pass
- [ ] I have added tests for my changes
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published
## Screenshots (if applicable)
[Add screenshots here]
## Related Issues
Closes #[issue number]- Automated checks run on all PRs
- Code review by at least one maintainer
- Testing in development environment
- Approval and merge
- Delete your local branch:
git branch -d feature/your-feature-name- Update your fork:
git checkout main
git pull upstream main
git push origin main- Never commit sensitive data (passwords, API keys, etc.)
- Validate all user inputs
- Use parameterized queries for database operations
- Keep dependencies updated
- Follow OWASP security guidelines
- Optimize database queries
- Implement proper caching strategies
- Lazy load components when appropriate
- Minimize bundle sizes
- Use proper indexing in MongoDB
- Write unit tests for new functions
- Add integration tests for API endpoints
- Include E2E tests for critical user flows
- Maintain test coverage above 80%
- Test edge cases and error scenarios
- Document all public APIs
- Add JSDoc comments to functions
- Update README for new features
- Include inline comments for complex logic
- Keep CHANGELOG updated
Contributors will be recognized in the following ways:
- Listed in the project's Contributors section
- Mentioned in release notes for significant contributions
- Special badges for regular contributors
- Invitation to join the core team for exceptional contributors
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For general discussions and questions
- Discord: Join our Discord
- Email: contributors@yourdomain.com
If you need help:
- Check the documentation
- Search existing issues
- Ask in GitHub Discussions
- Join our Discord community
- Contact maintainers directly
- VS Code - Recommended IDE
- Postman - API testing
- MongoDB Compass - Database GUI
- Git Kraken - Git GUI
Thank you for taking the time to contribute to the Inventory & Billing Management System! Your efforts help make this project better for everyone. We look forward to your contributions!
Happy Coding! 🚀