Contributing to Med Agenda
Thank you for your interest in contributing to Med Agenda! This guide will help you get started with development, understand our coding standards, and submit your contributions.Table of Contents
- How to Contribute
- Development Setup
- Code Style Guidelines
- Testing Approach
- Pull Request Process
- Reporting Issues
- Design Patterns
How to Contribute
There are many ways to contribute to Med Agenda:- Report bugs - Submit detailed bug reports with reproduction steps
- Suggest features - Propose new features or enhancements
- Write code - Fix bugs, implement features, or improve existing code
- Improve documentation - Enhance docs, add examples, fix typos
- Write tests - Increase test coverage for backend and frontend
- Review pull requests - Help review and test PRs from other contributors
Development Setup
Prerequisites
Before you begin, ensure you have the following installed:- Java 21 or higher
- Node.js 18.x or higher
- npm or yarn
- PostgreSQL 14+ (or use Neon.tech)
- Maven 3.8+
- Git
- A code editor (VS Code, IntelliJ IDEA, or similar)
Fork and Clone
- Fork the repository on GitHub
- Clone your fork locally:
- Add upstream remote:
Backend Setup
-
Navigate to backend directory:
-
Configure database:
Create
src/main/resources/application-dev.properties: -
Create development database:
-
Build and run:
-
Verify backend is running:
- Visit http://localhost:8080
- You should see “Hello World” message
Frontend Setup
-
Navigate to frontend directory:
-
Install dependencies:
-
Configure environment:
Create
.envfile: -
Start development server:
-
Verify frontend is running:
- Visit http://localhost:5173
- You should see the Med Agenda landing page
Database Schema
The application automatically creates the database schema on first run. However, you can manually create tables if needed by checking the entity models inbackend/gestaoConsultasMedicas/src/main/java/com/ufu/gestaoConsultasMedicas/models/.
Code Style Guidelines
Java/Backend
Naming Conventions:- Classes:
PascalCase(e.g.,PatientService) - Methods:
camelCase(e.g.,createPatient) - Constants:
UPPER_SNAKE_CASE(e.g.,MAX_ATTEMPTS) - Packages:
lowercase(e.g.,com.ufu.gestaoConsultasMedicas.service)
- Use constructor injection instead of field injection
- Follow Single Responsibility Principle
- Write self-documenting code with clear variable names
- Add comments only when necessary to explain “why”, not “what”
- Use Optional instead of returning null
- Throw specific exceptions with meaningful messages
- Use Lombok annotations to reduce boilerplate (@Getter, @Setter, @NoArgsConstructor, etc.)
TypeScript/Frontend
Naming Conventions:- Components:
PascalCase(e.g.,PatientDashboard.tsx) - Functions/Variables:
camelCase(e.g.,fetchPatients) - Constants:
UPPER_SNAKE_CASE(e.g.,API_BASE_URL) - Interfaces/Types:
PascalCasewith “I” prefix optional (e.g.,PatientorIPatient)
- Use TypeScript for type safety
- Prefer functional components with hooks
- Use
constfor all variables unless reassignment is needed - Extract reusable logic into custom hooks
- Use async/await instead of promise chains
- Handle loading and error states properly
- Keep components small and focused
- Use Tailwind CSS classes for styling
Git Commit Messages
Follow conventional commit format:feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, missing semicolons, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Testing Approach
Backend Testing
Unit Tests - Test individual components in isolation:Frontend Testing
Component Tests (using React Testing Library):Running Tests
Backend:Pull Request Process
Before Submitting
-
Update your fork:
-
Create a feature branch:
- Make your changes following code style guidelines
- Write tests for new functionality
-
Run tests to ensure nothing is broken:
-
Commit your changes with clear commit messages:
-
Push to your fork:
Submitting the Pull Request
- Open a pull request on GitHub from your fork to the main repository
-
Fill out the PR template:
-
Link related issues: Reference any related issues using
Fixes #123orCloses #456 - Request review from maintainers
- Address feedback: Make requested changes and push updates
-
Keep PR updated: Rebase on main if needed:
PR Review Criteria
Your PR will be reviewed for:- Code quality: Follows style guidelines and best practices
- Functionality: Works as intended and solves the problem
- Tests: Adequate test coverage for new code
- Documentation: Updated docs if needed
- Design patterns: Uses appropriate patterns where applicable
- Performance: No significant performance degradation
- Security: No security vulnerabilities introduced
Reporting Issues
Bug Reports
When reporting bugs, include:- Clear title describing the issue
- Steps to reproduce the bug
- Expected behavior vs actual behavior
- Environment details:
- OS and version
- Java version
- Node.js version
- Browser (for frontend issues)
- Screenshots or logs if applicable
- Possible solution if you have ideas
Feature Requests
For feature requests, include:- Problem statement: What problem does this solve?
- Proposed solution: How should it work?
- Alternatives considered: Other approaches you’ve thought about
- Additional context: Mockups, examples, etc.
Design Patterns
When contributing, follow the established design patterns:- Factory Pattern: For object creation with validation
- Strategy Pattern: For interchangeable algorithms
- Decorator Pattern: For adding behavior dynamically
- Facade Pattern: For simplifying complex subsystems
- Memento Pattern: For state management and history
Design Principles
Adhere to these principles:- Single Responsibility Principle (SRP): Each class should have one reason to change
- Open/Closed Principle (OCP): Open for extension, closed for modification
- Interface Segregation Principle (ISP): Don’t force clients to depend on unused methods
Questions?
If you have questions about contributing:- Check existing documentation
- Search closed issues and PRs
- Open a new issue with the “question” label
- Reach out to maintainers