Getting started
Create a project, run the dev server, and open the page. That is the whole setup.
Create a project
npx @veyra-labs/velz create my-site --template marketing
cd my-site
npm install
npm run devThree templates ship with the framework: blank, marketing and docs. Every template already follows the design rules, so you start from a finished page instead of an empty file. Each shell includes Nav, so the product name rolls to by Veyra out of the box.
Add a page
Pages are files. Create src/pages/about.tsx and it is live at /about.
import { Head } from '@veyra-labs/velz'
import { Container, Heading, Lead, Section } from '@veyra-labs/velz/ui'
export default function About() {
return (
<>
<Head title="About" description="Who we are and why this exists." />
<Section>
<Container>
<Heading level={1} size="display">About</Heading>
<Lead>Say the true thing, briefly.</Lead>
</Container>
</Section>
</>
)
}Add data
A page can export a load function. It runs on the server before the page renders, and whatever it returns arrives as props.data.
export async function load({ params }) {
const post = await getPost(params.slug)
return { post }
}
export default function Post({ data }) {
return <h1>{data.post.title}</h1>
}Add an API route
// src/api/contact.ts
export const POST = async (request) => {
const body = await request.json()
return Response.json({ received: body.email })
}Build and ship
npm run build # dist/client and dist/server
npm run preview # serve the production build locally