|
| 1 | +# Contributing to CommentKit |
| 2 | + |
| 3 | +Thank you for your interest in contributing to CommentKit! We welcome contributions from the community and are grateful for your support. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Contributing to CommentKit](#contributing-to-commentkit) |
| 8 | + - [Table of Contents](#table-of-contents) |
| 9 | + - [Code of Conduct](#code-of-conduct) |
| 10 | + - [How Can I Contribute?](#how-can-i-contribute) |
| 11 | + - [Reporting Bugs](#reporting-bugs) |
| 12 | + - [Suggesting Features](#suggesting-features) |
| 13 | + - [Submitting Pull Requests](#submitting-pull-requests) |
| 14 | + - [Development Setup](#development-setup) |
| 15 | + - [Prerequisites](#prerequisites) |
| 16 | + - [Initial Setup](#initial-setup) |
| 17 | + - [Running the backend](#running-the-backend) |
| 18 | + - [Running the frontend](#running-the-frontend) |
| 19 | + - [Testing the Widget](#testing-the-widget) |
| 20 | + - [Testing](#testing) |
| 21 | + - [Getting Help](#getting-help) |
| 22 | + - [License](#license) |
| 23 | + |
| 24 | +## Code of Conduct |
| 25 | + |
| 26 | +This project and everyone participating in it is expected to uphold a standard of respect and professionalism. Please be kind and courteous to others. |
| 27 | + |
| 28 | +## How Can I Contribute? |
| 29 | + |
| 30 | +### Reporting Bugs |
| 31 | + |
| 32 | +Bug reports help make CommentKit better for everyone. When filing a bug report, please include: |
| 33 | + |
| 34 | +- **Clear title and description** - Explain the problem clearly |
| 35 | +- **Steps to reproduce** - Provide specific steps to reproduce the issue |
| 36 | +- **Expected behavior** - What you expected to happen |
| 37 | +- **Actual behavior** - What actually happened |
| 38 | +- **Screenshots** - If applicable, add screenshots to help explain the problem |
| 39 | +- **Environment** - Browser version, OS, etc. |
| 40 | + |
| 41 | +[Create a bug report](https://github.com/ankushKun/commentkit/issues/new) |
| 42 | + |
| 43 | +### Suggesting Features |
| 44 | + |
| 45 | +We love to hear ideas for new features! When suggesting a feature: |
| 46 | + |
| 47 | +- **Use a clear title** - Describe the feature concisely |
| 48 | +- **Provide detailed description** - Explain why this feature would be useful |
| 49 | +- **Include examples** - Show how the feature would work |
| 50 | +- **Consider alternatives** - Mention any alternative solutions you've considered |
| 51 | + |
| 52 | +[Request a feature](https://github.com/ankushKun/commentkit/issues/new) |
| 53 | + |
| 54 | +### Submitting Pull Requests |
| 55 | + |
| 56 | +We actively welcome your pull requests! Here's how to submit one: |
| 57 | + |
| 58 | +1. **Fork the repository** and create your branch from `main` |
| 59 | +2. **Make your changes** following our coding guidelines |
| 60 | +3. **Test your changes** thoroughly |
| 61 | +4. **Update documentation** if needed |
| 62 | +5. **Submit a pull request** with a clear description of your changes |
| 63 | + |
| 64 | +## Development Setup |
| 65 | + |
| 66 | +### Prerequisites |
| 67 | + |
| 68 | +- **Bun** 1.0 or higher ([install Bun](https://bun.sh)) |
| 69 | +- **Cloudflare account** (for deployment) |
| 70 | + |
| 71 | +### Initial Setup |
| 72 | + |
| 73 | +1. **Clone the repository** |
| 74 | + ```bash |
| 75 | + git clone https://github.com/ankushKun/commentkit.git |
| 76 | + cd commentkit |
| 77 | + ``` |
| 78 | + |
| 79 | +2. **Install dependencies for frontend** |
| 80 | + ```bash |
| 81 | + cd frontend |
| 82 | + bun install |
| 83 | + ``` |
| 84 | + |
| 85 | +3. **Install dependencies for worker** |
| 86 | + ```bash |
| 87 | + cd ../worker |
| 88 | + bun install |
| 89 | + ``` |
| 90 | + |
| 91 | +### Running the backend |
| 92 | + |
| 93 | +1. **Start the worker** |
| 94 | + ```bash |
| 95 | + cd worker |
| 96 | + bun run dev |
| 97 | + ``` |
| 98 | + |
| 99 | + This will create the required D1 db as well |
| 100 | + |
| 101 | +2. **Setup DB** |
| 102 | + |
| 103 | + run migrations |
| 104 | + ```bash |
| 105 | + bun run db:migrate:local |
| 106 | + ``` |
| 107 | + |
| 108 | +3. **(Optional) Configure email for development** |
| 109 | + |
| 110 | + If you want to test email functionality locally, create an env file and add a RESEND api key |
| 111 | + ```bash |
| 112 | + touch .env |
| 113 | + echo "RESEND_API_KEY=your_api_key" >> .env |
| 114 | + ``` |
| 115 | + |
| 116 | +4. **Start the development server** |
| 117 | + ```bash |
| 118 | + bun run dev |
| 119 | + ``` |
| 120 | + |
| 121 | + The API will be available at `http://localhost:8787` |
| 122 | + |
| 123 | +### Running the frontend |
| 124 | + |
| 125 | +1. **Navigate to frontend directory** |
| 126 | + ```bash |
| 127 | + cd frontend |
| 128 | + ``` |
| 129 | + |
| 130 | +2. **Start the development server** |
| 131 | + ```bash |
| 132 | + bun dev |
| 133 | + ``` |
| 134 | + |
| 135 | + The frontend will be available at `http://localhost:3000` |
| 136 | + |
| 137 | + You can access: |
| 138 | + - Dashboard: `http://localhost:3000` |
| 139 | + - Widget test page: `http://localhost:3000/widget` |
| 140 | + - Bundle script: `http://localhost:3000/bundle.js` |
| 141 | + |
| 142 | +### Testing the Widget |
| 143 | + |
| 144 | +To test the embeddable widget locally: |
| 145 | + |
| 146 | +1. **Ensure both servers are running** |
| 147 | + - Frontend: `http://localhost:3000` (serves the widget and bundle) |
| 148 | + - Worker: `http://localhost:8787` (API backend) |
| 149 | + |
| 150 | +2. **Use the built-in test page** |
| 151 | + |
| 152 | + The easiest way is to use the example html already available in the frontend public directory |
| 153 | + ``` |
| 154 | + http://localhost:3000/example.html |
| 155 | + ``` |
| 156 | + |
| 157 | +3. **Or create a custom test HTML file** (e.g., `test.html`) |
| 158 | + ```html |
| 159 | + <!DOCTYPE html> |
| 160 | + <html> |
| 161 | + <head> |
| 162 | + <title>CommentKit Test</title> |
| 163 | + <!-- Load the bundle --> |
| 164 | + <script src="http://localhost:3000/bundle.js"></script> |
| 165 | + </head> |
| 166 | + <body> |
| 167 | + <h1>Test Page</h1> |
| 168 | + <!-- Add the comments widget --> |
| 169 | + <div data-commentkit></div> |
| 170 | + |
| 171 | + </body> |
| 172 | + </html> |
| 173 | + ``` |
| 174 | + |
| 175 | + Open the file in your browser to test the widget with the local API. |
| 176 | + |
| 177 | + |
| 178 | +## Testing |
| 179 | + |
| 180 | +Before submitting a pull request: |
| 181 | + |
| 182 | +1. **Test all functionality** - Ensure your changes work as expected |
| 183 | +2. **Test edge cases** - Think about what could go wrong |
| 184 | +3. **Test across browsers** - If making frontend changes |
| 185 | +4. **Check console** - No errors or warnings |
| 186 | +5. **Test mobile** - Ensure responsive design works |
| 187 | + |
| 188 | +## Getting Help |
| 189 | + |
| 190 | +If you need help with contributing: |
| 191 | + |
| 192 | +- **Open a discussion** on GitHub |
| 193 | +- **Ask in issues** - Tag your question appropriately |
| 194 | +- **Email us** at [commentkit@ankush.one](mailto:commentkit@ankush.one) |
| 195 | +- **Discord** - Contact @ankushkun |
| 196 | + |
| 197 | +It is recommended to use public channels for questions and discussions. |
| 198 | + |
| 199 | +## License |
| 200 | + |
| 201 | +By contributing to CommentKit, you agree that your contributions will be licensed under the [GNU General Public License v3.0](LICENSE). |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +Thank you for contributing to CommentKit! 🎉 |
0 commit comments