> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scriptonia.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Web-application-platform

> Full-stack web apps: dashboards, SaaS, internal tools, and apps with auth and a database.

## Web App Platform Overview

The **Web Application** platform produces a blueprint for **dynamic, full-stack web apps** with a frontend, backend API, database, auth, infra, and tests. It has the most agents and artifacts of any Scriptonia platform.

* **Agents:** ProductManager, FrontendDev, BackendDev, DevOpsEngineer, ToolManager
* **Execution:** \~75 s
* **Cost:** Same as other platforms (unified  \$SOL/ USD)

***

## Features Included

| Area          | What’s in the blueprint                                                                       |
| :------------ | :-------------------------------------------------------------------------------------------- |
| **Product**   | PRD, PLAN, HUMAN\_REVIEW, PROJECT\_RULES                                                      |
| **Frontend**  | Next.js App Router, components, state (Zustand / Redux), LLM prompt to generate frontend code |
| **Backend**   | Express (or FastAPI / NestJS), services, auth; OpenAPI spec                                   |
| **Database**  | PostgreSQL, Prisma schema, migrations, ORM models                                             |
| **Auth**      | NextAuth.js or Clerk in specs and infra                                                       |
| **Infra**     | Terraform, CI/CD, monitoring, secrets                                                         |
| **Testing**   | Unit tests, API tests                                                                         |
| **Repo / CI** | `github_push.yaml`                                                                            |

***

## Architecture

```
<ProjectName>/
├── README.md
├── docs/
│   ├── PRD.md
│   ├── PLAN.md
│   ├── HUMAN_REVIEW.md
│   ├── PROJECT_RULES.md
│   └── phases/
├── frontend/
│   ├── react_nextjs.md
│   ├── components.md
│   ├── state_management.md
│   └── prompts/
│       └── generate_frontend.txt
├── backend/
│   ├── node_express.md
│   ├── services.md
│   ├── auth.md
│   └── apis/
│       └── openapi.md
├── db/
│   ├── schema.md
│   ├── migrations.md
│   └── orm_models.md
├── infra/
│   ├── terraform.md
│   ├── ci_cd.md
│   ├── monitoring.md
│   └── secrets_management.md
├── testing/
│   ├── unit_tests.md
│   └── api_tests.md
├── meta/
│   ├── github_push.yaml
│   └── export.zip
├── FOLDER_STRUCTURE.md
└── REVIEW_REPORT.md
```

* **Frontend** — Next.js App Router, TypeScript, Tailwind, Zustand / Redux; component and state specs; prompt to generate the UI
* **Backend** — Node / Express (or FastAPI / NestJS), service layer, auth; OpenAPI for the API
* **DB** — PostgreSQL and Prisma: schema, migrations, ORM
* **Infra** — Terraform, CI/CD (e.g. GitHub Actions), monitoring, secrets
* **Testing** — Structure for unit and API tests

***

## Database Setup

***

### Schema and ORM

* **db/schema.md** — Tables, relations, indexes
* **db/orm\_models.md** — Prisma models
* **db/migrations.md** — How to create and run Prisma migrations

***

### Steps after you have runnable code

1. **Install Prisma** (if not in the generated app)

   ```
   npm install prisma @prisma/client
   npx prisma init

   ```
2. **Apply the schema** — Turn `db/schema.md` and `orm_models.md` into `prisma/schema.prisma`, then:

   ```
   npx prisma migrate dev --name init

   ```
3. **Connect the app**
   * Set `DATABASE_URL`
   * Use `PrismaClient` in the backend
4. **Seeding (optional)**
   * Add `seed` in `package.json`
   * Run `npx prisma db seed`

***

### Hosted Postgres

* **Vercel Postgres**, **Supabase**, **Neon**, **Railway**, **AWS RDS**
* Use the provider’s connection string as `DATABASE_URL`
* **infra/secrets\_management.md** describes where to store secrets

***

## Deployment Options

***

### Vercel (frontend + serverless API)

* Deploy Next.js app with API Routes or Route Handlers
* External backend deployed separately if needed
* Hosted Postgres via Vercel or another provider
* CI/CD via **infra/ci\_cd.md** and **meta/github\_push.yaml**

***

### Docker + cloud (AWS, GCP, etc.)

* **infra/terraform.md** — VPC, RDS, ECS / Fargate / GKE
* **Dockerfile** — Backend (and optionally frontend)
* **infra/ci\_cd.md** — Build, push, deploy
* **infra/secrets\_management.md** — Inject secrets

***

### Hybrid (Vercel frontend + external backend)

* Frontend on Vercel
* Backend on AWS Fargate, Lambda, or Cloud Run
* Hosted Postgres
* API contract in **backend/apis/openapi.md**

***

### Auth in deployment

* **NextAuth.js**
  * `NEXTAUTH_URL`
  * `NEXTAUTH_SECRET`
  * OAuth client IDs / secrets
* **Clerk**
  * `NEXT_PUBLIC_CLERK_*`
  * `CLERK_SECRET_KEY`
* **infra/secrets\_management.md** — Where auth secrets live
