Thank you for considering contributing to this project! We welcome contributions from everyone.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/school-backend.git cd school-backend - Add the upstream repository:
git remote add upstream https://github.com/original-owner/school-backend.git
Follow the setup instructions in README.md to get your development environment ready.
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-nameUse descriptive branch names:
feature/add-teacher-modelfor new featuresfix/database-connection-errorfor bug fixesdocs/update-api-documentationfor documentation updates
This project follows Rust best practices:
- Run
cargo fmtbefore committing to format your code - Run
cargo clippyto catch common mistakes and improve code quality - Write clear, descriptive commit messages
- Add comments for complex logic
Before submitting your changes:
# Format code
cargo fmt
# Check for issues
cargo clippy
# Build the project
cargo build
# Run the application
cargo runTest your changes manually using curl or a REST client:
# Test endpoint
curl http://localhost:8080/api/schoolsWrite clear commit messages following this format:
type: brief description
Detailed explanation of what changed and why (if needed)
Types:
feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringtest: Adding testschore: Maintenance tasks
Example:
git add .
git commit -m "feat: add teacher model and endpoints"git push origin feature/your-feature-nameThen create a Pull Request on GitHub with:
- Clear title describing the change
- Description of what was changed and why
- Any related issue numbers (e.g., "Fixes #123")
school-backend/
├── src/
│ ├── controllers/ # Request handlers
│ ├── models/ # Data structures
│ ├── routes/ # API route definitions
│ ├── services/ # Business logic and database queries
│ ├── middlewares/ # Custom middleware
│ ├── utils/ # Helper functions
│ └── main.rs # Application entry point
├── migrations/ # Database migrations
└── README.md
- Create model file in
src/models/ - Define structs with
Serialize,Deserialize, andFromRowderives - Export in
src/models/mod.rs
- Create service file in
src/services/with database queries - Create controller file in
src/controllers/with request handlers - Create route file in
src/routes/with endpoint definitions - Register routes in
src/routes/mod.rs
When adding new tables or modifying schema:
- Create a new migration file:
migrations/00X_description.sql - Write SQL for creating/altering tables
- Document the migration in your PR
- All submissions require review before merging
- Address any feedback from reviewers
- Keep your branch up to date with main:
git fetch upstream git rebase upstream/main
When reporting bugs, include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Rust version, PostgreSQL version)
- Error messages or logs
Feel free to open an issue for questions or discussions about the project.
By contributing, you agree that your contributions will be licensed under the same license as the project.