What If My Startup Had Chosen Supabase? A CTO’s Lessons from a Failed Microservice Journey
A former CTO recounts how building a microservice‑based backend, web portal, and mobile apps for a startup led to costly complexity and eventual failure, and explains how adopting Supabase could have simplified architecture, reduced vendor lock‑in, and saved time and resources.
Landing as CTO on a Mess
Egor Romanov was invited to join a startup as CTO, assembled an engineering team, and set out to build a backend, a web management portal, and mobile applications using a microservice architecture. The startup failed to attract market attention and shut down within months.
Why the Startup Struggled
The product aimed to connect users with off‑season inventory or excess capacity, offering discounts to buyers and cash flow to sellers. It required iOS and Android apps, a web portal for enterprise managers, and mandatory in‑app procurement.
Due to a weak team and tight deadlines, Romanov quickly recruited engineers, built a solid backend foundation, and iterated on concepts and requirements throughout development.
Building a Scalable Backend with Microservices
Romanov chose Node.js, Kubernetes, GitLab CI/CD, JSON‑RPC, and MongoDB (preferring Postgres). The frontend used Vue.js, the mobile app used React Native, and JavaScript was used across the stack.
Products : Manage partner‑provided products, promotions, retail locations, and launch/stop of campaigns.
Business Users : Manage enterprises, employees, and data under the Auth service.
Orders : Implement shopping‑cart lifecycle and integrate with payment systems.
Gate : Entry point handling websocket connections and routing requests to authentication or façade services.
Admin Façade / User Façade : Expose internal services to clients and enforce authorization.
Auth : User authentication and authorization.
File : Manage static assets and legal documents, integrated with Yandex Object Storage.
App Users : Store mobile‑app user metadata such as last login and friends.
Settings : Manage application configuration.
Marketing : Handle marketing campaigns and recommendation lists.
Notification Services (Email, Push, SMS) : Integrated with external providers (e.g., CloudPayments) for communication.
Supabase: A Potentially Better Answer
Feedback suggested using a service like Firebase to simplify the backend, but concerns about vendor lock‑in led Romanov to reject it. Later, he discovered Supabase, an open‑source platform built on Postgres that offers authentication, real‑time sync, storage, auto‑generated REST/GraphQL APIs, and serverless functions while keeping data under the team's control.
Automatic API generation (REST, GraphQL, realtime websockets).
Built‑in authentication and role‑based access control.
Object storage with image resizing.
Scalable, secure, Kubernetes‑based deployment with encryption.
Replacing Services with Supabase
Auth : Supabase’s auth service replaces the custom Auth microservice, providing registration, login, and role‑based permissions out of the box.
Storage : Supabase’s built‑in storage eliminates the separate File service, handling uploads, downloads, and image transformations.
// Request a small resized image of a product from Supabase Storage:
await storage.from('mama_jane').download('pizza.jpeg', {
transform: {
width: 200,
height: 200,
format: 'origin',
},
});Gateways & Facades : Supabase’s auto‑generated PostgREST and GraphQL APIs remove the need for custom gateway and façade services.
# Retrieve a feed with products from app using Supabase generated GraphQL API
{
retailersCollection(filter: {active: {eq: true}}) {
edges {
node {
name
productsCollection {
edges {
node {
id
title
imageUrl
price
}
}
}
}
}
}
}Notifications : Serverless functions and triggers on Supabase tables can replace Push, SMS, and Email microservices, sending notifications automatically on events such as order creation.
-- Trigger to send push notifications after the marketing specialist adds a marketing campaign to the database.
create or replace function insert_marketing_campaign() returns trigger as $$
begin
insert into marketing_campaigns (message, user_group, start_date)
values (new.message, new.user_group, new.start_date);
perform send_push_events();
return null;
end;
$$ language plpgsql;
create trigger insert_and_send_push
after insert on marketing_campaigns
for each row
execute function insert_marketing_campaign();Orders : Supabase Edge Functions can handle Stripe webhook events, reducing the need for a dedicated Orders microservice.
serve(async (request) => {
const signature = request.headers.get("Stripe-Signature");
const body = await request.text();
let receivedEvent;
try {
receivedEvent = await stripe.webhooks.constructEventAsync(
body,
signature!,
Deno.env.get("STRIPE_WEBHOOK_SIGNING_SECRET")!,
cryptoProvider
);
} catch (err) {
return new Response(err.message, { status: 400 });
}
console.log(receivedEvent);
return new Response(JSON.stringify({ ok: true }), { status: 200 });
});Geospatial needs could be met with PostGIS, the PostgreSQL extension for location data.
Conclusion
Using Supabase with PostgreSQL would simplify the architecture, cut development and infrastructure costs, and avoid vendor lock‑in, while still supporting multiple programming languages and both cloud and on‑premises deployments. Although Supabase is not a universal solution, it offers a compelling, cost‑effective alternative for many startups.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
