|
1 | 1 | # CONTRIBUTING.md
|
2 | 2 |
|
3 |
| -## How to Contribute |
4 |
| -We welcome contributions from the community! Follow these guidelines to ensure your contributions are well-received. |
| 3 | +Thank you for your interest in contributing to devb.io! This guide will help you understand how to contribute to both the frontend and backend components of our project. |
| 4 | + |
| 5 | +## 🌟 Project Overview |
| 6 | + |
| 7 | +devb.io is a platform that automatically generates professional developer portfolios from GitHub profiles, using AI to enhance professional representations. The project consists of: |
| 8 | + |
| 9 | +- **Frontend**: NextJS application (in the `/www` directory) |
| 10 | +- **Backend**: FastAPI application (in the `/api` directory) |
| 11 | +- **Caching**: Redis for performance optimization |
| 12 | + |
| 13 | +## 🚀 Getting Started |
| 14 | + |
| 15 | +### Prerequisites |
| 16 | + |
| 17 | +- Python 3.9+ |
| 18 | +- Node.js 18+ and npm/pnpm |
| 19 | +- Redis (for local development) |
| 20 | +- Git |
| 21 | + |
| 22 | +### Setting Up the Development Environment |
| 23 | + |
| 24 | +1. **Fork the Repository:** |
| 25 | + Click the Fork button on GitHub to create your own copy. |
5 | 26 |
|
6 |
| -### 🛠 Getting Started |
7 |
| -1. **Fork the Repository:** Click the Fork button on GitHub to create your own copy. |
8 | 27 | 2. **Clone Your Fork:**
|
9 | 28 | ```bash
|
10 | 29 | git clone https://github.com/your-username/devb.io.git
|
| 30 | + cd devb.io |
11 | 31 | ```
|
| 32 | + |
12 | 33 | 3. **Create a New Branch:**
|
13 | 34 | ```bash
|
14 | 35 | git checkout -b feature/your-feature-name
|
15 | 36 | ```
|
16 | 37 |
|
17 |
| -### 💾 Making Changes |
18 |
| -- Keep your code clean and follow the existing code style. |
19 |
| -- Write clear and concise commit messages. |
| 38 | +## 🔧 Backend Setup (FastAPI) |
| 39 | + |
| 40 | +1. **Install Python Dependencies:** |
| 41 | + ```bash |
| 42 | + pip install -r requirements.txt |
| 43 | + ``` |
| 44 | + |
| 45 | +2. **Environment Variables:** |
| 46 | + - Copy the example environment file and modify as needed |
| 47 | + - Required variables include API keys and configuration settings |
| 48 | + |
| 49 | +3. **Run the Backend Server:** |
| 50 | + ```bash |
| 51 | + uvicorn api.main:app --reload --port 8000 |
| 52 | + ``` |
| 53 | + |
| 54 | +4. **Access the API Documentation:** |
| 55 | + - Swagger UI: http://localhost:8000/docs |
| 56 | + - ReDoc: http://localhost:8000/redoc |
| 57 | + |
| 58 | +### Backend Development Guidelines |
| 59 | + |
| 60 | +1. **Code Structure:** |
| 61 | + - Place new API endpoints in the appropriate modules |
| 62 | + - Follow the existing pattern for route definitions |
| 63 | + - Use dependency injection for shared resources |
| 64 | + |
| 65 | +2. **Error Handling:** |
| 66 | + - Use FastAPI's HTTPException for API errors |
| 67 | + - Include descriptive error messages |
| 68 | + - Implement proper status codes |
| 69 | + |
| 70 | +3. **Testing:** |
| 71 | + - Write tests using pytest |
| 72 | + - Run tests with `pytest` command |
| 73 | + - Ensure test coverage for new features |
| 74 | + |
| 75 | +4. **Performance Considerations:** |
| 76 | + - Use caching where appropriate |
| 77 | + - Implement async functions for I/O bound operations |
| 78 | + - Consider rate limiting for external API calls |
| 79 | + |
| 80 | +## 💻 Frontend Setup (NextJS) |
| 81 | + |
| 82 | +1. **Install Node Dependencies:** |
| 83 | + ```bash |
| 84 | + cd www |
| 85 | + pnpm install |
| 86 | + ``` |
| 87 | + |
| 88 | +2. **Environment Variables:** |
| 89 | + - Copy `www/example.env` to `www/.env.local` |
| 90 | + - Update the API endpoint and other required variables |
| 91 | + |
| 92 | +3. **Run the Development Server:** |
| 93 | + ```bash |
| 94 | + pnpm dev |
| 95 | + ``` |
| 96 | + |
| 97 | +4. **Access the Frontend:** |
| 98 | + - Open http://localhost:3000 in your browser |
| 99 | + |
| 100 | +### Frontend Development Guidelines |
| 101 | + |
| 102 | +1. **Code Structure:** |
| 103 | + - Follow the Next.js app router structure |
| 104 | + - Place components in the appropriate directories |
| 105 | + - Use client and server components appropriately |
| 106 | + |
| 107 | +2. **Styling:** |
| 108 | + - Use Tailwind CSS for styling |
| 109 | + - Follow the existing design system |
| 110 | + - Ensure responsive design |
| 111 | + |
| 112 | +3. **State Management:** |
| 113 | + - Use Zustand for client state management (Only if necessary) |
| 114 | + - Follow existing patterns for data fetching |
| 115 | + |
| 116 | +4. **Error Handling:** |
| 117 | + - Implement proper error boundaries |
| 118 | + - Use the retry mechanism for API calls (especially for LinkedIn data) |
| 119 | + - Display user-friendly error messages |
| 120 | + |
| 121 | +5. **Performance:** |
| 122 | + - Optimize images and assets |
| 123 | + - Use proper loading states and skeletons |
| 124 | + - Implement proper caching strategies |
| 125 | + |
| 126 | +## 🧪 Testing |
| 127 | + |
| 128 | +### Backend Testing |
| 129 | + |
| 130 | +```bash |
| 131 | +# Run all tests |
| 132 | +pytest |
| 133 | + |
| 134 | +# Run with coverage report |
| 135 | +pytest --cov=api |
| 136 | +``` |
| 137 | + |
| 138 | +### Frontend Testing |
| 139 | + |
| 140 | +```bash |
| 141 | +# Run linting |
| 142 | +cd www |
| 143 | +pnpm lint |
| 144 | +``` |
| 145 | + |
| 146 | +## 📝 Making Changes |
| 147 | + |
| 148 | +- Keep your code clean and follow the existing code style |
| 149 | +- Write clear and concise commit messages |
| 150 | +- Follow the conventional commit format: `type(scope): message` |
| 151 | +- Types include: feat, fix, docs, style, refactor, test, chore |
| 152 | + |
| 153 | +## 🔄 Pull Request Process |
| 154 | + |
| 155 | +1. **Update Documentation:** |
| 156 | + - Update the README.md if needed |
| 157 | + - Add comments to your code |
| 158 | + - Update API documentation if applicable |
| 159 | + |
| 160 | +2. **Test Your Changes:** |
| 161 | + - Ensure all tests pass |
| 162 | + - Add new tests for new features |
| 163 | + - Verify your changes work as expected |
| 164 | + |
| 165 | +3. **Create a Pull Request:** |
| 166 | + - Use the PR template provided |
| 167 | + - Link to any related issues |
| 168 | + - Provide a clear description of your changes |
| 169 | + |
| 170 | +4. **Code Review:** |
| 171 | + - Address reviewer comments |
| 172 | + - Make requested changes |
| 173 | + - Respond to feedback constructively |
20 | 174 |
|
21 | 175 | ### ✅ Pull Request Template
|
| 176 | + |
22 | 177 | When submitting a Pull Request, please follow this template:
|
23 | 178 |
|
24 | 179 | ```markdown
|
@@ -46,15 +201,34 @@ When submitting a Pull Request, please follow this template:
|
46 | 201 |
|
47 | 202 | ## Checklist
|
48 | 203 | <!--- Ensure the following points are checked -->
|
49 |
| -- [ ] My code follows the project’s code style. |
| 204 | +- [ ] My code follows the project's code style. |
50 | 205 | - [ ] I have updated the documentation as needed.
|
| 206 | +- [ ] I have added tests to cover my changes. |
| 207 | +- [ ] All new and existing tests passed. |
| 208 | +- [ ] My changes generate no new warnings. |
51 | 209 | ```
|
52 | 210 |
|
53 |
| -### 🤝 Code of Conduct |
54 |
| -- Be respectful and inclusive. |
55 |
| -- Provide constructive feedback. |
| 211 | +## 🤝 Code of Conduct |
| 212 | + |
| 213 | +- Be respectful and inclusive |
| 214 | +- Provide constructive feedback |
| 215 | +- Follow the golden rule: treat others as you would like to be treated |
| 216 | + |
| 217 | +## 🔍 Code Review Guidelines |
| 218 | + |
| 219 | +When reviewing code, please: |
| 220 | + |
| 221 | +1. Be respectful and constructive |
| 222 | +2. Focus on the code, not the person |
| 223 | +3. Explain your reasoning |
| 224 | +4. Suggest improvements, not just point out issues |
| 225 | +5. Approve PRs that meet the requirements |
| 226 | + |
| 227 | +## 💡 Need Help? |
56 | 228 |
|
57 |
| -### 💡 Need Help? |
58 |
| -If you have any questions, feel free to open an issue or reach out via [[email protected]](mailto:[email protected]). |
| 229 | +If you have any questions, feel free to: |
| 230 | +- Open an issue on GitHub |
| 231 | +- Join our [Discord community](https://discord.gg/W364NEY6) |
| 232 | + |
59 | 233 |
|
60 | 234 | Happy contributing! 🎉
|
0 commit comments