Skip to main content

Build full-stack apps in AI Studio with SSR, Server Functions, REST APIs and Secrets

Learn how to build full-stack apps in ZipLeads AI Studio using server-side rendering, Server Functions, REST APIs and Secrets, then publish them and connect a custom domain.

M
Written by Matt Phillips

Every new AI Studio project uses the TanStack Start architecture. You can build the front end and supported back-end features in the same project, then publish everything through AI Studio's built-in workflow.
​

What you'll learn

New AI Studio projects use TanStack Start and support server-side rendering (SSR), Server Functions, REST APIs and secure Secrets in the same project.

This guide explains how each feature works, when to use Server Functions instead of REST APIs, how to protect credentials, how existing projects are affected, and how to publish a full-stack app.


What are SSR, Server Functions, REST APIs and Secrets in AI Studio?

AI Studio's full-stack architecture takes the builder beyond front-end-only apps. New projects can render pages on the server, run private app logic, expose HTTP endpoints, and store sensitive credentials outside browser code.

These features are built around four parts:

  • Server-Side Rendering (SSR): Creates the page HTML on the server before it's sent to the browser.

  • Server Functions: Run private app logic on the server, while still letting your app's front end call it.

  • REST APIs: Create HTTP endpoints such as /api/... for integrations, webhooks and external apps.

  • Secrets: Store API keys, tokens, webhook secrets and other sensitive values outside client-side code.

Key benefits of AI Studio full-stack projects

Full-stack support lets AI Studio combine the customer-facing interface with the server features that power it. For supported use cases, this means you don't need to maintain separate front-end and back-end projects.

  • Server-rendered content: Deliver meaningful HTML to visitors, search engines and services that create social previews.

  • Private back-end logic: Keep sensitive app logic away from browser code.

  • Secure credentials: Store API keys and tokens as Secrets instead of exposing them in the client bundle.

  • External integrations: Create REST endpoints for webhooks, third-party services and external apps.

  • Unified development: Build the front end and supported back-end features in the same AI Studio project.

  • Integrated publishing: Publish the app and its supported server features from the same workflow.

  • Backward compatibility: Existing Vite/React projects keep working and are not automatically converted.

How the AI Studio full-stack architecture works

Each feature handles a different part of the app. Keeping page rendering, private back-end logic, public HTTP endpoints and protected settings separate makes your project easier to understand and maintain.

Feature

Main purpose

Typical use

SSR

Render pages on the server.

SEO, public pages and social previews.

Server Functions

Run private app logic.

Internal back-end operations and protected integrations.

REST APIs

Expose HTTP endpoints.

Webhooks, integrations and external apps.

Secrets

Protect sensitive settings.

API keys, tokens and credentials.

Server-Side Rendering (SSR)

Server-Side Rendering creates the page HTML on the server before sending it to the visitor. This means search engines, social platforms and browsers can receive page content without relying entirely on client-side JavaScript to build the page.

SSR is especially useful for:

  • Marketing websites and landing pages

  • Multi-page websites

  • Public app pages

  • Pages with unique URLs and metadata

  • Search-focused content

  • Pages shared through services that create link previews
    ​

Server Functions

Server Functions let your app's front end ask for server-side operations without putting the code itself in the browser bundle. They're useful for work that belongs to the app but should stay private.

  • Calling external services with private credentials

  • Loading protected data

  • Validating submitted information

  • Doing server-side calculations

  • Transforming data before returning it to the front end

  • Keeping sensitive app logic off the client

Security tip: Server Functions keep the code on the server, but sensitive credentials should still be stored as Secrets. Only return the information the browser actually needs.

REST APIs

REST API routes create HTTP endpoints that services outside your AI Studio app can call. Routes can use paths such as /api/... and can support methods such as GET or POST, depending on the app.

  • Receiving webhooks

  • Connecting third-party apps

  • Building public or authenticated APIs

  • Accepting information from another service

  • Returning structured data such as JSON
    ​

Secrets

Secrets give you server-side storage for information that shouldn't be in front-end code. This lets server-side features use sensitive values without exposing them in the client bundle.

  • API keys

  • Authentication tokens

  • Webhook signing secrets

  • Integration credentials

  • Private service settings


​

Choosing between Server Functions and REST APIs

Picking the right server interface keeps your app simpler and avoids unnecessary public endpoints. Use Server Functions for private logic called by your app's own front end. Use REST APIs when an outside system needs an HTTP endpoint it can call.

Need

Recommended approach

Front end securely calls its own back-end logic

Server Function

External service sends data into the app

REST API

Third-party system needs an HTTP endpoint

REST API

Internal operation needs a private API key

Server Function + Secret

Webhook provider needs a callback URL

REST API

Sensitive value must stay out of browser code

Secret


New projects vs existing Vite/React projects

AI Studio keeps existing projects as they are, instead of automatically changing their underlying framework. Knowing which architecture your project uses helps you work out which back-end, SEO and migration guidance applies.

All newly created AI Studio projects now use the TanStack Start full-stack architecture by default.

Project type

Behaviour

New AI Studio project

Uses the current TanStack Start full-stack architecture.

Existing Vite/React project

Keeps using its existing architecture.

Existing project that needs the new stack

Needs a separate migration process instead of being automatically converted.

Recommendation: Don't recreate an existing project just because the new architecture is available. First check whether your app actually needs SSR, private server logic, REST endpoints or Secrets.

How to set up and use SSR, Server Functions, REST APIs and Secrets

Start with what your app needs to do before deciding how each feature should be built. Clearly identifying private operations, external integrations and sensitive credentials helps AI Studio put each piece in the right part of the app.
​

Step 1: Create a new AI Studio project

