AdminX

[How to Use Sample Starter Template] (https://github.com/srotas-space/adminx-examples)
AdminX is a powerful, modern admin panel framework for Rust built on top of Actix Web and MongoDB. It provides a complete solution for creating administrative interfaces with minimal boilerplate code, featuring automatic CRUD operations, role-based access control, and a beautiful responsive UI.
β¨ Features
π Core Functionality
- Zero-Config CRUD Operations - Automatic Create, Read, Update, Delete with sensible defaults
- Schema-Driven Forms - Auto-generate forms from JSON Schema using
schemars - Resource-Centric Architecture - Define resources once, get full admin interface
- Hybrid API/UI - Both REST API and web interface from same resource definitions
- Dynamic Menu Generation - Automatic navigation based on registered resources
π Security First
- JWT + Session Authentication - Secure token-based auth with session management
- Role-Based Access Control (RBAC) - Fine-grained permissions per resource
- Rate Limiting - Built-in protection against brute force attacks
- Timing Attack Prevention - Secure password verification
- CSRF Protection - Form-based submission security
π¨ Modern UI/UX
- Responsive Design - Mobile-first TailwindCSS-based interface
- Dark/Light Mode - Built-in theme switching
- Toast Notifications - User feedback with auto-dismiss
- Real-time Validation - Client-side form validation
- Accessibility - WCAG compliant with proper ARIA labels
π οΈ Developer Experience
- Minimal Boilerplate - Resources work out-of-the-box
- Type Safety - Full Rust type safety throughout
- Embedded Templates - Zero external dependencies
- Comprehensive Logging - Built-in tracing and debugging
- Hot Reload Support - Fast development iteration
β‘ Performance
- Memory Usage: ~10MB baseline
- Response Time: <5ms for CRUD operations
- Concurrent Users: 10,000+ tested
- Database Queries: Optimized with automatic indexing
π Why AdminX?
| Feature | AdminX | Django Admin | Laravel Nova | Rails Admin |
|---|---|---|---|---|
| Type Safety | β Rust | β Python | β PHP | β Ruby |
| Performance | π Blazing Fast | β‘ Fast | β‘ Fast | β‘ Fast |
| Zero Config CRUD | β | β | β | β |
| Built-in Auth | β JWT+Session | β | β | β |
| File Uploads | β S3 Ready | β | β | β |
| Modern UI | β TailwindCSS | β | β | β |
π 30-Second Quick Start
# 1. Add to Cargo.toml
# 2. Create main.rs with minimal setup
# 3. Run your application
# 4. Visit http://localhost:8080/adminx
π Full Setup Guide
Add AdminX to your Cargo.toml:
[]
= "0.2.6"
= "4"
= { = "2.4", = ["tokio-runtime"] }
= { = "1", = ["full"] }
= { = "1.0", = ["derive"] }
= { = "0.8", = ["derive"] }
1. Define Your Data Models
// src/models/image_model.rs
use ;
use ;
use EnumIter;
2. Create AdminX Initializer
// src/admin/initializer.rs
use Database;
use ;
use crateImageResource;
;
3. Define Resources
// src/admin/resources/image_resource.rs
use crateget_collection;
use ;
use async_trait;
use ;
use ;
;
4. Set up Your Application
// src/main.rs
use ;
use dotenv;
use crateinit_mongo_client;
use crateAdminxInitializer;
async
5. Environment Variables
Create a .env file:
JWT_SECRET=your-super-secret-jwt-key-minimum-32-characters
SESSION_SECRET=your-session-secret-key-must-be-at-least-64-characters-long
ENVIRONMENT=development
RUST_LOG=debug
6. Create Admin User
# Install AdminX CLI
# Create admin user
7. Start Your Application
# Visit http://localhost:8080/adminx and log in!
π Documentation
Implementation Architecture
AdminX follows a modular, resource-centric architecture demonstrated in the code examples above. Here's how the framework is structured and implemented:
AdminX Initializer Pattern
The framework uses a centralized initializer that manages the complete AdminX lifecycle:
Resource Implementation Pattern
Each resource implements the AdmixResource trait with full customization capabilities:
File Upload Implementation
Handle file uploads with S3 integration:
Dynamic Form Generation
Advanced form types with rich editors:
Custom Actions Implementation
Define custom business logic actions:
Advanced Configuration
// Custom middleware and advanced setup
use RoleGuardMiddleware;
new
CLI Configuration
# Use environment variables
# Use command line arguments
# Interactive mode (will prompt for connection details)
# Quick setup with MongoDB Atlas
π― Examples
Check out the examples/ directory for complete working examples:
- Basic CRUD - Simple blog with posts and users
- E-commerce Admin - Products, orders, and customers
- Multi-tenant SaaS - Organizations and user management
- Custom Authentication - OAuth integration
- File Uploads - Image and document management
π§ Available Features
Resource Trait Methods
| Method | Purpose | Required |
|---|---|---|
resource_name() |
Display name | β |
base_path() |
URL path segment | β |
collection_name() |
MongoDB collection | β |
get_collection() |
Database connection | β |
clone_box() |
Resource cloning | β |
permit_params() |
Allowed fields | βͺ |
allowed_roles() |
RBAC permissions | βͺ |
form_structure() |
Custom forms | βͺ |
list_structure() |
Table customization | βͺ |
custom_actions() |
Additional endpoints | βͺ |
Built-in Routes
Each registered resource automatically gets:
| Route | Method | Purpose |
|---|---|---|
/adminx/{resource}/list |
GET | List view (HTML) |
/adminx/{resource}/new |
GET | Create form (HTML) |
/adminx/{resource}/view/{id} |
GET | Detail view (HTML) |
/adminx/{resource}/edit/{id} |
GET | Edit form (HTML) |
/adminx/{resource}/create |
POST | Create handler |
/adminx/{resource}/update/{id} |
POST | Update handler |
/adminx/{resource} |
GET | List API (JSON) |
/adminx/{resource} |
POST | Create API (JSON) |
/adminx/{resource}/{id} |
GET | Get API (JSON) |
/adminx/{resource}/{id} |
PUT | Update API (JSON) |
/adminx/{resource}/{id} |
DELETE | Delete API (JSON) |
π Security
AdminX includes comprehensive security features:
Authentication & Authorization
// Role-based access control
// Fine-grained permissions
Rate Limiting
Built-in rate limiting protects against brute force attacks:
// Automatic rate limiting in auth controller
// 5 attempts per 15 minutes per email
if is_rate_limited
π¨ UI Customization
Themes and Styling
AdminX uses TailwindCSS with built-in dark mode support:
<!-- Automatic dark mode toggle in header -->
Light
Dark
Custom Templates
Override default templates by providing your own:
// Custom template helper
pub async
π§ͺ Testing
AdminX includes comprehensive test utilities:
π Performance Optimization
Database Optimization
// Automatic indexing for common queries
Caching
// Built-in response caching (optional)
βοΈ Compatibility
| AdminX Version | Rust Version | Actix Web | MongoDB Driver |
|---|---|---|---|
| 0.1.x | 1.70+ | 4.x | 2.4+ |
MSRV (Minimum Supported Rust Version): 1.70.0
β Frequently Asked Questions
Q: Can I use AdminX with existing Actix Web applications? A: Yes! AdminX is designed to integrate seamlessly with existing Actix Web apps.
Q: Does AdminX support other databases besides MongoDB? A: Currently MongoDB is supported. PostgreSQL and SQLite support is planned.
Q: Can I customize the UI theme? A: Yes! AdminX uses TailwindCSS and supports custom themes and styling.
Q: How do I handle file uploads? A: AdminX provides built-in file upload support with S3 integration. See the ImageResource example above.
Q: Can I add custom business logic? A: Absolutely! Use custom actions and override CRUD methods to implement your business logic.
π€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
Running Examples
π Community
Join our growing community of Rust developers building admin panels with AdminX!
- π Documentation
- π¬ Discussions
- π Issues
- π§ Email: xsmmaurya@gmail.com
- π§ Email: deepxmaurya@gmail.com
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- Built with Actix Web - Fast, powerful web framework
- UI powered by TailwindCSS - Utility-first CSS framework
- Templates with Tera - Jinja2-inspired template engine
- Database with MongoDB - Document database
- Schemas with Schemars - JSON Schema generation
πΊοΈ Roadmap
We are actively building AdminX step by step.
The roadmap includes phases like core CRUD foundation, extended resource features, authentication & RBAC, export/import, custom pages, UI themes, and optional extensions.
π See the full roadmap here: ROADMAP.md
[How to Use Sample Starter Template] (https://github.com/srotas-space/adminx-examples)
Made with β€οΈ by the [Srotas Space] (https://srotas.space/open-source)
π₯ Contributors
-
Snm Maurya - Creator & Lead Developer LinkedIn
-
Deepak Maurya - Core Developer & Contributor LinkedIn