|
| 1 | +# Contributing to CodeBrewery |
| 2 | + |
| 3 | +Thank you for considering contributing to **CodeBrewery**! Whether it's reporting a bug, proposing new features, or submitting code changes, your input is highly valuable and appreciated. |
| 4 | + |
| 5 | +This document provides guidelines on how to contribute effectively to the project. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Table of Contents |
| 10 | +- [Code of Conduct](#code-of-conduct) |
| 11 | +- [Getting Started](#getting-started) |
| 12 | + - [Project Structure](#project-structure) |
| 13 | + - [Prerequisites](#prerequisites) |
| 14 | +- [Setting Up the Project](#setting-up-the-project) |
| 15 | +- [Contribution Workflow](#contribution-workflow) |
| 16 | + - [Reporting Bugs](#reporting-bugs) |
| 17 | + - [Suggesting Features](#suggesting-features) |
| 18 | + - [Code Contributions](#code-contributions) |
| 19 | + - [Style Guide](#style-guide) |
| 20 | + - [Testing](#testing) |
| 21 | +- [Commit and PR Guidelines](#commit-and-pr-guidelines) |
| 22 | +- [Code Review Process](#code-review-process) |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Code of Conduct |
| 27 | + |
| 28 | +By participating in this project, you agree to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md) to maintain a positive and inclusive environment for all contributors. |
| 29 | + |
| 30 | +## Getting Started |
| 31 | + |
| 32 | +### Project Structure |
| 33 | +CodeBrewery follows a **microservices architecture**. Here's the high-level directory structure: |
| 34 | + |
| 35 | +``` |
| 36 | +codebrewery/ |
| 37 | + frontend/ # Frontend React app (TypeScript, Vite) |
| 38 | + backend/ |
| 39 | + api-gateway/ # Central entry point for services |
| 40 | + user-service/ # User-related operations |
| 41 | + code-execution-service/ # Code execution engine |
| 42 | + k8s/ # Kubernetes manifests |
| 43 | + docker/ # Docker configuration files |
| 44 | +``` |
| 45 | + |
| 46 | +### Prerequisites |
| 47 | +Ensure you have the following tools installed: |
| 48 | + |
| 49 | +- **Node.js (v18+)** and **npm** |
| 50 | +- **Go (v1.21+)** |
| 51 | +- **Docker** and **Docker Compose** |
| 52 | +- **Kubernetes (Minikube or any cluster provider)** |
| 53 | +- **Git** |
| 54 | + |
| 55 | +> Install dependencies for the frontend/backend as specified in their respective `package.json` or `go.mod` files. |
| 56 | +
|
| 57 | +--- |
| 58 | + |
| 59 | +## Setting Up the Project |
| 60 | + |
| 61 | +1. **Clone the repository:** |
| 62 | + ```bash |
| 63 | + git clone https://github.com/your-username/codebrewery.git |
| 64 | + cd codebrewery |
| 65 | + ``` |
| 66 | + |
| 67 | +2. **Setup Frontend:** |
| 68 | + ```bash |
| 69 | + cd frontend |
| 70 | + npm install |
| 71 | + npm run dev |
| 72 | + ``` |
| 73 | + |
| 74 | +3. **Setup Backend Services:** |
| 75 | + Each service has its own `go.mod` file and `Dockerfile`. Start the services using Docker Compose: |
| 76 | + ```bash |
| 77 | + cd backend |
| 78 | + docker-compose up --build |
| 79 | + ``` |
| 80 | + |
| 81 | +4. **Verify setup:** |
| 82 | + Access the frontend at `http://localhost:5173` and confirm all backend APIs are running. |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## Contribution Workflow |
| 87 | + |
| 88 | +### Reporting Bugs |
| 89 | + |
| 90 | +1. Check if the issue already exists in the [GitHub Issues](https://github.com/your-username/codebrewery/issues). |
| 91 | +2. If not, open a new issue with: |
| 92 | + - Clear title |
| 93 | + - Steps to reproduce |
| 94 | + - Expected behavior |
| 95 | + - Screenshots/logs if applicable |
| 96 | + |
| 97 | +### Suggesting Features |
| 98 | + |
| 99 | +- Propose a feature by opening an issue under the "Feature Request" template. |
| 100 | +- Clearly describe the use case, benefits, and possible implementation approach. |
| 101 | + |
| 102 | +### Code Contributions |
| 103 | + |
| 104 | +#### Style Guide |
| 105 | +- **Backend:** Follow standard Go best practices. |
| 106 | +- **Frontend:** Follow the Prettier and ESLint rules configured in the project. |
| 107 | + |
| 108 | +Run formatters before submitting changes: |
| 109 | +```bash |
| 110 | +# For Go code |
| 111 | +go fmt ./... |
| 112 | + |
| 113 | +# For frontend |
| 114 | +npm run lint --fix |
| 115 | +``` |
| 116 | + |
| 117 | +#### Testing |
| 118 | +- Write unit tests for new features or fixes. |
| 119 | +- Run tests locally: |
| 120 | + ```bash |
| 121 | + # Frontend |
| 122 | + npm run test |
| 123 | + |
| 124 | + # Backend (Go tests) |
| 125 | + go test ./... |
| 126 | + ``` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Commit and PR Guidelines |
| 131 | + |
| 132 | +1. **Commit Messages:** |
| 133 | + - Use concise, descriptive commits. |
| 134 | + - Follow conventional commit format: |
| 135 | + ``` |
| 136 | + <type>: <subject> |
| 137 | + ``` |
| 138 | + - `feat:` for new features |
| 139 | + - `fix:` for bug fixes |
| 140 | + - `docs:` for documentation changes |
| 141 | + - `chore:` for refactors, cleanups, etc. |
| 142 | +
|
| 143 | + Example: |
| 144 | + ``` |
| 145 | + feat: add user authentication in user-service |
| 146 | + ``` |
| 147 | +
|
| 148 | +2. **Pull Requests:** |
| 149 | + - Fork the repository and work on a new branch. |
| 150 | + ```bash |
| 151 | + git checkout -b feature/your-feature-name |
| 152 | + ``` |
| 153 | + - Ensure the code is tested and linted. |
| 154 | + - Provide a clear PR description: |
| 155 | + - **What:** Describe the changes. |
| 156 | + - **Why:** Reason for the change. |
| 157 | + - **How:** Implementation details. |
| 158 | + - Link related issues. |
| 159 | +
|
| 160 | +3. **Small, Focused Changes:** |
| 161 | + - PRs should be focused on solving one problem at a time. |
| 162 | +
|
| 163 | +--- |
| 164 | +
|
| 165 | +## Code Review Process |
| 166 | +
|
| 167 | +- Once you submit a PR, the maintainers will review it. |
| 168 | +- Address feedback promptly. |
| 169 | +- Be respectful during code reviews — they are here to ensure quality and growth. |
| 170 | +
|
| 171 | +--- |
| 172 | +
|
| 173 | +## Questions or Help? |
| 174 | +
|
| 175 | +Feel free to join the discussion on GitHub Issues or contact maintainers. |
| 176 | +
|
| 177 | +Let's build CodeBrewery together! 🚀 |
| 178 | +
|
0 commit comments