frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: I open-sourced my Go and Next B2B SaaS Starter (deploy anywhere, MIT)

https://github.com/moasq/production-saas-starter
39•moh_quz•1h ago
Hi HN, I'm Mohammed, a technical founder who loves shipping and giving back to the community. I'm open-sourcing the full-stack engine that powers my B2B product, apflow.co.

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.

The problem I was solving:

Every SaaS starter I evaluated had the same issue: they locked me into someone else'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.

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.

Why Go for the backend:

Go gives me exactly what I need for a SaaS backend:

Tiny footprint. The backend idles at ~50MB RAM. On a cheap VPS, that headroom lets me run more services without upgrading. Concurrency without complexity. Billing webhooks, file uploads, and AI calls run concurrently without callback hell. Compile-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. Predictable performance. No garbage collection pauses that surprise you under load. The architecture (Modular Monolith):

I didn'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.

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't break other modules.

Full-stack, not just backend:

Backend: Go 1.25 + Gin + SQLC (type-safe SQL, no ORM) + PostgreSQL with pgvector Frontend: Next.js 16 + React 19 + Tailwind + shadcn/ui Communication: The frontend consumes a clean REST API. You can swap Next.js for any framework that speaks HTTP. Infrastructure: Separate Dockerfiles for frontend and backend. Deploy together or apart. What's pre-built:

The boring infrastructure is solved so you can focus on your actual product:

Auth + RBAC: Stytch B2B integration with Organizations, Teams, and Roles. Multi-tenant data isolation enforced at the query level. Billing: Polar.sh as Merchant of Record. Handles subscriptions, invoices, and global tax/VAT. No Stripe webhook edge cases. AI Pipeline: OpenAI RAG using pgvector. The retrieval service enforces strict context boundaries to minimize hallucinations. OCR: Mistral integration for document extraction. File Storage: Cloudflare R2 integration. Each feature is a separate module. Don't need OCR? Remove it. Want Stripe instead of Polar? The billing interface is abstracted.

Real-world proof:

This isn't a template I made for GitHub stars. It'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.

How to try it:

Clone the repo, read setup.md to check the prerequisite, run ./setup.sh, and you have a working B2B environment locally in minutes.

Feedback I want:

I'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.

GitHub: https://github.com/moasq/production-saas-starter

Live: https://apflow.co

Comments

miroljub•1h ago
Nice one. Good to learn about polar.sh as a MoR alternative to Paddle.

I would prefer if it had a more leightweight htmx approach, but I guess it would be useful to some people.

moh_quz•1h ago
Totally valid. The Go backend is just a REST API with no Next.js coupling. You could swap the frontend for Go templates + htmx without changing the backend at all. And yeah, Polar.sh has been great. Merchant of Record means I don't think about tax compliance.
sallveburrpi•1h ago
Thanks for sharing!

One question though: What made you avoid lock-in via platforms like supabase but then choose to be locked in on the AuthN/Z side with a proprietary solution?

moh_quz•1h ago
Fair question. The difference for me: Supabase lock-in is deep (their Postgres extensions, auth hooks, edge functions all intertwined).

Stytch lock-in is shallow (just an API behind a ~200 line adapter).

If I swap Stytch for Ory or Auth0, I rewrite one file. The rest of the app doesn't know the difference.

adlpz•1h ago
Cool project! Will surely copy ideas from it :)

A general question for the room: where's the tipping point where you need a "proper" backend, in a different language, with all the inconveniences of possible type safety issues and impedance mismatches?

Because I feel like for 90% of small-medium projects it's just good enough with all the backend stuff within the same Next.js process as the front-end. I just do "separation of concerns"-ish with the code organization and funnel all communication with something structured and type safe like tRPC.

Feels separate enough but very pleasant to work anyway.

Am I doing it wrong?

moh_quz•1h ago
You're not doing it wrong.

For most CRUD apps, Next.js + tRPC is the right call.

My tipping point was long-running tasks (OCR, AI processing that takes 30+ seconds) and wanting to scale backend compute separately from frontend serving.

If you don't have those needs, stick with what you have.

adlpz•1h ago
Thanks for the answer! I've hit those tipping points myself in exactly the same scenarios (OCR and AI). For me, ends up being hacky or just decoupled (independent job runners). Makes sense to have a proper monolith backend for these.

