-
Notifications
You must be signed in to change notification settings - Fork 0
05‐ Contributing Guide
Dorgham edited this page Aug 15, 2025
·
1 revision
Thank you for your interest in contributing to Bilten! This guide will help you get started with contributing to the project.
- Getting Started
- Development Setup
- Code Style
- Testing
- Pull Request Process
- Issue Guidelines
- Community Guidelines
- Fork the repository on GitHub
- Clone your fork locally
- Set up the development environment (see Installation Guide)
- Create a feature branch for your changes
# Fork and clone
git clone https://github.com/YOUR_USERNAME/Bilten.git
cd Bilten
# Add upstream remote
git remote add upstream https://github.com/iDorgham/Bilten.git
# Create feature branch
git checkout -b feature/your-feature-nameWe welcome various types of contributions:
- 🐛 Bug fixes - Fix issues and improve stability
- ✨ New features - Add new functionality
- 📚 Documentation - Improve docs and guides
- 🧪 Tests - Add or improve test coverage
- 🎨 UI/UX improvements - Enhance user experience
- 🔧 Refactoring - Improve code quality
- 🌐 Translations - Add new languages
- 📊 Performance - Optimize performance
- Node.js 18+
- PostgreSQL 15+
- Redis 7+
- Git
# Install dependencies
npm install
cd bilten-frontend && npm install && cd ..
cd bilten-scanner && npm install && cd ..
# Set up environment
cp .env.example .env
# Edit .env with your configuration
# Start services
docker-compose up -d postgres redis
# Run migrations and seed
npm run migrate
npm run seed
# Start development servers
npm run dev
cd bilten-frontend && npm start
cd bilten-scanner && npm run devWe use several tools to maintain code quality:
# Linting
npm run lint
npm run lint:fix
# Formatting
npm run format
# Type checking (if using TypeScript)
npm run type-check
# Testing
npm test
npm run test:watch
npm run test:coverage- Follow existing patterns in the codebase
- Write self-documenting code with clear variable names
- Add comments for complex logic
- Keep functions small and focused
- Use meaningful commit messages
// Use ES6+ features
const { destructuring } = require('module');
import { namedImport } from 'module';
// Use async/await instead of callbacks
async function fetchData() {
try {
const response = await api.get('/data');
return response.data;
} catch (error) {
logger.error('Failed to fetch data:', error);
throw error;
}
}
// Use descriptive variable names
const userProfile = await getUserProfile(userId);
const eventTickets = await getEventTickets(eventId);
// Add JSDoc comments for functions
/**
* Creates a new event with the provided data
* @param {Object} eventData - The event data
* @param {string} eventData.title - Event title
* @param {string} eventData.description - Event description
* @returns {Promise<Object>} The created event
*/
async function createEvent(eventData) {
// Implementation
}// Use functional components with hooks
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
const EventCard = ({ event, onSelect }) => {
const [isLoading, setIsLoading] = useState(false);
const handleClick = async () => {
setIsLoading(true);
try {
await onSelect(event);
} catch (error) {
console.error('Failed to select event:', error);
} finally {
setIsLoading(false);
}
};
return (
<div className="event-card">
<h3>{event.title}</h3>
<p>{event.description}</p>
<button
onClick={handleClick}
disabled={isLoading}
>
{isLoading ? 'Loading...' : 'Select Event'}
</button>
</div>
);
};
EventCard.propTypes = {
event: PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
}).isRequired,
onSelect: PropTypes.func.isRequired,
};
export default EventCard;// Use descriptive migration names
exports.up = function(knex) {
return knex.schema.createTable('user_profiles', (table) => {
table.increments('id').primary();
table.integer('user_id').unsigned().references('id').inTable('users');
table.string('bio', 500);
table.string('avatar_url');
table.timestamps(true, true);
// Add indexes for performance
table.index('user_id');
});
};
exports.down = function(knex) {
return knex.schema.dropTable('user_profiles');
};Use conventional commit format:
type(scope): description
[optional body]
[optional footer]
Examples:
feat(auth): add OAuth2 support for Google login
fix(events): resolve timezone display issue
docs(api): update authentication endpoints
test(orders): add integration tests for checkout flow
refactor(components): extract reusable EventCard component
Types:
-
feat: New feature -
fix: Bug fix -
docs: Documentation changes -
style: Code style changes -
refactor: Code refactoring -
test: Adding or updating tests -
chore: Maintenance tasks
We use Jest for testing. Write tests for:
- Unit tests for individual functions
- Integration tests for API endpoints
- Component tests for React components
- E2E tests for complete user flows
// Unit test example
describe('UserService', () => {
describe('createUser', () => {
it('should create a new user with valid data', async () => {
const userData = {
email: '[email protected]',
password: 'password123',
firstName: 'John',
lastName: 'Doe'
};
const user = await UserService.createUser(userData);
expect(user).toHaveProperty('id');
expect(user.email).toBe(userData.email);
expect(user.firstName).toBe(userData.firstName);
});
it('should throw error for invalid email', async () => {
const userData = {
email: 'invalid-email',
password: 'password123'
};
await expect(UserService.createUser(userData))
.rejects
.toThrow('Invalid email format');
});
});
});// Integration test example
describe('POST /v1/auth/register', () => {
it('should register a new user', async () => {
const userData = {
email: '[email protected]',
password: 'password123',
firstName: 'Jane',
lastName: 'Smith'
};
const response = await request(app)
.post('/v1/auth/register')
.send(userData)
.expect(201);
expect(response.body.success).toBe(true);
expect(response.body.data.user).toHaveProperty('id');
expect(response.body.data.tokens).toHaveProperty('accessToken');
});
});# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- --testPathPattern=user.test.js
# Run tests matching pattern
npm test -- --testNamePattern="should create user"- Ensure tests pass locally
- Update documentation if needed
- Follow code style guidelines
- Test your changes thoroughly
- Push your branch to your fork
- Create a PR against the main branch
- Fill out the PR template completely
- Link related issues if applicable
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
- [ ] Performance improvement
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes
## Screenshots (if applicable)
Add screenshots for UI changes
## Related Issues
Closes #123- Automated checks must pass
- Code review by maintainers
- Address feedback and make changes
- Get approval from at least one maintainer
- Merge when ready
Use the bug report template:
## Bug Description
Clear description of the issue
## Steps to Reproduce
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
## Expected Behavior
What should happen
## Actual Behavior
What actually happens
## Environment
- OS: [e.g. Windows 10]
- Browser: [e.g. Chrome 90]
- Version: [e.g. 1.0.0]
## Additional Context
Screenshots, logs, etc.Use the feature request template:
## Feature Description
Clear description of the feature
## Use Case
Why is this feature needed?
## Proposed Solution
How should it work?
## Alternatives Considered
Other approaches you considered
## Additional Context
Screenshots, mockups, etc.We are committed to providing a welcoming and inclusive environment for all contributors. Please:
- Be respectful and inclusive
- Use welcoming language
- Be collaborative
- Give and receive constructive feedback
- Focus on what is best for the community
- GitHub Issues for bug reports and feature requests
- GitHub Discussions for questions and general discussion
- Pull Requests for code contributions
- Discord/Slack for real-time communication (if available)
- Check existing issues and discussions
- Search documentation thoroughly
- Ask in discussions with clear context
- Be patient with responses
Contributors are recognized in several ways:
- Contributors list in README
- Release notes for significant contributions
- Special thanks for major features
- Contributor badges on GitHub profile
- Fork the repository
- Set up development environment
- Read the codebase
- Pick an issue to work on
- Create a feature branch
- Make your changes
- Write tests
- Submit a pull request
Thank you for contributing to Bilten! 🎉
Your contributions help make Bilten better for everyone. If you have any questions, don't hesitate to ask in our Discussions or create an issue.