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
How it works
Simple, secure, and scalable architecture
β 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
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
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
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.