# Deploy T3 Stack App to Production Without Manual Setup

> Deploy T3 Stack app in 2026 with GitHub, Prisma, env vars, NextAuth, tRPC, SSL, CI/CD, production migrations, logs, no Docker, and Kuberns agentic AI.
- **Author**: omkar-anbhule
- **Published**: 2026-05-02
- **Modified**: 2026-09-12
- **Category**: Deployment Guides
- **URL**: https://kuberns.com/blogs/deploy-t3-stack-app/

---

Deploying a T3 Stack app to production means shipping a full-stack TypeScript application, not just uploading static files. A typical T3 app combines Next.js, tRPC, Prisma, Tailwind CSS, and authentication from the [`create-t3-app`](https://create.t3.gg/) starter. Before it works in production, the app needs a database URL, generated Prisma Client, validated environment variables, OAuth callback URLs, and a reliable Node.js runtime.

The easiest path is to connect your GitHub repo, add the required secure environment variables, and let the deployment platform build and run the app. Kuberns supports this flow with agentic AI for deployment, so the platform can read your project, prepare the Next.js build, keep logs in one dashboard, enable HTTPS, and redeploy from GitHub without asking you to write Docker or server configuration.

This guide focuses on what actually breaks during T3 deployment: `SKIP_ENV_VALIDATION`, `DATABASE_URL`, Prisma migrations, NextAuth/Auth.js production URLs, OAuth callbacks, `create-t3-app` folder structure, and the difference between Vercel-style deployment and a full-stack runtime on Kuberns.

## Quick Answer: How Do You Deploy a T3 Stack App?

To deploy a T3 Stack app, push the project to GitHub, add your production environment variables, generate Prisma Client during install, run production migrations with `prisma migrate deploy`, set your auth production URL, and deploy the Next.js app on a host that supports your backend runtime needs. On Kuberns, you connect the repo, add secure env vars, and click Deploy. Kuberns handles the build workflow, SSL, logs, CI/CD, and deployment history from one dashboard.

## T3 Stack Deployment Checklist

| Requirement | Why it matters in production |
|---|---|
| `DATABASE_URL` | Gives Prisma the database connection used by the app at runtime |
| `DIRECT_URL` | Lets Prisma run migrations through a direct database connection when needed |
| `NEXTAUTH_URL` or auth production URL | Keeps OAuth redirects and session callbacks pointed at the live app |
| `NEXTAUTH_SECRET` or auth secret | Signs sessions securely in production |
| `SKIP_ENV_VALIDATION=1` | Prevents build-time failures when secrets are injected by the deployment platform |
| `postinstall: prisma generate` | Ensures Prisma Client exists before the Next.js server starts |
| `prisma migrate deploy` | Applies committed production migrations safely |
| GitHub repository access | Lets the deployment platform build and redeploy from the connected branch |

## TL;DR

* A T3 Stack app is usually a full-stack Next.js app with tRPC, Prisma, Tailwind CSS, and authentication.
* Key pre-deploy steps: set `SKIP_ENV_VALIDATION=1`, add `prisma generate` to `postinstall`, and configure `NEXTAUTH_URL` and `NEXTAUTH_SECRET`.
* On Kuberns, connect your GitHub repo, add env vars, and click Deploy. Agentic AI for deployment handles the build workflow, Prisma generation, SSL, CI/CD, logs, and deployment history.
* No Dockerfile, no YAML, no SSH required.

## Prerequisites: Prepare Your T3 App for Production

These steps take less than ten minutes and prevent the most common T3 deployment failures.

### 1. Confirm Your `package.json` Scripts

Kuberns reads your `scripts` block to determine the build and start commands. A standard T3 app from `create-t3-app` usually has the right scripts, but verify they look like this:

```json
{
  "scripts": {
    "build": "next build",
    "start": "next start",
    "dev": "next dev",
    "db:push": "prisma db push",
    "db:migrate": "prisma migrate deploy",
    "postinstall": "prisma generate"
  },
  "engines": {
    "node": ">=20.0.0"
  }
}
```

The `postinstall` script runs `prisma generate` automatically after `npm install`, which means Prisma Client is always generated before your app starts. This is critical: without it, your tRPC procedures that call Prisma will fail with a "PrismaClient is not generated" error.

### 2. Configure T3 Environment Validation for Production

The T3 Stack uses `@t3-oss/env-nextjs` for type-safe environment variable validation. By default, this runs at build time and will throw if any required variables are missing.

If your build environment does not contain every production secret during `next build`, configure validation to skip only when the deployment environment sets `SKIP_ENV_VALIDATION=1`. Open your `env.js` or `env.ts` file and check the `skipValidation` option:

```js
export const env = createEnv({
  // ...
  skipValidation: !!process.env.SKIP_ENV_VALIDATION,
  // ...
});
```

Then add `SKIP_ENV_VALIDATION=1` as an environment variable in the Kuberns dashboard. This avoids build-time failures from missing deployment-only secrets while keeping your schema explicit in code.

### 3. Configure Prisma for Production

Make sure your `schema.prisma` uses an environment variable for the database URL and sets the correct provider:

```prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}
```

For managed PostgreSQL databases like Supabase or Neon, add the connection pool URL as your `DATABASE_URL` and the direct URL as `DIRECT_URL`:

```prisma
datasource db {
  provider  = "postgresql"
  url       = env("DATABASE_URL")
  directUrl = env("DIRECT_URL")
}
```

Use the direct URL for migrations and the pooled URL for runtime queries.

### 4. Set Your Auth Production URL

[NextAuth.js requires](https://next-auth.js.org/configuration/options#nextauth_url) `NEXTAUTH_URL` to be set to the exact URL of your production app, including the protocol. If your project uses Auth.js naming instead, set the equivalent production URL required by your auth version. When you deploy to Kuberns, use the live HTTPS URL or your custom domain.

For OAuth providers, you also need to update your callback URLs in the provider dashboard (Google Cloud Console, Discord Developer Portal, GitHub OAuth Apps, etc.) to include your Kuberns deployment URL.

### 5. Push Your Code to GitHub

Kuberns deploys directly from your repository:

```bash
git add .
git commit -m "Prepare T3 app for production"
git push origin main
```

That is the core prerequisite list. No Dockerfile, YAML config, or CLI deployment tool is required for the Kuberns path.

> If your T3 app has heavier tRPC procedures, background work, uploads, AI API calls, or WebSocket behavior, check the runtime limits of your chosen host before launch. Kuberns is designed for full-stack app deployment where the Next.js app, backend behavior, logs, SSL, and CI/CD belong in one platform.

## How to Deploy a T3 Stack App on Kuberns (Step by Step)

[Kuberns](https://kuberns.com/) is an Agentic AI platform for deployment built on AWS. It can detect Next.js from your `package.json`, install dependencies, run `prisma generate` through your `postinstall` script, run `next build`, start your app with `next start`, enable SSL, and keep CI/CD logs in one dashboard. For adjacent stack planning, see our [AI software development guide](https://kuberns.com/blogs/ai-based-software-development/).

### Step 1: Create Your Kuberns Account

![Kuberns homepage showing Agentic AI deployment platform](https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/kuberns-home-page-new.png)

Go to [kuberns.com](https://kuberns.com/) and click **Deploy for Free**. Create your account and verify your phone number.

Start with the Trial Option or choose a paid plan. Kuberns paid plans start at $7, and bundle packs are available for teams that want additional savings. [See all pricing tiers here](https://kuberns.com/pricing).

### Step 2: Connect Your GitHub Repository

![Connect GitHub to Kuberns](https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/kuberns-registration.png)

On the **Creating a Service** page, connect your GitHub account and select the repository that contains your T3 app.

- Click **Connect and Configure** and authorize Kuberns access to your repositories
- Select your repository and the branch you want to deploy (typically `main`)

Kuberns scans your project, detects Next.js from your `package.json`, and identifies the build and start scripts automatically.

> For common T3 projects, you usually do not need to specify a build command, start command, Dockerfile, or runtime configuration. The agentic AI reads your repository and prepares the deployment pipeline from the project files.

### Step 3: Add Environment Variables

![Environment variables on Kuberns](https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/environment-variable-kuberns.png)

Before clicking Deploy, navigate to the **Environment** section and add your app secrets.

Click **Add Env Vars** to add key-value pairs manually, or click **Upload .env file** to import all variables at once from your local `.env`.

For a standard T3 app, add these variables:

| Variable | Description |
|---|---|
| `DATABASE_URL` | Your PostgreSQL connection string (pooled URL for Supabase/Neon) |
| `DIRECT_URL` | Direct connection URL (only needed for Supabase/Neon with Prisma) |
| `NEXTAUTH_SECRET` | A long random string for signing sessions (generate with `openssl rand -base64 32`) |
| `NEXTAUTH_URL` | Your production HTTPS URL (you will get this after the first deploy) |
| `SKIP_ENV_VALIDATION` | Set to `1` to skip build-time env validation |
| `NODE_ENV` | Set to `production` |

For OAuth providers, also add:

| Variable | Description |
|---|---|
| `DISCORD_CLIENT_ID` | Your Discord OAuth app client ID |
| `DISCORD_CLIENT_SECRET` | Your Discord OAuth app client secret |
| `GOOGLE_CLIENT_ID` | Your Google OAuth client ID |
| `GOOGLE_CLIENT_SECRET` | Your Google OAuth client secret |

Keep secrets out of source control. Add only the values your app needs, and avoid printing secrets from custom scripts during build or startup.

### Step 4: Click Deploy

![Kuberns deploying app](https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/kuberns-ai-deploying.png)

Click **Deploy**. Kuberns agentic AI takes over:

- Clones your repository from GitHub
- Runs `npm install` which also triggers `prisma generate` via your `postinstall` script
- Runs `next build` to compile your T3 app
- Starts your app with `next start` as a persistent Node.js process
- Provisions AWS compute in your chosen region
- Issues an SSL certificate and assigns a live HTTPS URL
- Enables monitoring, logging, and scaling controls
- Sets up CI/CD so every future push to the connected branch triggers an automatic redeploy

### Step 5: Your T3 App is Live

![Kuberns deployment dashboard](https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/deployed-dashboard.png)

Your T3 app is live with a verified HTTPS URL after the deployment finishes. From the Kuberns dashboard you can:

- Open your deployed URL and test authentication, tRPC queries, and database calls
- View live usage stats and resource consumption
- Check real-time build logs and deployment history
- Update environment variables without redeploying
- Monitor usage and scaling metrics

Once you have your Kuberns URL, go back and set `NEXTAUTH_URL` to that URL in your environment variables, and update the OAuth callback URLs in your provider dashboards.

## Running Prisma Migrations on Deploy

Prisma migrations in production should use `prisma migrate deploy`, not `prisma db push`. The `db push` command is for development only and can cause data loss on a production database.

The cleanest way to run migrations automatically on every deploy is to add them to your start script in `package.json`:

```json
{
  "scripts": {
    "start": "prisma migrate deploy && next start"
  }
}
```

This runs any pending migrations before Next.js starts accepting traffic on each deploy. If a migration fails, the app does not start and the previous version stays live.

For more complex migration strategies (blue-green deployments, rollback plans), you can also run migrations manually from your local machine against the production `DATABASE_URL` before pushing a new deploy.

## Connecting a Database to Your T3 App

The T3 Stack uses Prisma, which works with any PostgreSQL-compatible database. Here are the options that pair well with Kuberns:

| Database | Best for | Connection string format |
|---|---|---|
| **Supabase** | Teams who want a managed Postgres with a dashboard and auth | `postgresql://postgres:[password]@db.[project].supabase.co:5432/postgres` |
| **Neon** | Serverless Postgres with fast cold starts and branching | `postgresql://[user]:[password]@[endpoint].neon.tech/[db]?sslmode=require` |
| **PlanetScale** | MySQL-compatible serverless DB (note: no foreign keys) | `mysql://[user]:[password]@[host]/[db]?sslaccept=strict` |
| **Railway Postgres** | Simple managed Postgres, easy to spin up | `postgresql://[user]:[pass]@[host]:[port]/[db]` |
| **AWS RDS** | Production-grade Postgres on the same AWS infrastructure as Kuberns | Standard PostgreSQL connection string |

For Supabase and Neon, use the connection pooler URL as `DATABASE_URL` and the direct URL as `DIRECT_URL` in your Prisma schema. This prevents connection exhaustion from Prisma creating too many direct connections.

## Configuring NextAuth.js for Production

NextAuth.js requires three things to work correctly in production:

### 1. NEXTAUTH_SECRET
Generate a secure random secret and add it to Kuberns:

```bash
openssl rand -base64 32
```

Without this, NextAuth throws a `[next-auth][error][NO_SECRET]` error and authentication breaks entirely.

### 2. NEXTAUTH_URL
Set this to your exact production URL including the protocol:

```
NEXTAUTH_URL=https://your-app.kuberns.app
```

Or your custom domain if you have one configured in Kuberns:

```
NEXTAUTH_URL=https://yourdomain.com
```

### 3. OAuth Provider Callback URLs
For every OAuth provider you use, add the callback URL to that provider's dashboard. The format is:

```
https://your-production-url/api/auth/callback/[provider]
```

For example:
- Discord: `https://your-app.kuberns.app/api/auth/callback/discord`
- Google: `https://your-app.kuberns.app/api/auth/callback/google`
- GitHub: `https://your-app.kuberns.app/api/auth/callback/github`

If these are not updated, OAuth sign-in will redirect back to localhost or fail with a redirect URI mismatch error.

## What Kuberns Handles That You Do Manually on Other Platforms

| What a T3 app needs in production | Manual / VPS | Kuberns |
|---|---|---|
| Next.js build step | Configure CI manually | Detected and run automatically |
| Prisma Client generation | Add postinstall script | Runs automatically via npm install |
| Process manager | PM2 or systemd setup | Managed by the platform |
| Reverse proxy (Nginx) | Manual config | Not required |
| SSL certificate | Certbot setup and renewal | Automatic |
| Environment variable injection | Server env files | Encrypted in dashboard |
| Scaling | Manual rules | Managed from the dashboard |
| CI/CD pipeline | GitHub Actions YAML | Built-in, triggers on Git push |
| Custom domain + HTTPS | DNS + Certbot | One-click in dashboard |
| Database migration on deploy | Run manually on server | Automate via start script |

## Conclusion

Deploying a T3 Stack app in 2026 does not have to involve Dockerfiles, Nginx configs, PM2 process managers, or manual SSL setup. The T3 Stack gives you a production-ready TypeScript full-stack foundation: Next.js, tRPC, Prisma, and NextAuth. Kuberns helps you move that stack from GitHub to production without turning deployment into a separate DevOps project.

The key things to get right before deploying: add `SKIP_ENV_VALIDATION=1` when your build environment does not contain every production secret, ensure `prisma generate` runs via `postinstall`, set your auth production URL and secret, and use `prisma migrate deploy` for production migrations. Once those are in place, connect your GitHub repository on Kuberns, add your environment variables, and click Deploy.

[Deploy with Agentic AI on Kuberns](https://dashboard.kuberns.com)

<a href="https://dashboard.kuberns.com" target="_blank" rel="noopener noreferrer">
  <img src="https://kuberns-blogs-media.s3.ap-south-1.amazonaws.com/CTA_banner.png" alt="Start deploying on Kuberns" style={{ width: "100%", height: "auto" }} />
</a>

## Frequently Asked Questions

### Do I need a Dockerfile to deploy a T3 app on Kuberns?
No. Kuberns detects Next.js automatically from your `package.json` and handles the runtime environment internally. You push code from GitHub and the app deploys. No Dockerfile, no YAML, no configuration files.

### Why does my T3 app build fail with an environment variable error?
The T3 Stack validates environment variables at build time using [`@t3-oss/env-nextjs`](https://env.t3.gg/docs/introduction). Since Kuberns injects variables at runtime rather than embedding them in the build, you need to add `SKIP_ENV_VALIDATION=1` as an environment variable in the Kuberns dashboard. This skips build-time validation while still enforcing types at runtime. If your `env.js` extends the Vercel preset from `@t3-oss/env-core/presets-zod`, that preset is Vercel-specific and unnecessary on Kuberns. It can stay in your code without effect, but it does not replace `SKIP_ENV_VALIDATION`.

### How do I update my NEXTAUTH_URL after the first deploy?
After your first deploy, Kuberns assigns a live HTTPS URL to your app. Go to the Kuberns dashboard, copy the URL, then navigate to the Environment tab and add `NEXTAUTH_URL` with that value. Trigger a redeploy for the change to take effect. If you set up a custom domain later, update `NEXTAUTH_URL` again to match.

### Can I use tRPC subscriptions on Kuberns?
Yes. Kuberns runs your T3 app as a persistent Node.js server which supports WebSocket connections. tRPC subscriptions over WebSockets work without any extra configuration.

### How do I add a custom domain to my T3 app on Kuberns?
In the Kuberns dashboard, go to Domains, add your domain, and update your DNS A record to point to the Kuberns IP. Kuberns issues and renews the SSL certificate automatically. After adding your domain, update `NEXTAUTH_URL` to your custom domain and update the callback URLs in your OAuth provider dashboards.

### Is Kuberns better than Vercel for T3 apps?
Vercel is a common default for T3 apps because the stack is built on Next.js. Kuberns is a stronger fit when your T3 project needs one workflow for the Next.js app, tRPC APIs, Prisma, production environment variables, deployment logs, SSL, CI/CD, and backend runtime support. See the [Vercel vs Kuberns comparison](https://kuberns.com/blogs/vercel-vs-aws-kuberns/) for a detailed breakdown.

### What database should I use with a T3 app on Kuberns?
Supabase and Neon are the two most popular choices. Both offer managed PostgreSQL with a generous free tier, Prisma-compatible connection strings, and SSL. Use the connection pooler URL as `DATABASE_URL` and the direct URL as `DIRECT_URL` in your Prisma schema to avoid connection exhaustion in production.

### Does create-t3-app use a src directory by default?

No. By default, `create-t3-app` places your source files in the root directory: `pages/` or `app/` for Next.js routes, `server/` for tRPC routers and Prisma, and `styles/` for CSS. The CLI offers an optional `src` directory layout when you run it interactively. If you answer yes to the src directory prompt, all source files move into `src/`. Most T3 projects and community examples use the root layout without `src/`.

### What does SKIP_ENV_VALIDATION do in a T3 app?

`SKIP_ENV_VALIDATION=1` tells the `@t3-oss/env-nextjs` package to skip type-safe environment variable validation at build time. This is necessary when deploying to platforms like Kuberns where environment variables are injected at runtime rather than embedded in the build. Without this flag, `next build` will throw an error if any required env vars are missing. Runtime validation still runs when your server starts, so type safety is preserved in production.

### Is create-t3-app the same as the T3 Stack?

`create-t3-app` is the starter CLI used to scaffold a T3 Stack project. The T3 Stack is the application architecture, usually Next.js, TypeScript, tRPC, Prisma or Drizzle, Tailwind CSS, and authentication. In practice, most developers start a T3 Stack project by running `npm create t3-app@latest my-app`.

### What is the latest create-t3-app CLI command in 2026?

The latest command to scaffold a T3 app in 2026 is:

```bash
npm create t3-app@latest my-app
```

This runs the interactive CLI, where you can choose TypeScript, tRPC, Tailwind CSS, Prisma or Drizzle ORM, NextAuth.js or Clerk, and App Router options. For non-interactive setup, check the current [`create-t3-app` documentation](https://create.t3.gg/) before using flags because CLI options can change.

---
- [More Deployment Guides articles](https://kuberns.com/blogs/category/deployment-guides/1/)
- [All articles](https://kuberns.com/blogs/)