Congrats on the launch again!

moh_quz•1h ago
I really appreciate your comment, never hesitate to reach out to me if you have any concerns, you can find my info in the repo.
icedrift•1h ago
Oh boy another template shipped in a single commit; complete with "For now, do this" and "In production you would do this" comments
moh_quz•1h ago
This was extracted from my production apps including (apflow.co).

I stripped out the business logic and keys, then pushed it as a clean starting point.

The "in production you would" comments are guides for where to add your own config.

Single commit because I didn't want my app's git history in an open source repo.

user20251219•1h ago
Awesome project - thanks for sharing
moh_quz•1h ago
You are more than welcome!

If you need anything don’t hesitate to reach out, you can find my info in the repo

MadsRC•55m ago
This is cool - Whenever I have a new idea for a thing I spend too much time writing boilerplate IAM and backend stuff, taking away time that could be spend on actual business logic. Thought about packaging the boilerplate stuff up before, never gotten around to it. Glad you did!

A thing to consider would be to make it easier (or perhaps bake it in) to separate out parts of the app into a separate origin. Something that would be good for pretty much any SaaS app would be to separate the IAM out (could still embed it with an iframe) - this allows you to keep a fairly tight security policy for the IAM stuff and a more lax one for the rest of the app. Kinda how Google separates out accounts.google.com.

moh_quz•48m ago
Thanks! That's exactly why I open-sourced it. Instead of this living in my private repo getting occasional updates, now the community can push it forward. Improvements flow back to everyone, including me. Win-win.

Your IAM separation idea is interesting. Separate origin for auth would tighten the CSP significantly. The backend is already modular, so spinning the auth service into its own container with a stricter policy is doable. Worth exploring. Would you mind opening an issue on the repo so I don't lose track of this?

rvz•53m ago
Nice project and great idea and a reasonable selection of technologies that optimize for low cost deployment.

However, my biggest concern is the glaringly lack of comprehensive tests whatsoever. I have to even question if this project is production ready at all.

Until that is in place, I really do not think this is "production" quality I'm afraid.

moh_quz•45m ago
Fair point. For what its worth I did add a script that runs tests and checks coverage. But yeah the coverage itself could be better, working on it

PRs welcome if anyone wants to help out

zaphodias•35m ago
This is great - thanks for sharing. I am actually building something very similar myself as I started building a couple SaaS and though it would be nice to extract the common pieces in a template.

My stack is similar, with a few differences:

- Go backend with sqlc, but using ConnectRPC[1]. I chose this as it allows me to define a proper API scheme and generate a decent-quality Typescript client.

- Nuxt (Vue) instead of Next.js (React). I chose this even though I'm new to vue cause I saw the open source components and templates here [2] (especially the dashboard template: [3]) and was convinced.

I'll definitely check out your repo as inspiration.

[1]: https://connectrpc.com/

[2]: https://ui.nuxt.com/

[3]: https://dashboard-template.nuxt.dev/

moh_quz•30m ago
Thanks man, really appreciate it!

ConnectRPC looks interesting actually, proper API schema with generated TS client is nice. And that Nuxt dashboard template is clean, hadnt seen that before.

If you spot anything in the repo or have ideas, feel free to open a PR. Or just reach out directly if you wanna chat about the stack. Always down to learn from someone building similar stuff

leetrout•23m ago
Have you tried Echo instead of Gin? I find it to be much more friendly and approachable with its docs compared to Gin.
moh_quz•19m ago
Tbh not yet, I heard that it’s more user friendly, but I go with gin because it has larger community and support!

Would love to explore different libraries

We built a universal installer for agent skills based on the new open standard

https://github.com/skillcreatorai/Ai-Agent-Skills
1•skillcreator•36s ago•1 comments

An unreasonable book (1976) [pdf]

http://jmc.stanford.edu/artificial-intelligence/reviews/weizenbaum.pdf
1•andsoitis•39s ago•0 comments

Ask HN: Was Google Search just down for a short period for anyone else?

1•exploraz•1m ago•0 comments

Registry You Can Actually Query

https://writethat.blog/reg.html
1•psarna•3m ago•0 comments

Efficient Attention Mechanisms for Large Language Models: A Survey

https://arxiv.org/abs/2507.19595
1•belter•4m ago•0 comments