New AI Studio projects use the current full-stack architecture and can combine front-end pages with supported server-side features.

  1. Log in to your ZipLeads account.

  2. Open AI Studio from the left navigation.

  3. Create a new project.

  4. Describe the website or app you want AI Studio to build.

Step 2: Describe the full app behaviour

Describe what the app needs to do, not just how it should look. Mention external services, private credentials, incoming webhooks, protected processing and public API needs where they apply.
​

Example prompt:

Build an order-status portal with a public landing page, a private account lookup that runs on the server, and an API endpoint for receiving order-status webhooks.

Step 3: Add Secrets for protected credentials

Set up Secrets whenever a server feature needs a value that shouldn't be exposed in browser code.

  1. Identify the private credential the integration needs.

  2. Add it through the Secrets workflow when prompted.

  3. Give the Secret a clear, recognisable name.

  4. Only reference the Secret from the server-side feature that needs it.

  5. Test the integration without returning the private credential to the browser.
    ​

Step 4: Build and review Server Functions

Use Server Functions when your app's own front end needs back-end features that should stay private.

  1. Check that sensitive processing runs on the server.

  2. Confirm private credentials are pulled from Secrets.

  3. Only return the information the front end needs.

  4. Test both successful and unsuccessful requests.

  5. Review the generated code if you need extra validation or customisation.
    ​

Step 5: Create REST APIs for external requests

Use a REST API route when another service or app needs to talk to your AI Studio project over HTTP.

  1. Define the endpoint path.

  2. Define the supported HTTP method.

  3. Define the expected request payload.

  4. Add authentication or signature validation if needed.

  5. Process the request on the server.

  6. Return the right response.

Webhook security: If the provider supports it, validate webhook authentication or signatures before processing protected operations.

Step 6: Preview and test the app

Testing both front-end and back-end behaviour before publishing helps you catch problems you can't see from the page design alone.

  • Confirm public pages load correctly.

  • Test Server Functions with expected and unexpected inputs.

  • Test REST endpoints with the intended requests.

  • Confirm Secrets aren't exposed in anything visible in the browser.

  • Check important error states are handled safely.

  • Review page titles, headings and metadata.
    ​

Step 7: Publish the app

Publishing makes your app available at its live AI Studio URL and deploys the supported app runtime.

  1. Click Publish.

  2. Review or update the generated website address.

  3. Confirm publication.

  4. Open the published URL and test the live app.


​

Step 8: Connect a custom domain

After publishing, you can connect a custom domain so visitors reach your app on your own domain instead of the generated project URL.

  1. Open Publish.

  2. Select Add Custom Domain.

  3. Enter the domain you want to use.

  4. If required, add the DNS records AI Studio gives you at your domain provider.

  5. Click Verify DNS.

  6. Wait for certificate provisioning to finish.

  7. Test the app on the connected domain.

You can also connect a custom domain to an AI Studio project from Settings → Domains & URL Redirects → + Connect a domain → AI Studio. The Domain Hub flow walks you through DNS verification first, then lets you pick the AI Studio project to link.


​

SEO considerations for AI Studio projects

How SEO works depends on your project's architecture. New full-stack projects use server-side rendering. Existing Vite/React projects keep their current architecture and the SEO tools that apply to that project type.

Before publishing important public pages, review:

  • Page titles

  • Meta descriptions

  • Heading structure

  • Canonical URLs, where applicable

  • Social preview information

  • Sitemap behaviour, where applicable

  • Rendered content on the live published page


Troubleshooting AI Studio full-stack projects

Full-stack app issues can come from front-end code, server logic, endpoint settings, Secrets, publishing or DNS. Working out which layer is failing makes troubleshooting faster and helps you avoid unnecessary project changes.

Issue

What to check

Server Function fails

Review function inputs, required Secrets, server-side errors and the data returned to the front end.

REST endpoint can't be called

Confirm the endpoint path, HTTP method, that the app is published, the request format and any authentication requirements.

External API authentication fails

Confirm the correct Secret exists and that the server-side code references the intended value.

Webhook requests fail verification

Check the signing Secret, request headers, signature-validation logic and callback URL.

Custom domain doesn't load

Confirm the DNS records exactly match the values AI Studio gave you, and complete Verify DNS after propagation.

Existing project doesn't show the new architecture behaviour

Check whether the project was created with the earlier Vite/React architecture. Existing projects aren't automatically migrated.


Frequently Asked Questions

Q: Do existing AI Studio projects automatically move to TanStack Start?
No. Existing Vite/React projects keep their existing architecture and aren't automatically migrated.
​

Q: What's the difference between a Server Function and a REST API?
Server Functions are mainly used when your app's own front end needs private back-end logic. REST APIs expose HTTP endpoints that external systems or apps can call.
​

Q: Can a Server Function use a Secret?
Yes. This is a common approach when server-side logic needs a private API key, authentication token or other protected credential.
​

Q: Can I create webhook endpoints in AI Studio?
Yes. REST API routes can provide HTTP endpoints that supported webhook providers can call.
​

Q: Should I put a Secret directly in front-end code?
No. Sensitive credentials should stay in Secrets and only be referenced by the server-side features that need them.
​

Q: Does SSR replace the Advanced SEO workflow for older AI Studio projects?
No. Existing projects keep their existing architecture, so the SEO tools for those projects still apply.
​

Q: Can I manually edit generated back-end code?
Yes. The AI Studio Code Editor gives you direct access to your project code for supported manual changes and validation.
​

Q: Can I download my AI Studio project code?
Yes. AI Studio lets you download the project codebase as a ZIP, including supported versions available through Version History.

Did this answer your question?