Pubflow+🟒Supabase

Pubflow + SupabaseBetter Together

Use Supabase's PostgreSQL database with Pubflow's authentication and validation system for a powerful, scalable backend

Why use Pubflow with Supabase?

Get the best of both worlds: Supabase's database + Pubflow's auth & validation

πŸ—„οΈ
Use Supabase PostgreSQL
Keep your existing database

Continue using Supabase's powerful PostgreSQL database with all its features: real-time subscriptions, storage, and edge functions.

πŸ”
Pubflow Authentication
Enterprise-grade auth system

Replace Supabase Auth with Flowless for more flexibility, better security with Argon2, and advanced trust token validation.

πŸ›‘οΈ
Bridge Validation
6-layer security system

Add a Flowfull backend that validates session tokens before hitting your Supabase database. More secure and scalable than direct database access.

⚑
HybridCache
3-tier caching system

Add Redis + LRU + Database caching to your Supabase queries. Get 97% cache hit rates and 50x faster responses.

How it works

Simple, secure, and scalable architecture

🎨
Your Frontend
React, Next.js, etc.
⚑
Flowfull Backend
Validates tokens
πŸ”
Flowless Auth
Session validation
🟒
Supabase DB
PostgreSQL + Storage

βœ“ Your frontend gets authenticated data from Supabase, validated by Pubflow

Developer Experience

Focus on building features, not authentication logic

1. User logs in with Flowless

frontend.ts
TypeScript
import { createFlowfull } from '@pubflow/flowfull-client';

// Create client instance
const api = createFlowfull('https://your-instance.pubflow.com');

// Login
const result = await api.auth.login({
  email: 'user@example.com',
  password: 'SecurePass123!'
});

// Session is automatically stored and used for future requests
const user = await api.auth.me();

2. Your Flowfull backend validates and queries Supabase

backend.ts
TypeScript
app.get('/api/posts', requireAuth(), async (c) => {
  // βœ… Token already validated by requireAuth()!
  const userId = c.get('user_id');
  const userType = c.get('user_type');


  // compare.firebase.dx.steps.validate.codeCommentQuery
  const posts = await db
    .selectFrom('posts')
    .selectAll()
    .where('user_id', '=', userId)
    .execute();


  return c.json(posts);
});

πŸ’‘ Using requireAuth() from our starter kits or Flowfull. Learn more in the Auth Middleware documentation.

3. Add HybridCache for 50x faster queries

backend-cached.ts
TypeScript
const apiCache = new HybridCache<BlogStats>({
  cacheType: 'blogStats',
  ttl: 60,         // 1 minute
  maxSize: 1000,
  keyPrefix: 'blog'
});

app.get('/api/blog/stats', requireAuth(), async (c) => {
  const cacheKey = 'global-stats';

  // Try cache first
  let stats = await apiCache.get(cacheKey);

  if (!stats) {
    // Expensive query
    stats = await db.selectFrom('blog_posts')
      .select([
        db.fn.count('id').as('total_posts'),
        db.fn.sum('views').as('total_views')
      ])
      .executeTakeFirst();

    // Cache for 1 minute
    await apiCache.set(cacheKey, stats, 60);
  }

  return c.json(stats);
});

⚑ Performance tip: Learn how to implement HybridCache efficiently in the HybridCache documentation. Our starter kits include it by default!

Learn more about HybridCache

Get 97% cache hit rates and dramatically improve performance

View HybridCache Documentation β†’

Key Benefits

πŸ”’

More Secure

6-layer trust validation ensures only authenticated users access your Supabase data

⚑

More Scalable

HybridCache and stateless design means infinite horizontal scaling

πŸš€

Faster Development

Focus on business logic, not auth validation. Just check the session token!

Ready to supercharge your Supabase app?

Start using Pubflow with Supabase today. No credit card required.