Backend monorepo containing 15 crates for the PIM-Perms permission system.
This repository contains the complete backend implementation:
- Foundation (3 crates):
pim-perms-models,pim-perms-crypto,pim-perms-database - Services (2 crates):
pim-perms-cache,pim-perms-audit - Auth Providers (5 crates):
pim-perms-providers,pim-perms-providers-local,pim-perms-providers-ldap,pim-perms-providers-oauth,pim-perms-providers-saml - Core Engine (5 crates):
pim-perms-inheritance,pim-perms-time-windows,pim-perms-workflow,pim-perms-rbac,pim-perms-core - API (2 crates):
pim-perms-middleware,pim-perms-api
- Rust 1.70+
- PostgreSQL 14+ or SQLite 3.35+
- Redis (optional, for distributed caching)
# Clone and enter directory
cd pim-perms-backend
# Build all crates
cargo build --all
# Run tests
cargo test --all
# Run with auto-fix
cargo clippy --all --fix
cargo fmt --allpim-perms-backend/
├── Cargo.toml # Workspace configuration
├── crates/ # All 15 crates
│ ├── pim-perms-models/
│ ├── pim-perms-crypto/
│ └── ...
├── tests/ # Integration tests
├── test-utils/ # Shared test utilities
└── docs/ # This repo's documentation
Central Documentation: pim-perms-docs
Backend-Specific:
- Architecture - Backend architecture details
- Implementation Guide - Step-by-step implementation
- Testing Strategy - How to test backend crates
Full Architecture:
This repository uses comprehensive testing at multiple levels:
- Unit Tests: Each crate has tests in
crates/*/tests/ - Integration Tests: Cross-crate tests in
tests/ - Coverage Target: 80%+ for all crates
- Linting: Clippy with
-D warnings(fail on any warnings)
# Run all tests
cargo test --all
# Check coverage
cargo tarpaulin --all
# Lint
cargo clippy --all -- -D warnings
# Auto-fix linting issues
./scripts/lint-fix.shGitHub Actions automatically:
- ✅ Runs tests on every PR
- ✅ Checks code formatting
- ✅ Runs clippy with strict settings
- ✅ Measures code coverage
- ✅ Auto-fixes formatting and some clippy warnings (commits back to PR)
Use feature branches for concurrent development:
# Example: Implementing models crate
git checkout -b feature/models
# Work on crates/pim-perms-models/
git add crates/pim-perms-models/
git commit -m "feat(models): implement User and Group types"
git push origin feature/modelsMultiple developers can work on different crates simultaneously with zero merge conflicts since each crate is in its own directory.
Install pre-commit hooks to catch issues early:
# Install pre-commit (if not already installed)
pip install pre-commit
# Install hooks
pre-commit installThis will automatically run cargo fmt and cargo clippy before each commit.
Follow this order for implementing crates:
-
Week 1: Foundation
pim-perms-models→pim-perms-crypto→pim-perms-database
-
Week 2: Services (can parallelize)
pim-perms-cache+pim-perms-audit
-
Week 3-4: Auth Providers (can parallelize)
pim-perms-providers→ then all 4 provider implementations
-
Week 5-6: Core Engine
pim-perms-inheritance,pim-perms-time-windows,pim-perms-workflow→pim-perms-rbac→pim-perms-core
-
Week 7: API
pim-perms-middleware→pim-perms-api
External crates depend on published versions from crates.io or git:
# In downstream repos
[dependencies]
pim-perms-models = { git = "https://github.com/analog-pim/pim-perms-backend", package = "pim-perms-models" }For local development, use path dependencies:
# .cargo/config.toml in other repos
[patch."https://github.com/analog-pim/pim-perms-backend"]
pim-perms-models = { path = "../pim-perms-backend/crates/pim-perms-models" }- Create a feature branch
- Implement your changes
- Write tests (maintain 80%+ coverage)
- Run
cargo fmtandcargo clippy --fix - Push and create PR
- CI will auto-fix minor issues and push back to your branch
- Address any remaining review comments
- Merge when approved and CI passes
See main PIM-Perms Documentation for project overview and contact information.