--- title: Project Structure sort: 130 section-id: getting-started keywords: project structure, directory layout, files, folders, architecture description: A detailed explanation of every file and folder in a Velox project language: en --- # Project Structure ![Velox Architecture](assets/images/architecture.jpg) Understanding the Velox project structure is key to working effectively with the framework. This page explains the purpose of every directory and file you will encounter in a standard Velox project. ## Top-Level Layout ``` my-velox-app/ ├── routes/ ← all pages and API routes ├── layouts/ ← shared page layouts ├── components/ ← reusable UI components ├── lib/ ← shared server-side utilities ├── middleware/ ← request/response interceptors ├── public/ ← static assets (copied verbatim) ├── styles/ ← global CSS and design tokens ├── tests/ ← test files ├── .velox/ ← build cache and output (gitignored) ├── velox.config.ts ← framework configuration ├── tsconfig.json ← TypeScript configuration ├── package.json └── .env ← environment variables ``` ## `routes/` This is the most important directory. Every file in `routes/` maps to a URL path unless prefixed with `_` (underscore files are ignored by the router). ### Page Routes Files ending in `.velox` or `.tsx` become page routes: ``` routes/ ├── index.velox → / ├── about.velox → /about ├── blog/ │ ├── index.velox → /blog │ └── [slug].velox → /blog/:slug ├── docs/ │ └── [...path].velox → /docs/* (catch-all) └── _components/ ← underscore prefix: ignored by router └── Header.tsx ``` ### API Routes Files suffixed with `+server.ts` become API routes. They export HTTP method handlers: ``` routes/ └── api/ ├── users+server.ts → /api/users └── users/[id]+server.ts → /api/users/:id ``` ### Special Files | File | Purpose | |---|---| | `_error.velox` | Custom error page (404, 500) in any directory | | `_loading.velox` | Loading state shown during route transitions | | `_layout.velox` | Layout that wraps all sibling routes | ## `layouts/` Layout files define the shell that wraps your page content. A layout receives a `` where the page content is injected. ```tsx // layouts/default.velox --- import Header from '../components/Header.tsx'; import Footer from '../components/Footer.tsx'; --- {meta.title}