Tinkr
⚠️ EVERYTHING UNDER EXPERIMENTAL DEVELOPMENT ⚠️
A full-stack web framework for Rust that makes building modern web applications fast and enjoyable. Built on Leptos, Tinkr provides a comprehensive suite of UI components, authentication, database integration, and deployment tools to help you ship production-ready applications quickly.
Features
🎨 Rich UI Component Library
- Pre-built Components: Buttons, inputs, modals, dropdowns, tabs, tooltips, and more
- Form Handling: Integrated form components with validation support
- Loading States: Progress bars, loading indicators, and skeletons
- Navigation: Sidebar, navbar, breadcrumbs, and navigation helpers
- Avatars: Boring Avatars integration with multiple styles (Beam, Marble, Ring, Pixel, Bauhaus, Sunset)
- Alerts & Notifications: Built-in alert system with different severity levels
- Responsive Design: Mobile-first components that work across all devices
🔐 Authentication & Authorization
- OAuth Integration: Built-in OAuth2 support for third-party authentication
- Session Management: Secure session handling with token-based authentication
- User Management: Complete user profile and account management system
- Guest Access: Support for guest users and anonymous sessions
- Authorization Checks: Easy-to-use authorization middleware and guards
🗄️ Database & Storage
- SurrealDB Integration: First-class support for SurrealDB with async operations
- Caching Layer: Built-in caching with the
cachedcrate for improved performance - Storage Traits: Flexible storage abstraction for implementing custom backends
- Type-Safe Queries: Strongly typed database operations with compile-time safety
- Migrations: Schema management and database initialization helpers
💳 Payment Processing
- PayFast Integration: South African payment gateway support
- Transaction Management: Handle payments and subscriptions
- Webhook Handling: Process payment notifications and updates
🪙 Web3 & Wallet Support
- MetaMask Integration: Connect and interact with MetaMask wallets
- EVM Chains: Support for Ethereum and EVM-compatible chains
- Address Verification: Checksum validation and address utilities
- Wallet Authentication: Sign-in with Ethereum/Web3 wallets
📊 Observability & Telemetry
- OpenTelemetry: Built-in metrics and tracing support
- Grafana Loki: Log aggregation integration
- Prometheus Metrics: Metrics endpoint for monitoring
- Pyroscope Profiling: CPU profiling integration
- Custom Logging: Structured logging with tracing
🚀 Server & Middleware
- Axum Integration: High-performance async HTTP server
- Compression: Gzip, Brotli, Deflate, and Zstd compression support
- CORS: Cross-origin resource sharing middleware
- Health Checks: Built-in health and readiness endpoints
- Metrics Endpoint: Prometheus-compatible metrics
- Request Logging: Comprehensive request/response logging
📧 Email Integration
- Resend API: Send transactional emails via Resend
- Email Validation: Built-in email address validation
- Template Support: Email template helpers
🛠️ Utilities
- Date & Time: Chrono-based date utilities and helpers
- String Manipulation: Common string operations and transformations
- Color Utilities: Color parsing, conversion, and manipulation
- URL Handling: URL parsing and construction helpers
- Image Processing: Image upload, compression, and format conversion
- MIME Type Detection: Automatic file type detection
Installation
Add Tinkr to your Cargo.toml:
[]
= "0.0.32"
= "0.8"
For SSR (Server-Side Rendering) support:
[]
= { = "0.0.32", = ["ssr"] }
For hydration (client-side):
[]
= { = "0.0.32", = ["hydrate"] }
Quick Start
Basic Component Usage
use *;
use *;
Form Handling
use *;
use *;
Authentication
use *;
use *;
async
Datetime
use Datetime;
use FormatDatetime;
let created_at: Datetime;
created_at.format_custom; // Mon 01 Jan
created_at.ago; // 9 days ago
Database Integration (SSR)
use *;
use ;
async
async
Configuration
Environment Variables
Tinkr uses environment variables for configuration. Create a .env file:
# Database
SURREALDB_HOST=ws://localhost:8000
SURREALDB_NS=your_namespace
SURREALDB_DB=your_database
SURREALDB_USER=root
SURREALDB_PASS=root
# Auth
JWT_SECRET=your-secret-key-here
# Email (optional)
RESEND_API_KEY=your-resend-api-key
# OAuth (optional)
OAUTH_CLIENT_ID=your-client-id
OAUTH_CLIENT_SECRET=your-client-secret
# Telemetry (optional)
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
Components Reference
Layout Components
Page- Main page wrapper with responsive layoutSection- Content section with optional headerHero- Hero section with title, subtitle, and CTA buttonsFooter- Application footer
Navigation
NavBar- Top navigation barSideBar- Collapsible sidebar navigationNavigationBackButton- Browser back buttonDropdown- Dropdown menu with trigger and items
Forms
Input- Text input with label and validationCheckbox- Checkbox inputSelect- Select dropdownSubmitButton- Form submit button with loading stateFormSection- Form wrapper with titleFormGrid- Responsive form grid layout
UI Elements
Button- Customizable button componentModal- Modal dialog with backdropAlert- Alert messages with severity levelsTooltip- Hover tooltipLoading- Loading spinnerProgressBar- Progress indicatorTabs- Tab navigation
Display
Image- Optimized image componentUserAvatar- User avatar with fallbackLogo- Application logoTimer- Countdown/elapsed time display
Features Flag
Tinkr supports the following feature flags:
default- Includesssrfeaturessr- Server-side rendering with Axum, SurrealDB, and all backend featureshydrate- Client-side hydration support
Architecture
Tinkr follows a modular architecture:
tinkr/
├── auth/ # Authentication & authorization
├── components/ # UI component library
├── db/ # Database layer
├── email/ # Email integration
├── middleware/ # Server middleware
├── payments/ # Payment processing
├── telemetry/ # Observability
├── wallet/ # Web3 wallet integration
└── utils/ # Shared utilities
Development
Running Tests
Building
# Development build
# Production build
Release
The project includes a release script:
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Links
Support
For questions and support, please open an issue on GitHub.