Contributing Guide - dinesh-git17/my-progress-planner GitHub Wiki
Thank you for your interest in contributing to My Progress Planner! This guide will help you get started with contributing to our supportive meal tracking application.
We're building more than just a meal tracking app - we're creating a supportive digital companion that celebrates users' wellness journeys with genuine care and encouragement.
- Supportive & Encouraging - Every interaction should feel caring
- Privacy-First - User data security is paramount
- Accessibility - Everyone should feel welcome
- Quality - Code should be maintainable and reliable
- Community - We grow together through collaboration
We welcome various types of contributions:
- Found a bug? Please report it!
- Include reproduction steps
- Describe expected vs actual behavior
- Have an idea for improvement?
- Describe the problem you're solving
- Suggest a solution approach
- Improve existing docs
- Add missing documentation
- Fix typos or unclear sections
- Bug fixes
- New features
- Performance improvements
- Test coverage improvements
- UI/UX improvements
- Accessibility enhancements
- Mobile responsiveness fixes
# Fork the repository on GitHub, then:
git clone https://github.com/your-username/my-progress-planner.git
cd my-progress-planner
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env.local
# Edit .env.local with your credentials
# Start development server
npm run dev
See Installation Guide for detailed setup instructions.
# Create and switch to feature branch
git checkout -b feature/amazing-feature
# Or for bug fixes
git checkout -b fix/issue-description
-
feature/description
- New features -
fix/description
- Bug fixes -
docs/description
- Documentation updates -
refactor/description
- Code refactoring -
test/description
- Test improvements
We use Conventional Commits:
type(scope): description
[optional body]
[optional footer]
Types:
-
feat
- New feature -
fix
- Bug fix -
docs
- Documentation -
style
- Formatting, no code change -
refactor
- Code restructuring -
test
- Adding/updating tests -
chore
- Maintenance tasks
Examples:
git commit -m "feat(meals): add meal editing functionality"
git commit -m "fix(auth): resolve login redirect issue"
git commit -m "docs(api): update endpoint documentation"
-
Strict mode enabled - No
any
types unless absolutely necessary - Proper typing - Define interfaces for all data structures
- JSDoc comments - Document complex functions
// ✅ Good
interface MealData {
id: string;
content: string;
mealType: 'breakfast' | 'lunch' | 'dinner';
loggedAt: Date;
}
/**
* Logs a meal and generates AI response
* @param mealData - The meal information to log
* @returns Promise with meal and AI response
*/
async function logMeal(mealData: MealData): Promise<MealResponse> {
// Implementation
}
// ❌ Avoid
function logMeal(data: any): any {
// Implementation
}
// ✅ Good - Functional component with proper typing
interface MealCardProps {
meal: Meal;
onEdit?: () => void;
className?: string;
}
export default function MealCard({
meal,
onEdit,
className = ''
}: MealCardProps) {
return (
<div className={`meal-card ${className}`}>
{/* Component content */}
</div>
);
}
// ❌ Avoid - Unclear props, missing types
export default function MealCard(props) {
return <div>{/* content */}</div>;
}
- Use Tailwind utilities - Avoid custom CSS when possible
- Responsive design - Mobile-first approach
- Accessibility - ARIA labels, focus states, color contrast
// ✅ Good - Responsive, accessible
<button
className="
px-4 py-2
bg-pink-500 hover:bg-pink-600
text-white font-medium rounded-lg
focus:outline-none focus:ring-2 focus:ring-pink-500 focus:ring-offset-2
disabled:opacity-50 disabled:cursor-not-allowed
transition-colors duration-200
sm:px-6 sm:py-3
"
aria-label="Log breakfast meal"
disabled={isLoading}
>
{isLoading ? 'Logging...' : 'Log Meal'}
</button>
Every new feature should include unit tests:
// __tests__/utils/mealValidation.test.ts
import { validateMealContent } from '@/utils/mealValidation';
describe('validateMealContent', () => {
it('should accept valid meal content', () => {
const result = validateMealContent('Oatmeal with berries');
expect(result.isValid).toBe(true);
});
it('should reject empty meal content', () => {
const result = validateMealContent('');
expect(result.isValid).toBe(false);
expect(result.error).toContain('required');
});
it('should reject meal content that is too long', () => {
const longContent = 'a'.repeat(501);
const result = validateMealContent(longContent);
expect(result.isValid).toBe(false);
});
});
Test API endpoints:
// __tests__/api/meals.test.ts
import { createMocks } from 'node-mocks-http';
import handler from '@/app/api/meals/route';
describe('/api/meals', () => {
it('should log a meal successfully', async () => {
const { req, res } = createMocks({
method: 'POST',
body: {
mealType: 'breakfast',
content: 'Scrambled eggs'
}
});
await handler(req, res);
expect(res._getStatusCode()).toBe(200);
const data = JSON.parse(res._getData());
expect(data.error).toBeNull();
expect(data.data.meal.content).toBe('Scrambled eggs');
});
});
For critical user journeys:
// e2e/meal-logging.spec.ts
import { test, expect } from '@playwright/test';
test('user can log a meal', async ({ page }) => {
await page.goto('/');
await page.click('[data-testid="breakfast-button"]');
await page.fill('[data-testid="meal-input"]', 'Oatmeal with berries');
await page.click('[data-testid="log-meal-button"]');
await expect(page.locator('[data-testid="success-message"]')).toBeVisible();
});
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e
- Warm & Encouraging - Use soft colors and friendly language
- Clean & Minimal - Avoid clutter, focus on essentials
- Consistent - Follow established patterns
- Accessible - WCAG 2.1 AA compliance
/* Primary colors */
--color-primary: #f472b6; /* Pink-400 */
--color-primary-dark: #ec4899; /* Pink-500 */
/* Background colors */
--color-bg-primary: #f5ede6; /* Warm beige */
--color-bg-secondary: #ffffff; /* White */
/* Text colors */
--color-text-primary: #374151; /* Gray-700 */
--color-text-secondary: #6b7280; /* Gray-500 */
/* Status colors */
--color-success: #10b981; /* Emerald-500 */
--color-warning: #f59e0b; /* Amber-500 */
--color-error: #ef4444; /* Red-500 */
- Headings: DM Sans Bold
- Body: DM Sans Regular
- UI Elements: DM Sans Medium
- Consistent spacing - Use Tailwind's spacing scale
- Mobile-first - Design for mobile, enhance for desktop
- Touch-friendly - Minimum 44px touch targets
// ✅ Good - Validate input, handle errors
export async function POST(request: Request) {
try {
const { mealType, content } = await request.json();
// Validate input
if (!mealType || !['breakfast', 'lunch', 'dinner'].includes(mealType)) {
return NextResponse.json(
{ error: 'Invalid meal type' },
{ status: 400 }
);
}
if (!content || content.trim().length === 0) {
return NextResponse.json(
{ error: 'Meal content is required' },
{ status: 400 }
);
}
// Sanitize content
const sanitizedContent = content.trim().slice(0, 500);
// Process request...
} catch (error) {
console.error('API Error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}
-
Never commit secrets - Use
.env.local
for development - Validate required vars - Check at startup
-
Prefix client vars - Use
NEXT_PUBLIC_
for client-side
- Check user auth - Validate JWT tokens
- Use RLS policies - Database-level security
- Handle auth errors - Graceful error handling
/**
* Generates an encouraging AI response for a logged meal
*
* @param mealData - The meal information
* @param userContext - User's streak and history
* @returns Promise resolving to AI response
*
* @example
* ```typescript
* const response = await generateMealResponse({
* content: 'Oatmeal with berries',
* mealType: 'breakfast'
* }, {
* streak: 5,
* previousMeals: []
* });
* ```
*/
async function generateMealResponse(
mealData: MealData,
userContext: UserContext
): Promise<AIResponse> {
// Implementation
}
Update the API Documentation when adding endpoints:
#### Log a Meal
```http
POST /api/meals/log
Request Body:
{
"mealType": "breakfast",
"content": "Oatmeal with berries"
}
Response:
{
"data": {
"meal": {...},
"aiResponse": "What a nutritious start! 💕"
},
"error": null
}
## 🚀 Pull Request Process
### Before Submitting
1. **Test your changes** thoroughly
2. **Update documentation** if needed
3. **Run linting** and fix issues
4. **Write meaningful commit messages**
5. **Keep changes focused** - one feature/fix per PR
### PR Template
```markdown
## Description
Brief description of changes made.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Refactoring
- [ ] Performance improvement
## Testing
- [ ] Unit tests pass
- [ ] Integration tests pass
- [ ] Manual testing completed
- [ ] E2E tests pass (if applicable)
## Screenshots
Include screenshots for UI changes.
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes
- [ ] Accessibility considered
- Automated checks must pass
- Code review by maintainer
- Testing in development environment
- Approval and merge
New contributors should look for issues labeled:
-
good first issue
- Beginner-friendly -
help wanted
- Community contributions welcome -
documentation
- Documentation improvements -
ui/ux
- Design improvements
- Fix typos in documentation
- Add missing TypeScript types
- Improve accessibility
- Add unit tests for utilities
- Enhance mobile responsiveness
- Be respectful and constructive
- Ask questions if unclear
- Help others when you can
- Share knowledge and learnings
- Be kind - Remember there's a person behind the code
- Be specific - Explain the "why" behind suggestions
- Appreciate good work - Acknowledge well-written code
- Learn from others - Code reviews are learning opportunities
## Bug Report Template
**Describe the bug**
Clear description of what the bug is.
**To Reproduce**
1. Go to '...'
2. Click on '...'
3. See error
**Expected behavior**
What you expected to happen.
**Screenshots**
If applicable, add screenshots.
**Environment:**
- OS: [e.g. iOS, Windows]
- Browser: [e.g. Chrome, Safari]
- Version: [e.g. 22]
**Additional context**
Any other context about the problem.
Contributors who make significant contributions will be:
- Acknowledged in release notes
- Listed in contributors section
- Invited to the core team (for ongoing contributors)
- Questions: GitHub Discussions
- Real-time chat: Discord server (link in README)
- Mentorship: Reach out to maintainers for guidance
-
Email:
[email protected]
- Next.js Documentation
- TypeScript Handbook
- Tailwind CSS Docs
- Supabase Documentation
- React Testing Library
Thank you for contributing to My Progress Planner! Together, we're building something that truly makes a difference in people's wellness journeys. 💕