An integrated view of the structure and function of the human 4D nucleome

https://www.nature.com/articles/s41586-025-09890-3
1•bookofjoe•5m ago•0 comments

YouTube Is Degraded

https://downdetector.co.uk/status/youtube/
5•alphawong•6m ago•0 comments

Timing 'Hello World'

https://antonz.org/timing-hello-world/
1•blenderob•6m ago•0 comments

YouTube Outage [video]

https://www.youtube.com/watch?v=3MG_Dm4kefc
3•vettyvignesh•7m ago•2 comments

It's the Great AGI Rebrand

https://www.theverge.com/ai-artificial-intelligence/845890/ai-companies-rebrand-agi-artificial-ge...
1•sandbach•7m ago•0 comments

Computer Power and Human Reason (1976) [pdf]

http://blogs.evergreen.edu/cpat/files/2013/05/Computer-Power-and-Human-Reason.pdf
1•andsoitis•7m ago•0 comments

JWT Playground for Developers

https://www.devglan.com/online-tools/jwt-decoder-validator
1•only2dhir•8m ago•0 comments

AI Can Write Your Code. It Can't Do Your Job

https://terriblesoftware.org/2025/12/11/ai-can-write-your-code-it-cant-do-your-job/
1•antfarm•9m ago•0 comments

Football Pools

https://en.wikipedia.org/wiki/Football_pools
2•zeristor•11m ago•0 comments

NASA's Webb Observes Exoplanet Whose Composition Defies Explanation

https://science.nasa.gov/missions/webb/nasas-webb-observes-exoplanet-whose-composition-defies-exp...
2•taubek•11m ago•0 comments

Pa Supreme Ct allows non-warranted access to your Google searches

https://reason.com/volokh/2025/12/16/are-there-fourth-amendment-rights-in-google-search-terms/
2•mwexler•12m ago•0 comments

Show HN: Liquid Glass dev and design resources for platforms beyond iOS&macOS

https://www.liquidglassresources.com/
1•andraskindler•12m ago•0 comments

Ask HN: Incorporate in Which Country?

2•finnvyrn•14m ago•1 comments

Carving Nature at Your Joints

https://planktonvalhalla.com/20251219-carving-nature-at-your-joints/
1•mrcgnc•17m ago•0 comments

Chasing Your Tail

https://xania.org/202512/19-tail-call-optimisation
1•hasheddan•18m ago•0 comments

The AI Agents Roadmap Nobody Is Teaching You

https://www.decodingai.com/p/ai-agents-foundations-course
2•pauliusztin•19m ago•1 comments

Sleep Cots and Graham Crackers at Elon Musk's Child Care Program

https://www.nytimes.com/2025/12/18/technology/elon-musk-daycare-school.html
1•reaperducer•21m ago•0 comments

We Put an AI Vending Machine in Our Office. It Gave Away Everything [video]

https://www.youtube.com/watch?v=SpPhm7S9vsQ
1•lordleft•22m ago•0 comments

Show HN: We built a small app with my wife to track promises we do

https://lovechecks.app/
1•warkanlock•22m ago•0 comments

Engineers who dismiss AI

https://terriblesoftware.org/2025/12/19/the-strange-case-of-engineers-who-dismiss-ai/
38•matheusml•25m ago•38 comments

Build a Coding Agent from Scratch

https://thefocus.ai/reports/coding-agent/
1•combray•25m ago•0 comments

Don't stuff beans up your nose

https://en.wikipedia.org/wiki/Wikipedia:Don%27t_stuff_beans_up_your_nose
2•cyanf•26m ago•0 comments

Making a game on a custom bytecode VM in 7 days and 3kB

https://laurent.le-brun.eu/blog/making-a-game-on-a-custom-bytecode-vm-in-7-days-and-3kb
1•laurentlb•27m ago•0 comments

Show HN: Consulting-as-Code – A deterministic, neuro-symbolic agent architecture

https://vuduvations.github.io/Consulting-as-Code/
1•vuduvations•28m ago•1 comments

Pop _OS 24.04's New Scratch-Built Cosmic: Hands-On, with Screenshots

https://fossforce.com/2025/12/pop_os-24-04s-new-scratch-built-cosmic-hands-on-with-screenshots/
2•dxs•29m ago•0 comments