# Security & data ownership

> Understand who owns your code and customer data, how secrets stay server-side, and how ExaSpark isolates Preview from Live production.

- Canonical: https://exaspark.ai/docs/security-and-ownership/

## You own your code, assets, and customer data

Building on an integrated platform should never mean surrendering ownership of your business. On ExaSpark, **you retain ownership** of the application source code you build, the brand visuals and media assets you upload or generate, and the customer records stored in your app's database.

- **Readable source code anytime.** Open the **Code** tab at any point to inspect generated frontend screens, backend API routes, database definitions, and configuration files directly.
- **Portable GitHub exports.** Connect the **Official GitHub App** to export your codebase directly into repositories you own. You choose the exact repositories authorized, and you can revoke GitHub App access inside GitHub settings at any moment. See [Code & GitHub App](https://exaspark.ai/docs/code-and-github/).
- **Exportable customer data.** Your users, orders, and business records belong to you, and Stripe customer and payout records live directly inside your own Stripe account.

## Security architecture at a glance

ExaSpark enforces strict separation across credentials, environments, payments, and user permissions by default so founders do not have to assemble basic security infrastructure from scratch.

| Security layer | How ExaSpark protects it | Boundary guarantee |
| --- | --- | --- |
| **Secrets & API keys** | Stored as server-side encrypted project configuration | Secret keys are never bundled into browser JavaScript |
| **Payment card data** | Handled via Stripe-hosted Checkout and Stripe billing portals | Card numbers never touch ExaSpark servers or your app database |
| **Authentication & RBAC** | Managed sign-in (19+ providers) with server-validated sessions | Role permissions enforce on API endpoints, not just hidden buttons |
| **Preview vs Live isolation** | Independent databases, user pools, storage scopes, and Stripe modes | Preview testing cannot read, alter, or delete Live customer records |
| **Encryption in transit** | Automatic HTTPS/TLS certificates on `.exaspark.app` and custom domains | Visitor sessions and form submissions stay encrypted end to end |
| **GitHub App permissions** | Repository-scoped **Official GitHub App** authorization | No broad personal access tokens or org-wide keys required |

## Server-side secrets and payment isolation

Separating public browser code from private server credentials is one of the most important rules in web application security.

### Keeping secrets out of browser bundles

Anything shipped to a visitor's web browser can be inspected in browser developer tools. ExaSpark separates public client configuration (such as a Stripe publishable key or public brand URL) from private server credentials (such as Stripe secret keys, webhook signing secrets, email provider credentials, and third-party API secrets).

Private keys remain strictly on the server side where API routes and webhook handlers execute, preventing accidental credential leaks in compiled frontend assets.

### Zero stored payment card numbers

Both your own ExaSpark subscription payments and customer checkouts inside the apps you publish process directly through Stripe. Sensitive payment card details stay inside Stripe's PCI-compliant payment infrastructure and never pass through your database tables. See [Payments with Stripe](https://exaspark.ai/docs/payments/).

## Preview vs Live isolation and server-side RBAC

Two everyday safeguards prevent the majority of real-world startup security incidents: strict environment separation and real server-side authorization.

### Why Preview vs Live separation matters

Experimenting against production data is a recipe for accidental deletions and leaked test emails. On ExaSpark, **Preview** and **Live** run completely separate databases, user directories, uploaded file buckets, and Stripe **Test mode** vs **Live mode** settings.

You can test destructive admin actions, delete test accounts, or refactor database columns freely in **Preview** while **Live** customer accounts remain untouched until you explicitly click **Publish**. See [Preview vs Live](https://exaspark.ai/docs/preview-vs-live/).

### Server-side role enforcement

Hiding an "Admin" button in navigation menus improves usability, not security — anyone can still call a backend URL directly if the server does not check who is asking.

When you specify member, staff, or admin roles in ExaSpark, access checks execute server-side on every protected read, write, and private file request. Unauthorized requests receive `401` or `403` responses regardless of what a browser sends. See [Authentication & roles](https://exaspark.ai/docs/authentication-and-roles/).

## Shared responsibility: building secure apps

Platform controls protect the runtime foundation, while your app's business rules determine which users should see which records. Follow five straightforward practices before launching any app with user accounts or private uploads:

- **State access rules explicitly in prompts.** Tell the Agent exactly who owns each record — for example, "Customers can only view and cancel their own bookings; only admins can list all bookings or export rosters."
- **Scope uploaded files intentionally.** Keep public catalog photos readable by visitors, while restricting resumes, invoices, IDs, or private client uploads to the uploader and admins. See [File storage](https://exaspark.ai/docs/file-storage/).
- **Never paste private secrets into public surfaces.** Do not embed secret API keys inside page copy, client prompts meant for static display, screenshots shared with clients, or public GitHub READMEs.
- **Test as a non-admin before Publish.** Create a standard member account and confirm it cannot open admin dashboards, view another customer's order ID, or download someone else's files.
- **Publish accurate legal policies.** Keep your app's Privacy Policy, Terms of Service, and refund or contact details live and matched to how your business handles customer data.

Run a dedicated security review prompt in **Preview** right before launching a new user-facing feature:

> **Example prompt (App):** Audit all backend API routes and file-storage rules in this project. Verify that every mutation and private read checks the authenticated user's session and role server-side, ensure standard members can only access records matching their own user_id, validate required input fields cleanly, and confirm no secret keys are referenced in client code.

## Legal policies and vulnerability reporting

Review our platform-wide legal and security commitments anytime:

- **Platform security overview:** [Security](https://exaspark.ai/security/)
- **Privacy practices:** [Privacy Policy](https://exaspark.ai/privacy/)
- **Platform terms:** [Terms of Service](https://exaspark.ai/terms/)

If you discover a potential security issue affecting ExaSpark itself, report it responsibly to **security@exaspark.ai** with reproduction details so our team can investigate promptly.

## Next steps

- [Authentication & roles](https://exaspark.ai/docs/authentication-and-roles/) — Configure 19+ sign-in providers and server-side RBAC rules.
- [Preview vs Live](https://exaspark.ai/docs/preview-vs-live/) — Keep test accounts, edits, and Stripe Test mode safely separated.
- [Production launch checklist](https://exaspark.ai/docs/production-checklist/) — Run the full 12-item security and readiness check before launch.

## From the blog

- [App security checklist](https://exaspark.ai/blog/app-security-checklist/) — Practical security habits for every AI-built web app.
- [ExaSpark for companies](https://exaspark.ai/blog/exaspark-for-companies/) — Ship internal and customer apps with clean access boundaries.
- [What is ExaSpark?](https://exaspark.ai/blog/what-is-exaspark/) — How ExaSpark unites building, cloud, payments, and launch.
