{"by":"moh_quz","descendants":35,"id":46324665,"kids":[46325263,46325128,46325379,46325117,46324890,46325695,46324871,46324807,46324939,46325988,46327547,46324694,46325066,46328759],"score":83,"text":"Hi HN, I&#x27;m Mohammed, a technical founder who loves shipping and giving back to the community. I&#x27;m open-sourcing the full-stack engine that powers my B2B product, apflow.co.<p>What it is: A production B2B starter with a Go backend and Next.js frontend. Both are fully Dockerized with separate containers. No Vercel. No Supabase. Deploy the whole thing on a $6 VPS, or split frontend and backend across different providers. You own the infrastructure.<p>The problem I was solving:<p>Every SaaS starter I evaluated had the same issue: they locked me into someone else&#x27;s platform. Vercel for hosting. PlanetScale for the database. Serverless functions billing per invocation. Fine for prototypes, but costs become unpredictable at scale and migrating away is painful.<p>I wanted something I could deploy on any Linux box with docker-compose up. Something where I could host the frontend on Cloudflare Pages and the backend on a Hetzner VPS if I wanted. No vendor-specific APIs buried in my code.<p>Why Go for the backend:<p>Go gives me exactly what I need for a SaaS backend:<p>Tiny footprint. The backend idles at ~50MB RAM. On a cheap VPS, that headroom lets me run more services without upgrading.\nConcurrency without complexity. Billing webhooks, file uploads, and AI calls run concurrently without callback hell.\nCompile-time type safety. Using SQLC, my SQL compiles to type-safe Go. If the query is wrong, it fails at build time, not in production.\nPredictable performance. No garbage collection pauses that surprise you under load.\nThe architecture (Modular Monolith):<p>I didn&#x27;t want microservices complexity for a small team, but I needed clean separation. I built a Modular Monolith: features like Auth, Billing, and AI are isolated Go modules with explicit interfaces, but they deploy as a single binary.<p>This structure also made AI coding tools (Cursor, Claude Code) dramatically more effective. Because every module has strict boundaries, the AI knows exactly where new code belongs and doesn&#x27;t break other modules.<p>Full-stack, not just backend:<p>Backend: Go 1.25 + Gin + SQLC (type-safe SQL, no ORM) + PostgreSQL with pgvector\nFrontend: Next.js 16 + React 19 + Tailwind + shadcn&#x2F;ui\nCommunication: The frontend consumes a clean REST API. You can swap Next.js for any framework that speaks HTTP.\nInfrastructure: Separate Dockerfiles for frontend and backend. Deploy together or apart.\nWhat&#x27;s pre-built:<p>The boring infrastructure is solved so you can focus on your actual product:<p>Auth + RBAC: Stytch B2B integration with Organizations, Teams, and Roles. Multi-tenant data isolation enforced at the query level.\nBilling: Polar.sh as Merchant of Record. Handles subscriptions, invoices, and global tax&#x2F;VAT. No Stripe webhook edge cases.\nAI Pipeline: OpenAI RAG using pgvector. The retrieval service enforces strict context boundaries to minimize hallucinations.\nOCR: Mistral integration for document extraction.\nFile Storage: Cloudflare R2 integration.\nEach feature is a separate module. Don&#x27;t need OCR? Remove it. Want Stripe instead of Polar? The billing interface is abstracted.<p>Real-world proof:<p>This isn&#x27;t a template I made for GitHub stars. It&#x27;s the exact code running apflow.co in production. When I added document OCR, I built it as a new module without touching Auth or Billing. The architecture held.<p>How to try it:<p>Clone the repo, read setup.md to check the prerequisite, run .&#x2F;setup.sh, and you have a working B2B environment locally in minutes.<p>Feedback I want:<p>I&#x27;d appreciate feedback from Go developers on the module boundaries and cross-module interfaces. Also curious if anyone has suggestions for the Docker setup in production deployments.<p>GitHub: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;moasq&#x2F;production-saas-starter\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;moasq&#x2F;production-saas-starter</a><p>Live: <a href=\"https:&#x2F;&#x2F;apflow.co\" rel=\"nofollow\">https:&#x2F;&#x2F;apflow.co</a>","time":1766144051,"title":"Show HN: I open-sourced my Go and Next B2B SaaS Starter (deploy anywhere, MIT)","type":"story","url":"https://github.com/moasq/production-saas-starter"}