Project Structure
VeloxTS projects use a monorepo structure with separate apps for backend (apps/api) and frontend (apps/web).
API + SPA Structure (default, auth, trpc Templates)
Section titled “API + SPA Structure (default, auth, trpc Templates)”For default, --auth, and --trpc templates, you get a classic API backend with a Single Page Application frontend:
my-app/├── apps/│ ├── api/ # Backend API│ │ ├── src/│ │ │ ├── procedures/ # API procedures│ │ │ │ └── users.ts│ │ │ ├── schemas/ # Zod validation schemas│ │ │ └── index.ts # API entry point│ │ ├── prisma/│ │ │ └── schema.prisma # Database schema│ │ └── prisma.config.ts # Prisma 7 configuration│ ││ └── web/ # Frontend (React SPA)│ ├── src/│ │ ├── components/ # React components│ │ ├── pages/ # Page components│ │ └── main.tsx # App entry point│ ├── index.html│ └── vite.config.ts # Vite configuration│├── packages/ # Shared code (optional)├── .env # Environment variables├── package.json # Root package.json├── pnpm-workspace.yaml # Workspace configuration└── CLAUDE.md # AI assistant contextAPI + RSC Structure (React Server Components)
Section titled “API + RSC Structure (React Server Components)”For --rsc and --rsc-auth templates, you get an API backend with React Server Components powered by Vinxi:
my-app/├── apps/│ ├── api/ # Backend API│ │ ├── src/│ │ │ ├── procedures/ # API procedures│ │ │ │ └── users.ts│ │ │ ├── schemas/ # Zod validation schemas│ │ │ └── index.ts # API entry point│ │ ├── prisma/│ │ │ └── schema.prisma # Database schema│ │ └── prisma.config.ts # Prisma 7 configuration│ ││ └── web/ # Frontend (React + Vinxi RSC)│ ├── app/│ │ ├── pages/ # File-based routing│ │ │ ├── index.tsx # /│ │ │ └── users/│ │ │ └── [id].tsx│ │ ├── layouts/│ │ │ └── root.tsx # Root layout│ │ └── actions/ # Server actions│ │ └── users.ts│ └── app.config.ts # Vinxi configuration│├── packages/ # Shared code (optional)├── .env # Environment variables├── package.json # Root package.json├── pnpm-workspace.yaml # Workspace configuration└── CLAUDE.md # AI assistant contextKey Directories
Section titled “Key Directories”apps/api/src/procedures/
Section titled “apps/api/src/procedures/”This is where your API logic lives. Each file exports a ProcedureCollection:
export const userProcedures = procedures('users', { listUsers: procedure()... getUser: procedure()...});Procedures are automatically discovered and registered.
apps/api/src/schemas/
Section titled “apps/api/src/schemas/”Zod schemas for validation. These can be shared between procedures and frontend:
import { z } from '@veloxts/velox';
export const CreateUserSchema = z.object({ name: z.string().min(1), email: z.string().email(),});
export type CreateUserInput = z.infer<typeof CreateUserSchema>;apps/api/prisma/
Section titled “apps/api/prisma/”Database schema and migrations:
schema.prisma- Model definitionsmigrations/- Database migrations (after runningvelox migrate)
Key Files
Section titled “Key Files”prisma.config.ts
Section titled “prisma.config.ts”Prisma 7 requires this configuration file:
import 'dotenv/config';import { defineConfig } from 'prisma/config';
export default defineConfig({ schema: './prisma/schema.prisma', datasource: { url: process.env.DATABASE_URL, },});CLAUDE.md
Section titled “CLAUDE.md”Context file for AI assistants (Claude Code, Cursor, etc.). Contains:
- Framework conventions
- Common commands
- Gotchas and tips
Next Steps
Section titled “Next Steps”- Templates - Template differences
- Procedures - Define your API