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):

MetricBeforeAfterImprovement
Cold Start Time~150ms~50ms66% ↓
Worker CPU Time (Simple Request)~3ms~1ms66% ↓
Worker CPU Time (Complex Query)~15ms~5ms66% ↓
Memory Usage~2MB~0.5MB75% ↓
Bundle Size~800KB~150KB81% ↓

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:

Article ViewsOld Method Query TimeNew Method Query TimeMemory Usage
1,000~5ms~0.1ms12KB
100,000~300ms~0.1ms12KB
1,000,000~3,000ms~0.1ms12KB
  • 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 database and s3 modes via the CACHE_STORAGE_MODE environment 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 dev launches 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_USERNAME and ADMIN_PASSWORD environment variables
  • Dedicated Page: Login functionality moved to standalone /login page, replacing modal dialog to fix focus issues
  • Profile Management: New /profile page 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):

const feeds = await client.feed.index.get({ query: { page: 1 } });

New Code:

const feeds = await client.feed.list({ page: 1 });

OAuth Variable Names

GitHub OAuth environment variable names have been prefixed with RIN_:

  • GITHUB_CLIENT_ID → RIN_GITHUB_CLIENT_ID
  • GITHUB_CLIENT_SECRET → RIN_GITHUB_CLIENT_SECRET

Migration Guide

  1. Update Frontend Build Command: Replace build command: bun b → bun run build
  2. Update OAuth Variable Names: If using GitHub OAuth, update environment variable names
  3. Username & Password Login (Optional): To enable username/password login, set ADMIN_USERNAME and ADMIN_PASSWORD environment 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