1- # Contributing to SafeExec
1+ # 🤝 Contributing to SafeExec
22
3- We love your input! We want to make contributing to SafeExec as easy and transparent as possible, whether it's:
3+ Thank you for your interest in contributing to SafeExec! We welcome contributions from developers of all skill levels.
44
5- - Reporting a bug
6- - Discussing the current state of the code
7- - Submitting a fix
8- - Proposing new features
9- - Becoming a maintainer
5+ ## 🚀 Quick Contributor Setup
106
11- ## Development Process
12-
13- We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
14-
15- ## Getting Started
7+ > ** Follow the README.md setup first!**
8+ >
9+ > Make sure you've completed the [ Contributor Quick Setup] ( ../README.md#-contributor-quick-setup ) section in the main README before proceeding.
1610
1711### Prerequisites
1812
19- - Node.js 18+ and Yarn
20- - Docker and Docker Compose
21- - Git
22-
23- ### Setup
24-
25- 1 . ** Fork and clone the repository**
26-
27- ``` bash
28- git clone https://github.com/YOUR_USERNAME/SafeExec.git
29- cd SafeExec
30-
31- # Add upstream remote for syncing
32- git remote add upstream https://github.com/vikashkrdeveloper/SafeExec.git
33- ```
34-
35- 2 . ** Environment Setup (REQUIRED FIRST STEP)**
36-
37- ``` bash
38- # Copy environment template - MUST DO THIS FIRST
39- cp .env.example .env
40-
41- # Edit the .env file with your local configuration
42- nano .env # or use your preferred editor
43- ```
44-
45- 3 . ** Quick Development Setup**
46-
47- ``` bash
48- # Complete development setup in one command
49- yarn setup:dev
50-
51- # This will install dependencies, build executors,
52- # start Docker environment, and seed database
53- ```
13+ - ** Node.js 18+** and ** Yarn** package manager
14+ - ** Docker & Docker Compose** (latest versions)
15+ - ** Git** for version control
5416
55- 4 . ** Manual Setup (Alternative) **
17+ ### 1. Fork & Clone
5618
57- ``` bash
58- # Install dependencies and build executors
59- yarn setup
60-
61- # Start development environment
62- yarn docker:setup:dev
63- ```
64-
65- ``` bash
66- # Using the unified approach
67- ENV=development yarn docker:dev
68-
69- # Or step by step
70- yarn build:executors
71- yarn docker:dev:build
72- yarn docker:dev
73- yarn seed
74- ```
75-
76- 5 . ** Access API Documentation**
77- - Visit < http://localhost:5000/api-docs > for interactive API docs
78-
79- ## Environment Management
19+ ``` bash
20+ # Fork the repository on GitHub first, then:
21+ git clone https://github.com/YOUR_USERNAME/SafeExec.git
22+ cd SafeExec
8023
81- This project uses a unified Docker setup controlled by the ` ENV ` variable:
24+ # Add upstream remote for syncing
25+ git remote add upstream https://github.com/vikashkrdeveloper/SafeExec.git
26+ ```
8227
83- ### Development
28+ ### 2. Environment Setup (REQUIRED FIRST)
8429
8530``` bash
86- ENV=development yarn docker:dev # Start dev environment
87- ENV=development yarn docker:dev:logs # View logs
88- ENV=development yarn docker:dev:down # Stop services
31+ # Copy environment template - MUST DO THIS FIRST
32+ cp .env.example .env
33+
34+ # Edit with your local configuration
35+ nano .env
8936```
9037
91- ### Testing
38+ ### 3. Quick Setup
9239
9340``` bash
94- ENV=test yarn docker:test # Start test environment
95- ENV=test yarn docker:test:run # Run tests in container
96- ENV=test yarn docker:test:coverage # Generate coverage
41+ # Complete development setup in one command
42+ yarn setup:dev
9743```
9844
99- ### Production
45+ ### 4. Verify Setup
10046
10147``` bash
102- ENV=production yarn docker:prod # Start prod environment
103- ENV=production yarn docker:prod:logs # View logs
104- ```
48+ # Check API health
49+ yarn health
10550
106- ## Pull Requests
51+ # View logs
52+ yarn logs
10753
108- 1 . Fork the repository and create your branch from ` master ` .
109- 2 . If you've added code that should be tested, add tests.
110- 3 . If you've changed APIs, update the Swagger documentation.
111- 4 . Ensure the test suite passes.
112- 5 . Make sure your code lints and formats correctly.
113- 6 . Issue that pull request!
114-
115- ## Code Style
54+ # Access API docs
55+ # Visit http://localhost:5000/api-docs
56+ ```
11657
117- ### Use Yarn for Package Management
58+ ## 📋 Development Workflow
11859
119- This project uses Yarn as the package manager. Always use Yarn commands:
60+ ### Daily Development
12061
12162``` bash
122- yarn install # Not npm install
123- yarn add package # Not npm install package
124- yarn remove package # Not npm uninstall package
125- ```
63+ # 1. Sync with upstream
64+ git checkout master
65+ git pull upstream master
66+ git push origin master
12667
127- ### TypeScript Guidelines
68+ # 2. Create feature branch
69+ git checkout -b feature/your-feature-name
12870
129- - Use TypeScript for all new code
130- - Prefer interfaces over types for object shapes
131- - Use proper typing - avoid ` any `
132- - Export interfaces from dedicated files in ` src/interfaces/ `
71+ # 3. Start development environment
72+ yarn setup:dev
73+ # Or if already set up: yarn docker:dev
13374
134- ### Code Formatting
75+ # 4. Make your changes...
13576
136- We use Prettier and ESLint:
77+ # 5. Run tests and checks
78+ yarn test
79+ yarn lint
80+ yarn typecheck
13781
138- ``` bash
139- yarn lint # Check for linting errors
140- yarn lint:fix # Fix auto-fixable errors
141- yarn format # Format code with Prettier
142- yarn typecheck # TypeScript type checking
143- ```
82+ # 6. Commit and push
83+ git add .
84+ git commit -m " feat: your descriptive commit message"
85+ git push origin feature/your-feature-name
14486
145- ## Testing Guidelines
87+ # 7. Create Pull Request on GitHub
88+ ```
14689
147- ### Running Tests
90+ ## 🧪 Testing
14891
14992``` bash
150- yarn test # Run all tests
151- yarn test:watch # Run tests in watch mode
152- yarn test:coverage # Generate coverage report
153- yarn test:integration # Run integration tests only
154-
155- # Or in Docker
156- ENV=test yarn docker:test:run # Run tests in container
157- ENV=test yarn docker:test:coverage # Generate coverage in container
158- ```
93+ # Run all tests
94+ yarn test
15995
160- ### Writing Tests
96+ # Run tests with coverage
97+ yarn test:coverage
16198
162- - Write unit tests for all new functions and methods
163- - Add integration tests for new API endpoints
164- - Use descriptive test names
165- - Aim for >80% code coverage
166- - Mock external dependencies
99+ # Run integration tests
100+ yarn test:integration
167101
168- ## Docker Development
102+ # Test Docker containers
103+ yarn docker:test:run # Run tests in test environment
104+ yarn docker:test:coverage # Generate coverage report
105+ ```
169106
170- ### Unified Docker Setup
107+ ## 🎨 Code Style
171108
172- The project now uses a single ` docker-compose.yml ` file controlled by environment variables:
109+ ### Formatting & Linting
173110
174111``` bash
175- # Development
176- ENV=development docker compose up -d
177-
178- # Testing
179- ENV=test docker compose up -d
180-
181- # Production
182- ENV=production docker compose up -d
112+ yarn lint # Check code style
113+ yarn lint:fix # Fix auto-fixable errors
114+ yarn format # Format code with Prettier
115+ yarn typecheck # TypeScript type checking
183116```
184117
185- ### Environment Configuration
186-
187- Environment-specific configurations are in ` config/environments/ ` :
188-
189- - ` development.env ` - Development settings
190- - ` test.env ` - Testing settings
191- - ` production.env ` - Production settings
192-
193- ### Adding New Language Support
118+ ### Guidelines
194119
195- 1 . Create ` docker/executors/Dockerfile.{language} `
196- 2 . Update ` scripts/build-executors.sh `
197- 3 . Add language validation in validators
198- 4 . Update Swagger documentation
199- 5 . Add tests for the new language
120+ - Use TypeScript for all new code
121+ - Follow existing naming conventions
122+ - Add JSDoc comments for public functions
123+ - Write tests for new features
124+ - Keep functions small and focused
200125
201- ## Security
126+ ## 🔐 Security Guidelines
202127
203128- Never commit sensitive data (passwords, keys, tokens)
204129- Validate all inputs using express-validator
205130- Use proper authentication for protected endpoints
206- - Implement rate limiting for public APIs
131+ - Test container isolation
207132- Sanitize error messages
208133
209- ## Performance
210-
211- - Use proper database indexes
212- - Leverage Redis for caching
213- - Set appropriate Docker resource limits
214- - Use BullMQ for background processing
215-
216- ## Bug Reports
134+ ## 🐛 Bug Reports
217135
218136Great bug reports include:
219137
@@ -223,10 +141,21 @@ Great bug reports include:
223141- System information (OS, Node.js version, etc.)
224142- Error logs and stack traces
225143
226- ## Questions?
144+ ## 💡 Pull Request Guidelines
145+
146+ 1 . Fork the repository and create your branch from ` master `
147+ 2 . Add tests for new code
148+ 3 . Update API documentation if needed
149+ 4 . Ensure tests pass: ` yarn test `
150+ 5 . Check code style: ` yarn lint `
151+ 6 . Create a clear PR description
152+
153+ ## 🆘 Questions?
227154
228- Feel free to open an issue if you have questions about contributing!
155+ - Check the [ README.md] ( ../README.md ) for setup help
156+ - Look at existing [ GitHub Issues] ( https://github.com/vikashkrdeveloper/SafeExec/issues )
157+ - Create a new issue for questions
229158
230- ## License
159+ ## 📄 License
231160
232- By contributing, you agree that your contributions will be licensed under its MIT License.
161+ By contributing, you agree that your contributions will be licensed under the MIT License.
0 commit comments