Blog
How to build a SaaS with AI without getting hacked
Claude Code can help you build a SaaS, but it can't guarantee its security. We cover hosting, permissions, data, privacy, dependencies, and AI access.

Francisco Gaona
Founder and technical lead
With Claude Code, a LinkedIn prompt, and more faith than St. Paul.
You can build a SaaS with Claude Code. Describe the idea and ask for user accounts, subscriptions, an admin panel, and Stripe payments. Claude starts writing code and, before you understand what’s going on, there’s an app running.
You sign up, get the email, pay, and open the dashboard. You can even change your profile photo.
Pretty fucking good.
Then comes the question: is it secure?
That depends. Have you reviewed the code? Is the server configured properly? Do you know what data the API returns? Are customers’ data kept separate? Does Claude have access to production? Do you know where the information you send to AI gets processed?
If not, you’d better have faith. The kind Saint Paul had on the road to Damascus. Maybe light a candle to the Virgin of Macarena before every deployment, too.
A prompt describes what you want; it doesn’t check whether the application does it.
“Comment SECURITY and I’ll send you the prompt”
A video with epic music, someone in front of a screen full of code, and big lettering promising you can launch your own SaaS in a weekend. Then, at the end:
Comment SECURITY and I’ll send you the prompt I use to lock down all my apps.
Sure. Years of architecture, systems, data protection, access control, secrets management, and information security, boiled down to a DM. For free. What a deal.
The prompt usually goes something like this:
Review the entire application for vulnerabilities. Apply security best practices. Make sure the data is protected and the system is impossible to hack.
Claude processes it, changes four files, and replies:
I’ve significantly improved the security of the application.
Great. We can store medical records, credit card numbers, and France’s nuclear launch codes now.
A prompt can help review parts of the code, find bugs, write tests, and flag suspicious settings. It can’t make an application secure by decree.
Security depends on decisions about the code, server, permissions, data, integrations, and how you use AI itself.
Security has more legs than a bench on the Alameda
When we think about security, we usually think about login: hashed passwords, HTTPS, and two-factor authentication. All good things, but they aren’t enough.
You can have the world’s best login and a database open to the internet. You can turn on two-factor authentication and show one customer another customer’s invoice because someone changed a number in the URL. You can review the code three times and still give Claude Code a key with full production access.
Security isn’t a Trello task you mark as done. One weak leg is enough to send the whole bench crashing down.
First leg: where the hell is it hosted?
Your SaaS has to live somewhere: a managed service, a virtual server, a cloud platform, or the cheapest hosting you found because it came with a free domain and three email accounts.
That hosting is part of your security too:
- Who can access the server?
- Is it up to date?
- Does the database accept connections from any address?
- Do you have backups? Have you tried restoring one?
- Are development and production separate?
- Do your logs contain sensitive information?
- Can you spot errors or unusual access?
A backup you’ve never restored is like a parachute you bought on AliExpress. You only find out whether it works when you need it.
Second leg: what data can each person see?
A user signs in and opens this address:
/invoices/1827
Change 1827 to 1828 and another company’s invoice appears.
The login works. The password is hashed. There’s HTTPS and a lovely padlock in the browser. But you’re showing one customer’s data to another because you checked that the user signed in, not that they had permission to view that invoice.
Hiding the button in the interface won’t help. If someone can call the API directly, you can hide the button under the Macarena dance and it still won’t change a thing.
The server must check permissions every time someone tries to read, change, or delete information.
Third leg: the data you don’t show, but still send
Your interface shows this:
Name: Paco
Email: paco@example.com
But the API returns this:
{
"id": 42,
"name": "Paco",
"email": "paco@example.com",
"role": "admin",
"internal_notes": "Difficult customer",
"password_reset_token": "this-should-not-be-here"
}
If the API sends that data to the browser, it’s exposed even if the interface doesn’t show it. To get Claude to return only what’s needed, you have to define the data and review the API responses.
Fourth leg: Claude Code’s access
Claude Code needs some permissions to work. It can read files, write code, run commands, install dependencies, and connect to external tools.
That works fine until, to save time, you give it access to production environment variables, the customer database, Stripe keys, your email provider, the server control panel, backups, or an MCP server that can do just about anything.
At that point, it’s more than an assistant writing code. It’s a process that can touch real systems.
Maybe it asked before running the command. But after clicking “Allow” eight times in a row, people start accepting prompts with the same attention they give the terms of service for an air fryer.
Claude should have only the permissions it needs. Keep development separate from production, limit credentials, and review sensitive actions. Don’t scatter secrets around the repository like holy cards.
AI can help you work faster. You don’t need to hand it the keys to the business, the garage door opener, and a copy of your ID.
Fifth leg: privacy
Your SaaS handles documents, contracts, invoices, conversations, or personal data. Then you add a button that says:
Analyze with AI
Very modern. Before you add it, ask:
- What information gets sent, and to which provider?
- Where is it processed, and how long is it kept?
- Can it be used to improve models?
- Do customers know their data leaves the application?
- Can you delete that information?
- Are you sending the whole document when you only need three fields?
Claude can write the integration in a few minutes. That doesn’t settle how the data is handled. The API call is easy; deciding what information the system needs, who can use it, and what happens afterward takes more work.
Sixth leg: dependencies you install without looking
Claude needs to solve a problem, finds a package that looks right, installs it, and, if it works, everyone’s happy.
But who maintains that package? When was it last updated? What permissions does it need? What other twenty dependencies does it install? Does it run a script during installation?
You don’t have to inspect every line of every library yourself, or install anything you find online and say three Hail Marys before deploying. Dependencies are part of the product. If one has a problem, the fact that AI wrote the code doesn’t protect you.
So, can I build a SaaS with Claude Code?
Yes. It can help a lot. Claude Code can create a first version, write tests, review permissions, suggest validations, analyze dependencies, find suspicious code, prepare configurations, document decisions, and help investigate an incident.
It can help with security work, but someone has to take responsibility for the whole system.
You can ask it to review your app ten times, use the LinkedIn prompt, type SECURITY in all caps, follow the account, share the post, and tag two friends. Someone still needs to understand the server, database, users, permissions, backups, integrations, and privacy, and what happens when something fails.
How we use AI
At Gaobaltech, we use AI to speed up development, but we don’t ask it to “make us a secure SaaS.” That sentence doesn’t define permissions, data, or controls.
We design permissions and separate environments. We limit access and review what data goes in and out, what each user can see, and what happens if an integration fails.
Security comes from those decisions and from maintaining the system.
Dealing with something similar?
Tell us what you want to build, fix, or decide. We will tell you what makes sense and what would be a waste of time.
Talk about your projectYou may also find useful
Artificial intelligence / Security and compliance / Software / Architecture
MCP connects AI to your app. Easy, right?
Read articleArtificial intelligence / Business and product / Software
AI is going to kill us all
Read articleArtificial intelligence / Business and product / Software