Thank you for your interest in contributing to Capsule! This document provides guidelines for contributing to the project.
- Rust (latest stable version)
- Docker and Docker Compose
- PostgreSQL client tools (optional)
-
Clone the repository:
git clone https://github.com/charlieroth/capsule.git cd capsule -
Set up environment variables:
cp .envrc.template .envrc # Edit .envrc with your configuration source .envrc # or use direnv
-
Start the database:
make db-up make db-migrate
-
Build and run:
make dev
- Ensure all tests pass:
make test - Check code formatting:
make fmt - Run linter:
make lint - Full check:
make check
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes following the code style guidelines below
- Add tests for new functionality
- Update documentation as needed
- Run the full check:
make check
- Push your branch:
git push origin feature/your-feature - Create a Pull Request
- Fill out the PR template completely
- Ensure CI checks pass
- Address any review feedback
- Use
rustfmtfor formatting:make fmt - Follow clippy recommendations:
make lint - Use meaningful variable and function names
- Add docstrings for public APIs
- Use strong typing with custom domain types
- Write tests for new functionality
- Use
#[cfg(test)] mod testswithin source files - Follow naming convention:
test_<function>_<scenario> - Mock external dependencies appropriately
- Use SQLx with compile-time checked queries
- Run
make prepareafter schema changes - Create migrations for all schema changes
- Document migration purpose in filename
// Standard library
use std::collections::HashMap;
// External crates
use axum::Router;
use sqlx::PgPool;
// Local modules
use crate::entities::User;- Never commit secrets or API keys
- Use proper JWT handling for authentication
- Follow secure coding practices
- Report security issues via email (see SECURITY.md)
If you have questions about contributing, please:
- Check existing issues and discussions
- Open a new issue with the "question" label
- Reach out to maintainers
Thank you for contributing!