Shield - Materi Admin & Auth
Django-based administrative service providing user management, authentication, and internal tooling for the Materi platform.
Overview
Materi Shield provides authentication, user management, and administrative services for the Materi platform with event-driven architecture for cross-service data consistency.Core Responsibilities
- User Management: Account creation, profiles, and lifecycle management
- Authentication: OAuth 2.0, SAML 2.0, and JWT token management
- Authorization: Role-based access control (RBAC) and permissions
- Workspace Administration: Multi-tenant workspace management
- Event Publishing: User and authentication events for service synchronization
- Internal APIs: Service-to-service communication endpoints
- Admin Dashboard: System configuration and monitoring
Event-Driven Integration
Shield participates in the event-driven ecosystem to maintain data consistency across services:Published Events
Consumed Events
Tech Stack
- Framework: Django 4.2+
- Database: PostgreSQL 15+ (shared with materi-api)
- Cache: Redis 7+
- Authentication: Django Allauth, python-social-auth
- Admin: Django Admin with custom theming
- Testing: Pytest with pytest-django
Prerequisites
- Python 3.11+
- Docker & Docker Compose
- PostgreSQL 15+
- Redis 7+
Quick Start
1. Clone and Setup
2. Install Dependencies
3. Environment Configuration
4. Database Setup
5. Run Development Server
http://localhost:8001/admin
Project Structure
Development
Running Tests
Code Quality
Database Migrations
Custom Management Commands
Admin Interface
Accessing Admin Panel
Navigate tohttp://localhost:8001/admin and log in with superuser credentials.
Custom Admin Features
User Management
- Bulk user import/export
- User activity logs
- Password reset via admin
- Account suspension/activation
Workspace Administration
- Workspace creation & deletion
- Member management
- Billing & subscription tracking
- Usage analytics dashboard
System Configuration
- Feature flags (toggle features per workspace)
- Rate limit configuration
- Email template management
- System-wide announcements
Admin Permissions
Authentication
OAuth 2.0 Setup
Google OAuth
- Create OAuth credentials in Google Cloud Console
- Set authorized redirect URI:
http://localhost:8001/auth/google/callback - Add credentials to
.env:
GitHub OAuth
- Create OAuth App in GitHub Settings
- Set callback URL:
http://localhost:8001/auth/github/callback - Add credentials to
.env
SAML 2.0 Setup
Session Management
API Endpoints
Internal API (for materi-api communication)
User Management
Workspace Management
Testing Strategy
Unit Tests
Integration Tests
Test Coverage Goals
- Models: 95%+
- Views: 85%+
- Forms: 90%+
- Utilities: 90%+
Deployment
Docker Build
Collect Static Files
Database Optimization
Monitoring
Django Admin Actions Logging
All admin actions are automatically logged:Performance Monitoring
http://localhost:8001/silk/
Health Check
Event System Monitoring
Security
Security Settings
Secret Rotation
CORS Configuration
Troubleshooting
Migration Issues
Cache Issues
Session Issues
Event System Issues
Contributing
See root repository CONTRIBUTING.md for guidelines.Django-Specific Guidelines
- Follow Django coding style
- Use class-based views where appropriate
- Document all custom managers and querysets
- Add docstrings to all models and methods
- Write migrations for schema changes
License
Copyright © 2025 Materi. All rights reserved.Support
- Documentation: https://docs.getmateri.com/admin
- Issues: GitHub Issues
- Slack: #materi-admin channel
Maintained by: Backend Team
Last Updated: November 2, 2025