diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b92bd2a1..c5ec2bad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,14 +21,16 @@ This project is in its early stage — so **you’re welcome to help build it fr ```bash git checkout -b my-feature ``` -4. **Start coding!** Edit files, add features, fix bugs. -5. **Commit and push** +4. **Set up your development environment** (see [README.md](README.md#-getting-started-development)) +5. **Start coding!** Edit files, add features, fix bugs. +6. **Test your changes** (see section below) +7. **Commit and push** ```bash git commit -m "Add: my feature" git push origin my-feature ``` -6. **Open a Pull Request** on the main repository. Your PR must target the `master` branch! +8. **Open a Pull Request** on the main repository. Your PR must target the `master` branch! --- @@ -48,6 +50,58 @@ We’ll also add `good first issue` and `help wanted` labels as the project evol --- +### 🧪 Testing Your Changes + +Before submitting a pull request, make sure to test your changes locally: + +#### 1. Frontend Testing + +**Run the development server:** +```bash +npm run dev +``` +- Manually test your feature in the browser at `http://localhost:5173` +- Check that your changes work across different screen sizes (responsive design) +- Open DevTools (F12) and check for console errors or warnings + +**Run linting and formatting checks:** +```bash +npm run lint # Check code quality +npm run lint:fix # Automatically fix issues +npm run format:check # Check if files are formatted correctly +npm run format # Format all files +``` + +**Build for production (optional but recommended):** +```bash +npm run build +npm run preview # Preview the production build +``` + +#### 2. Backend Testing + +**Make sure the backend is running:** +```bash +cd backup_existing_project/backend +source venv/bin/activate # or venv\Scripts\activate on Windows +python3 run.py +``` + +**Test your API changes:** +- Use tools like [Postman](https://www.postman.com/) or [curl](https://curl.se/) to test API endpoints +- Check that error handling works correctly +- Test with invalid inputs to ensure proper validation + +#### 3. Before Committing + +- Ensure no console errors in browser DevTools +- Ensure linting passes (`npm run lint` shows no errors) +- Ensure formatting is correct (`npm run format:check` passes) +- Test on both desktop and mobile browsers if possible +- Write clear, descriptive commit messages + +--- + ### 📚 Guidelines * Keep code clean and readable diff --git a/README.md b/README.md index 649db043..88034610 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,16 @@ notesvault/ ### Prerequisites -- **Node.js 20+** (for frontend) -- **Python 3.x** (for backend) -- **npm 10+** +- **Node.js 20+** (for frontend) - [Download](https://nodejs.org/) +- **Python 3.8+** (for backend) - [Download](https://www.python.org/) +- **npm 10+** (usually comes with Node.js) + +#### Verify installations: +```bash +node --version +npm --version +python3 --version +``` ### 1. Clone the repository @@ -100,11 +107,19 @@ The frontend will run at `http://localhost:5173` ### 3. Set up Backend (Flask) -**Terminal 2:** +**Terminal 2 (new terminal window):** + +First, set up Python virtual environment: ```bash cd backup_existing_project/backend +python3 -m venv venv +source venv/bin/activate # On Windows: venv\Scripts\activate +``` + +Then install dependencies and run: +```bash pip install -r requirements.txt -python run.py +python3 run.py ``` The backend API will run at `http://localhost:5000` @@ -116,6 +131,32 @@ The backend API will run at `http://localhost:5000` The frontend is configured to proxy API requests to the backend automatically. +### Troubleshooting + +**Backend won't start - "Port 5000 in use"** +```bash +# Check what's using port 5000 +lsof -i :5000 + +# Kill the process (replace PID) +kill -9 + +# Or start on a different port +python3 run.py --port 5001 +``` + +**Command not found: python or pip** +- Use `python3` and `pip3` instead +- Verify Python 3 is installed: `python3 --version` + +**npm install fails** +- Clear npm cache: `npm cache clean --force` +- Delete `node_modules` and `package-lock.json`, then try again + +**Module not found errors on backend** +- Ensure virtual environment is activated (should see `(venv)` in terminal) +- Reinstall requirements: `pip install -r requirements.txt --force-reinstall` + --- ## 📜 Available Scripts