Rin v0.3.0 Release đ
Release Date: February 4, 2025
We are excited to announce the official release of Rin v0.3.0! This is a major architectural upgrade that brings significant performance improvements and new features.
Core Highlights
đ OAuth Component Custom Implementation
We've reimplemented the OAuth2 component, replacing the previous elysia-oauth2 dependency:
- Generic Architecture: Supports any OAuth2 provider with GitHub OAuth as the built-in default
- CSRF Protection: Provides robust CSRF protection via state parameter validation
- Type Safe: Full TypeScript support throughout
- Zero External Dependencies: No longer relies on potentially incompatible third-party OAuth libraries
⥠Lightweight Lazy Loading Framework
This is one of the most important architectural changes in this update. We've refactored the ElysiaJS framework into a custom lightweight framework:
Performance Improvements (Tested on Cloudflare Workers environment):
Note: These are development environment test values. Production performance may vary depending on specific configuration.
Technical Highlights:
- On-Demand Loading: Dynamically loads corresponding services based on request path, no need to pre-register all routes
- Lazy Loading Dependencies: Database, cache, JWT, OAuth, S3, and other dependencies are only loaded on first access
- Streamlined Context: No complex framework overhead, only necessary context is created per request
- Removed Heavy Dependencies: Eliminated approximately 15 heavy packages including Elysia, @elysiajs/*, typedi, reflect-metadata
đ HyperLogLog UV Statistics
We've migrated UV (Unique Visitor) statistics from traditional record traversal to the HyperLogLog algorithm:
Problem Solved:
- Original UV statistics required traversing all visit records, resulting in extremely high query overhead for high-traffic articles
- Database query time grew linearly with visit count, creating a performance bottleneck
Improvement Results:
- 16384 registers with approximately 0.81% error rate
- Query time remains constant at O(1) regardless of visit volume
- Only ~12KB storage space required per article's statistics
đž CacheImpl Database Persistence
Added database persistence support to CacheImpl:
- No S3 Required: Configuration cache can now be stored directly in the database, suitable for small deployments
- Flexible Switching: Switch between
databaseands3modes via theCACHE_STORAGE_MODEenvironment variable - Convenient Configuration Updates: Cache configurations can now be read and updated directly through SQL
đ ī¸ Simplified Local Development
We've significantly simplified local development:
- One-Click Startup:
bun run devlaunches both client and server simultaneously - Automatic Configuration: Development environment variables are automatically injected, no manual configuration needed
- Hot Reload: Code changes automatically trigger reload
- Simplified Debugging: Unified log output format for easier troubleshooting
đ Username & Password Login Support
In addition to GitHub OAuth, we now support traditional username and password login:
- Flexible Configuration: Enable via
ADMIN_USERNAMEandADMIN_PASSWORDenvironment variables - Dedicated Page: Login functionality moved to standalone
/loginpage, replacing modal dialog to fix focus issues - Profile Management: New
/profilepage allows users to update their avatar and username - Better UX: Login and profile pages now include complete Header navigation
⨠Usability Improvements
- Login Experience: Fixed input focus reset issues during login
- Avatar Display: Users without avatars now correctly display login status
- Consistent Layout: All pages now include consistent Header and Footer
Breaking Changes
API Client Interface Change
Due to the switch from Eden Treaty pattern to direct method calls, the client API interface has changed:
Old Code (no longer supported):
New Code:
OAuth Variable Names
GitHub OAuth environment variable names have been prefixed with RIN_:
GITHUB_CLIENT_IDâRIN_GITHUB_CLIENT_IDGITHUB_CLIENT_SECRETâRIN_GITHUB_CLIENT_SECRET
Migration Guide
- Update Frontend Build Command: Replace build command:
bun bâbun run build - Update OAuth Variable Names: If using GitHub OAuth, update environment variable names
- Username & Password Login (Optional): To enable username/password login, set
ADMIN_USERNAMEandADMIN_PASSWORDenvironment variables
Known Issues
- Potential incompatibility issues with refactored interfaces have been verified and fixed in production use
- Login form focus issues have been resolved by switching to a dedicated login page
Feedback and Suggestions
If you encounter any issues or have suggestions for improvement while using Rin, please provide feedback through:
- đ GitHub Issues
- đŦ Join our discussions on GitHub Discussions
Thank you to all contributors for their hard work! đ
Rin Team
February 4, 2025