Contributing
Guidelines for contributing to ConsultFlow.
Getting Started
1. Fork the Repository
# Fork on GitHub, then clone
git clone https://github.com/YOUR-USERNAME/consultflow.git
cd consultflow
2. Set Up Development Environment
Follow the Installation Guide to set up:
- Backend with MongoDB
- Frontend with Next.js
- Azure AD configuration
3. Create a Branch
git checkout -b feature/your-feature-name
# or
git checkout -b fix/bug-description
Development Workflow
Running in Development
Backend:
cd backend
npm run dev # Runs with tsx watch
Frontend:
cd frontend
npm run dev # Runs Next.js dev server
Documentation:
cd docs
npm start # Runs Docusaurus
Code Style
TypeScript:
- Use strict mode
- Define types/interfaces for all data
- Avoid
anywhere possible
React:
- Functional components with hooks
- Keep components focused (single responsibility)
- Extract reusable logic to custom hooks
CSS:
- Use Tailwind utilities primarily
- Custom CSS for animations only
- Follow dark theme color scheme
Commit Messages
Follow conventional commits:
feat: add new workflow action type
fix: resolve token refresh issue
docs: update API reference
style: improve button animations
refactor: simplify workflow executor
test: add unit tests for MOM generator
Pull Request Process
1. Before Submitting
- Code compiles without errors
- All existing functionality works
- New code follows existing patterns
- Documentation updated if needed
2. PR Description Template
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How was this tested?
## Screenshots
If applicable, add screenshots
3. Review Process
- Create PR against
mainbranch - Request review from maintainers
- Address feedback
- Squash and merge when approved
Code Guidelines
Adding New Actions
- Define action type in
Workflow.ts:
export type WorkflowAction =
| 'generate_mom'
| 'send_email'
| 'your_new_action' // Add here
- Add to executor in
workflowExecutor.ts:
case 'your_new_action':
await this.executeYourAction(context)
actionsExecuted.push('your_new_action')
break
- Add to frontend in
ActionSidebar.tsx:
const availableActions = [
// ...existing actions
{
type: 'your_new_action',
label: 'Your Action',
icon: 'icon-name',
description: 'What it does'
}
]
-
Add configuration UI in execution page
-
Update documentation
Adding API Endpoints
- Create controller in
controllers/:
export const yourEndpoint = async (req: Request, res: Response) => {
try {
// Implementation
} catch (error) {
res.status(500).json({ error: 'Failed' })
}
}
- Create route in
routes/:
router.get('/your-endpoint', yourEndpoint)
- Register in
index.ts:
app.use('/your-path', yourRoutes)
- Add to frontend
api.ts:
export const yourApi = {
getData: () => api.get('/your-path')
}
Adding Components
// components/YourComponent.tsx
'use client'
import { useState } from 'react'
interface YourComponentProps {
prop1: string
onAction: () => void
}
export default function YourComponent({ prop1, onAction }: YourComponentProps) {
const [state, setState] = useState('')
return (
<div className="your-component">
{/* Implementation */}
</div>
)
}
Testing
Manual Testing Checklist
Before submitting, test:
- Login/logout flow
- Create workflow
- Execute workflow with all actions
- Check logs display
- Error handling (invalid input)
- Responsive design (mobile)
Future: Automated Testing
Planned testing setup:
- Jest for unit tests
- React Testing Library for components
- Supertest for API endpoints
Documentation
Updating Docs
- Edit files in
docs/docs/ - Preview locally:
npm start - Ensure links work
- Check formatting
Adding New Pages
- Create
.mdfile in appropriate folder - Add frontmatter:
---
sidebar_position: 1
---
- Update
sidebars.tsif needed
Getting Help
- Issues: Report bugs or request features
- Discussions: Ask questions or share ideas
- Pull Requests: Submit contributions
Recognition
Contributors will be:
- Listed in project README
- Credited in release notes
- Part of the ConsultFlow community!
First Contribution?
Look for issues labeled good first issue - they're great starting points!