
Choosing Supabase as Auth Provider
The decision to use Supabase as our authentication provider was not made lightly. Supabase offers several advantages that aligned with Chamjo's needs:
- Open Source - Can be self-hosted if needed
- Built-in Auth - No need to build auth system from scratch
- Social Login - Easy integration with Google, GitHub, and other providers
- Real-time Database - Bonus feature that can be leveraged for other features later
The auth implementation uses SSR (Server-Side Rendering) approach for better security. This approach works well with Next.js App Router that Chamjo uses.
Google Sign-In - A Strategic Choice
Chamjo chose Google Sign-In as the primary login method. This decision was based on several considerations:
- User Experience - Most users already have a Google account, so they don't need to create a new one
- Trust - Google is a well-known and trusted OAuth provider
- Quick Implementation - Supabase provides an abstraction that makes Google OAuth integration easier
The login modal was designed with a mobile-first approach. For mobile view, we used a Bottom Sheet that's easier to reach with the thumb. For desktop, it's displayed as a Modal dialog that users are familiar with.
Landing Page Creation
One of the most significant changes during login implementation was the creation of the landing page itself.
Before Auth Implementation
There was no landing page. The app started directly without any introduction or marketing page. Users had no way to understand what Chamjo was before signing up.
After Auth Implementation
With the login system in place, a complete landing page was built to introduce Chamjo to new visitors:
- Hero Section - Chamjo's main value proposition
- Content Section - Platform features explanation
- Trusted Section - Social proof from users
- Benefit Section - Advantages of using
- Benchmark Section - Comparison with competitors
- FAQ Section - Frequently asked questions
- CTA Section - Call to action to encourage registration
Auth-Aware Routing
The landing page and main content are now properly separated:
- Guest users → See the landing page with all the marketing sections
- Authenticated users → Redirected directly to `/browse` page, skipping the landing page entirely
This provides a seamless experience - registered users don't need to see the marketing content again. The `/browse` page is also protected; unauthenticated users trying to access it are redirected back to the landing page.
## Timeline
| Date | Milestone |
|---------|-----------|
| May 2024 | Auth configuration and custom hooks implementation |
| May 2024 | ModalLogin component with Google Sign-In |
| November 2024 | First release with stable login feature |
| 2025 | Various improvements and stabilization |
Lessons Learned
Authentication as Foundation
Starting with auth from the beginning makes the architecture cleaner. No need to retrofit auth into an already complex system. Every new feature that requires user context is ready from the start.
SSR for Security
Using Supabase SSR client provides better security because tokens are managed server-side. This prevents potential attacks like token theft from client-side storage.
UX-First Approach
Responsive login modal shows attention to user experience. Bottom Sheet for mobile and Modal for desktop is the right choice to provide the best experience on each device.
Proper Redirect Strategy
Directing logged-in users directly to the content page (not landing page) provides a more personalized experience and saves user time.
Tech Stack for Authentication
- Frontend Framework : Next.js with App Router
- Auth Provider: Supabase Auth with SSR support
- OAuth Provider: Google Sign-In
- State Management: React Hooks with custom hooks pattern
- Routing Protection: Server-side redirect based on auth state
Closing
The implementation of login feature in Chamjo shows that with proper planning and the right tech stack choice, a fundamental feature like authentication can be implemented relatively quickly and stably.
The main keys are choosing a mature provider (Supabase), using a secure approach (SSR), and paying attention to user experience on every platform (responsive login modal).
This feature became the foundation that enabled Chamjo to develop other features requiring user authentication later on.
Subscribe to Newsletter
Get the latest posts delivered straight to your inbox.
