First off, thank you for considering contributing to CodeSplain! It's people like you that make CodeSplain such a great tool.
This project and everyone participating in it is governed by respect and professionalism. Please be kind and courteous.
Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps to reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include screenshots if possible
- Include your environment details (OS, Node version, browser, etc.)
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain the behavior you expected to see
- Explain why this enhancement would be useful
- Fill in the required template
- Follow the coding style used throughout the project
- Include appropriate test cases if applicable
- Update documentation as needed
- End all files with a newline
- Fork the repo and create your branch from
main - Install dependencies:
cd codesplain && npm install cd ../server && npm install
- Create
.envfiles (see.env.example) - Make your changes
- Test your changes thoroughly
- Push to your fork and submit a pull request
- Use 4 spaces for indentation
- Use semicolons
- Use single quotes for strings
- Use arrow functions where appropriate
- Use async/await over promises
- Use destructuring when it improves readability
- Use functional components
- Use hooks appropriately
- Keep components small and focused
- Extract reusable logic into custom hooks
- Use proper prop types or TypeScript
- Use Tailwind utility classes
- Follow the dark mode pattern used in the project
- Keep styles consistent with existing components
codesplain/
├── codesplain/ # Frontend
│ ├── src/
│ │ ├── actions/ # Server actions
│ │ ├── components/ # React components
│ │ └── ...
│ └── ...
├── server/ # Backend
│ ├── server.js # Express server
│ └── ...
└── README.md
When creating new components:
- Create a new file in
src/components/ - Use functional components with hooks
- Handle loading and error states
- Support dark mode
- Make it responsive
- Add appropriate ARIA labels for accessibility
- Document complex logic with comments
When adding new endpoints:
- Add to
server/server.js - Follow RESTful conventions
- Validate input
- Handle errors appropriately
- Return consistent JSON responses
- Update documentation
Currently, we don't have automated tests, but please:
- Test your changes manually
- Test in both light and dark modes
- Test on different screen sizes
- Test error conditions
- Test with different programming languages
- Update README.md if you change functionality
- Update CHANGELOG.md with your changes
- Add JSDoc comments for complex functions
- Update API documentation if you add/change endpoints
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
- Consider starting the commit message with an emoji:
- 🎨
:art:- Improving structure/format of the code - ⚡
:zap:- Improving performance - 🐛
:bug:- Fixing a bug - ✨
:sparkles:- Adding a new feature - 📝
:memo:- Writing docs - 🔒
:lock:- Fixing security issues - ♻️
:recycle:- Refactoring code
- 🎨
To add support for a new programming language:
- Add to the language dropdown in
CodeExplainForm.jsx - Ensure Monaco Editor supports it (most common languages are supported)
- Test with example code
- Update documentation
Feel free to open an issue with your question or reach out to the maintainers.
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing! 🎉