|
| 1 | +# Contributing to GhostPaste |
| 2 | + |
| 3 | +Thank you for your interest in contributing to GhostPaste! We welcome contributions from the community. |
| 4 | + |
| 5 | +## 🚀 Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Node.js 20+ |
| 10 | +- npm 10+ |
| 11 | +- Git |
| 12 | +- A Cloudflare account (for R2 storage testing) |
| 13 | + |
| 14 | +### Local Development Setup |
| 15 | + |
| 16 | +1. **Clone the repository** |
| 17 | + |
| 18 | + ```bash |
| 19 | + git clone https://github.com/nullcoder/ghostpaste.git |
| 20 | + cd ghostpaste |
| 21 | + ``` |
| 22 | + |
| 23 | +2. **Install dependencies** |
| 24 | + |
| 25 | + ```bash |
| 26 | + npm install |
| 27 | + ``` |
| 28 | + |
| 29 | +3. **Set up environment variables** |
| 30 | + |
| 31 | + ```bash |
| 32 | + cp .env.example .env.local |
| 33 | + ``` |
| 34 | + |
| 35 | + Fill in your Cloudflare R2 credentials in `.env.local` |
| 36 | + |
| 37 | +4. **Run development server** |
| 38 | + ```bash |
| 39 | + npm run dev |
| 40 | + ``` |
| 41 | + |
| 42 | +For detailed local development instructions, see [docs/LOCAL_DEVELOPMENT.md](docs/LOCAL_DEVELOPMENT.md). |
| 43 | + |
| 44 | +## 📝 Development Workflow |
| 45 | + |
| 46 | +### 1. Create an Issue |
| 47 | + |
| 48 | +Before starting work: |
| 49 | + |
| 50 | +- Check existing issues to avoid duplicates |
| 51 | +- Create a new issue describing your proposed change |
| 52 | +- Wait for maintainer feedback/approval |
| 53 | + |
| 54 | +### 2. Create a Branch |
| 55 | + |
| 56 | +```bash |
| 57 | +git checkout main |
| 58 | +git pull origin main |
| 59 | +git checkout -b feat/your-feature-name |
| 60 | +``` |
| 61 | + |
| 62 | +Branch naming conventions: |
| 63 | + |
| 64 | +- `feat/` - New features |
| 65 | +- `fix/` - Bug fixes |
| 66 | +- `docs/` - Documentation changes |
| 67 | +- `refactor/` - Code refactoring |
| 68 | +- `test/` - Test additions/changes |
| 69 | +- `chore/` - Maintenance tasks |
| 70 | + |
| 71 | +### 3. Make Your Changes |
| 72 | + |
| 73 | +- Follow the existing code style |
| 74 | +- Add tests for new functionality |
| 75 | +- Update documentation as needed |
| 76 | +- Keep commits focused and atomic |
| 77 | + |
| 78 | +### 4. Run Tests and Linting |
| 79 | + |
| 80 | +Before committing: |
| 81 | + |
| 82 | +```bash |
| 83 | +npm run test # Run unit tests |
| 84 | +npm run lint # Run ESLint |
| 85 | +npm run typecheck # Run TypeScript checks |
| 86 | +``` |
| 87 | + |
| 88 | +### 5. Commit Your Changes |
| 89 | + |
| 90 | +We follow conventional commits: |
| 91 | + |
| 92 | +```bash |
| 93 | +git commit -m "feat: add encryption key rotation" |
| 94 | +git commit -m "fix: resolve PIN validation issue" |
| 95 | +git commit -m "docs: update API documentation" |
| 96 | +``` |
| 97 | + |
| 98 | +### 6. Push and Create PR |
| 99 | + |
| 100 | +```bash |
| 101 | +git push origin feat/your-feature-name |
| 102 | +``` |
| 103 | + |
| 104 | +Then create a pull request on GitHub with: |
| 105 | + |
| 106 | +- Clear description of changes |
| 107 | +- Reference to related issue(s) |
| 108 | +- Screenshots for UI changes |
| 109 | +- Test results |
| 110 | + |
| 111 | +## 🏗️ Code Guidelines |
| 112 | + |
| 113 | +### TypeScript |
| 114 | + |
| 115 | +- Use strict TypeScript settings |
| 116 | +- Define interfaces for all data structures |
| 117 | +- Avoid `any` types |
| 118 | +- Document complex types |
| 119 | + |
| 120 | +### React/Next.js |
| 121 | + |
| 122 | +- Use functional components with hooks |
| 123 | +- Follow Next.js 15 app router patterns |
| 124 | +- Keep components small and focused |
| 125 | +- Use shadcn/ui components when possible |
| 126 | + |
| 127 | +### Security |
| 128 | + |
| 129 | +- **NEVER** log encryption keys or sensitive data |
| 130 | +- **NEVER** send keys to the server |
| 131 | +- **ALWAYS** validate user input |
| 132 | +- **ALWAYS** use HTTPS in production |
| 133 | +- Follow zero-knowledge encryption principles |
| 134 | + |
| 135 | +### Edge Runtime Compatibility |
| 136 | + |
| 137 | +All code must be compatible with Cloudflare Workers: |
| 138 | + |
| 139 | +- No Node.js-specific APIs |
| 140 | +- Use Web APIs (fetch, crypto, etc.) |
| 141 | +- Keep bundle sizes small |
| 142 | +- Respect CPU time limits (50ms) |
| 143 | + |
| 144 | +## 🧪 Testing |
| 145 | + |
| 146 | +### Unit Tests |
| 147 | + |
| 148 | +- Write tests for all utility functions |
| 149 | +- Test error cases and edge conditions |
| 150 | +- Use Vitest for testing |
| 151 | +- Maintain >80% coverage for critical paths |
| 152 | + |
| 153 | +### Integration Tests |
| 154 | + |
| 155 | +- Test complete user flows |
| 156 | +- Verify encryption/decryption |
| 157 | +- Test API endpoints |
| 158 | +- Check error handling |
| 159 | + |
| 160 | +### Manual Testing |
| 161 | + |
| 162 | +Before submitting PR: |
| 163 | + |
| 164 | +- [ ] Create a new gist |
| 165 | +- [ ] View shared gist |
| 166 | +- [ ] Edit with PIN |
| 167 | +- [ ] Test expiry features |
| 168 | +- [ ] Verify mobile responsiveness |
| 169 | + |
| 170 | +## 📚 Documentation |
| 171 | + |
| 172 | +### Code Documentation |
| 173 | + |
| 174 | +- Add JSDoc comments for public APIs |
| 175 | +- Document complex algorithms |
| 176 | +- Include usage examples |
| 177 | +- Update README for new features |
| 178 | + |
| 179 | +### Project Documentation |
| 180 | + |
| 181 | +Update relevant docs: |
| 182 | + |
| 183 | +- `README.md` - Project overview |
| 184 | +- `docs/SPEC.md` - Technical specifications |
| 185 | +- `docs/TODO.md` - Mark completed tasks |
| 186 | +- `CLAUDE.md` - AI assistant guidelines |
| 187 | + |
| 188 | +## 🎯 Pull Request Process |
| 189 | + |
| 190 | +1. **PR Title**: Use conventional commit format |
| 191 | +2. **Description**: Explain what and why |
| 192 | +3. **Testing**: Describe how you tested |
| 193 | +4. **Screenshots**: Include for UI changes |
| 194 | +5. **Review**: Address feedback promptly |
| 195 | + |
| 196 | +### PR Checklist |
| 197 | + |
| 198 | +- [ ] Tests pass locally |
| 199 | +- [ ] Linting passes |
| 200 | +- [ ] TypeScript checks pass |
| 201 | +- [ ] Documentation updated |
| 202 | +- [ ] No console.logs left |
| 203 | +- [ ] No commented code |
| 204 | +- [ ] Follows security guidelines |
| 205 | + |
| 206 | +## 💡 Feature Requests |
| 207 | + |
| 208 | +We welcome feature suggestions! Please: |
| 209 | + |
| 210 | +- Open an issue with `[Feature Request]` prefix |
| 211 | +- Describe the use case |
| 212 | +- Explain expected behavior |
| 213 | +- Consider security implications |
| 214 | + |
| 215 | +## 🐛 Bug Reports |
| 216 | + |
| 217 | +When reporting bugs: |
| 218 | + |
| 219 | +- Use the bug report template |
| 220 | +- Include reproduction steps |
| 221 | +- Provide browser/OS information |
| 222 | +- Include error messages |
| 223 | +- Add screenshots if applicable |
| 224 | + |
| 225 | +## 🤝 Code of Conduct |
| 226 | + |
| 227 | +### Be Respectful |
| 228 | + |
| 229 | +- Treat everyone with respect |
| 230 | +- Welcome newcomers |
| 231 | +- Be patient with questions |
| 232 | +- Give constructive feedback |
| 233 | + |
| 234 | +### Be Professional |
| 235 | + |
| 236 | +- Stay on topic |
| 237 | +- Avoid offensive language |
| 238 | +- Respect differing opinions |
| 239 | +- Focus on what's best for the project |
| 240 | + |
| 241 | +## 📬 Communication |
| 242 | + |
| 243 | +- **Issues**: Bug reports and feature requests |
| 244 | +- **Discussions**: General questions and ideas |
| 245 | +- **Pull Requests**: Code contributions |
| 246 | + |
| 247 | +## 🏆 Recognition |
| 248 | + |
| 249 | +Contributors will be: |
| 250 | + |
| 251 | +- Listed in the README |
| 252 | +- Credited in release notes |
| 253 | +- Thanked in commit messages |
| 254 | + |
| 255 | +## ❓ Questions? |
| 256 | + |
| 257 | +If you have questions: |
| 258 | + |
| 259 | +1. Check existing documentation |
| 260 | +2. Search closed issues |
| 261 | +3. Ask in GitHub Discussions |
| 262 | +4. Tag @nullcoder for help |
| 263 | + |
| 264 | +--- |
| 265 | + |
| 266 | +Thank you for contributing to GhostPaste! 👻 |
0 commit comments