Ask HN: How to build site with payment, subscriptions, user login, registration
I built a working concept that helps to design user interfaces and convert it into an interactive user interface. I am 11 years experinced software engineer in frontend engineering and design. When it comes to putting my tool on a site to gain customers, my head is breaking because i do not know backend.
I have wordpress on a domain, thinking that it will help me reach there, but im getting into panic.
I don't know how to add user login, registration, subscription, paid subscription, landing pages, product pages.
How do you do? Or how have you done it?
70 comments
[ 244 ms ] story [ 2894 ms ] threadIt is amazing though.
Has most of the things you mentioned right away, and if you need payments Laravel Cashier makes it easy as well.
I used the software for a few projects for myself, customers and employers. It was open source, but the industry couldn't give a damn, turned out the missing feature was "depends on a third party auth service that is someday going to get acquired and shut down". Auth frameworks like that proliferated like mushrooms after the rain around 2013 and all of a sudden people were interested.
(Oddly back then I was looking at various "API management" products that a number of "want-to-have" features but that all lacked the one feature you needed to make a business, which was integration with a payment gateway.)
I think the basic advice in 2024 is the same as it was in 2000 which is store user records in a relational or document database, encrypt your passwords like an OS does, use signed cookies for authentication (ignore the anti-JWT splogs that a certain vendor funds), etc. I think today it would not be unreasonable to take a "microservice" kind of approach where auth is handled by some self-contained system through an API but practically you might want to be able to join stuff against your user table.
However, a lot of the complexity of a good auth system is tied up to the UX for both the visitors and administrators. I've seen onboarding completion rates increase from 22% to 85% as a result of improving each and every step. Administrators deserve a great interface for managing users. Even if a "microservice" had a good internal API so much of quality, security and all that depend on the UI the system exposes and I think that is just as important to reuse as the inner logic.
One option for writing less code yourself might be using something like Auth0 (cloud) or Keycloak (self-hosted) with some OpenID Connect library for your tech stack, or a Relying Party implementation altogether, like: https://github.com/OpenIDC/mod_auth_openidc
They'll get you most of the way there, without making you write a bunch of security related code yourself (which is also more likely to cause issues, if someone isn't familiar with the domain).
This should be hash not encrypt:
“Securely hash your passwords like an OS does”
I would recommend using something like bcrypt with strong parameters.
In 2000 I had been watching Yahoo buy up lots of internet properties and… integrate them with their auth system. I had a vision that you could pick “best of breed” open source and other software, plug it into your auth system and make your own “portal” web site. I had some success developing sites this way but it never caught on and I still don’t understand why.
[1] https://saasbold.com
[1] https://www.saaspegasus.com
[2] https://devdojo.com/pines
Personally I'm using Ruby on Rails which has a lot of plugins to get up and running quickly with payments and user management. The equivalent there would be: https://jumpstartrails.com
You say you don't know how to do all that, so you're probably looking for a "SaaS boilerplate" for a web framework you feel comfortable with. There are many good paid and free boilerplates available.
Yes, you can build all of this yourself, but it will take several months or years at the point you're at now.
I'm a bit ahead of you, but I'm going through this now and it turns out that understanding all of this "extraneous" stuff is taking way more time than it took to code up the core functionality (purpose of the app).
First you choose a frontend (and often backend) framework to actually build the pages, like Next.js, Svelte, Laravel, etc.
Then, you can choose an auth solution like Clerk, auth0, NextAuth, Supabase, etc. Most of these products work with a wide variety of frameworks. Some of the frameworks (like Laravel) also have an auth framework built in.
For payments, you technically have choices but I would just use stripe.
For these types of projects (in a validation state) I recommend using Stripe subscriptions, they have incredible low code tools that will handle all the heavy stuff. You'll save a lot of time.
Disclaimer. I run my own software studio.
It'd be usefull for your marketing pages, blog and product updates, but not so much for your application logic.
There's lots of tutorials on how to get started with them, it will be a lot of information to start.
If you really want to learn about the core themes each of these has:
* User authentication - Login / Registration
* User authorization - Is this user allowed to do x, y or z?
* Database connectivity and query management (usually done via ORM) which handles where your data goes to, and comes from.
* Template engine (which you can replace if you rather an API, but I recommend for starting out, to just make a boring web app)
* User management
As for payment / subscriptions, these are not included OOTB, but if you can get through the basics of any of these frameworks, I don't think you'll struggle too much to work out third party libraries that add what you need to these frameworks.
I started out my first web project with a micro web framework, but I had some experience in programming in general and used it and it worked out, I started with CherryPy. Basic "Hello" page, and gradually added pieces as I needed to add them, like database, template engine and so on. I now just use Django or ASP .NET depending on what I'm doing.
Django is regarded as the framework for people with deadlines, but it might not be for you, maybe Rails or ASP are more for you.
My recommendation is pull up a list of web frameworks that meet most of your needs, and go from there.
You could also look into ecommerce frameworks as well. Though I cannot personally speak to these. Laravel I'm sure has a few options for Ecommerce. You might want to go with Laravel if you want to host with PHP.
https://github.com/iceburgcrm/iceburgsaas
Here is the frontend: iceburgcrm.com
Based on Laravel/Breeze
Or you can use a starter kit https://github.com/thedevdojo/wave
I would then use the Litestack gem: https://github.com/oldmoe/litestack + SQLite to get your DB/Cache/Job Queue working, deploy with Kamal, behind Cloudflare on a $5 Hetzner VM.
I go from idea to live app in an afternoon with this stack. I haven't gotten around to it yet, but moving all my apps to essentially free analytics dashboard/visibility with https://github.com/benvinegar/counterscale, Free APM with ScoutAPM.
If anything is ever successful, scaling is super easy. Pay for a beefier Hetzner instance, and/or start to move your DB/Cache/Job Queue off of the litestack defaults with a single LOC. Move to AWS services because those are web scale or something.
I love this stack. It prioritizes getting shit done. Feel free to email me if you have questions.