Quick Start
Get your first Nova API running in under 5 minutes. This guide walks you through creating a simple REST endpoint.
1. Create your project
You can create a Nova project manually (step-by-step) or use the Nova CLI to scaffold a project quickly. The manual approach is shown first and is perfectly fine — below it you'll find the CLI option (recommended for most users).
Manual (step-by-step)
mkdir my-nova-app
cd my-nova-app
npm init -y
npm install @abrahambass/nova reflect-metadata zod
npm install -D typescript @types/node ts-node Using the CLI (recommended)
Install the Nova CLI globally and scaffold a new project with a single
command. The CLI will guide you through the next steps (it will show the
instructions to cd into the folder, install dependencies, and run
the dev server).
# Install the Nova CLI globally
npm i -g @abrahambass/nova-cli
# Create a new project using the CLI
nova create my-nova-app
Creating project 'my-nova-app'...
✔ Scaffolding project files
✔ Installing dependencies (optional)
Project created successfully!
Next steps:
cd my-nova-app
npm install
npm run dev 2. Configure TypeScript
{
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"skipLibCheck": true
}
} 3. Create your first controller
import 'reflect-metadata';
import { NovaFactory, Controller, Get, Post, Body, Path } from '@abrahambass/nova';
import { z } from 'zod';
const CreateTaskSchema = z.object({
title: z.string().min(1),
completed: z.boolean().default(false),
});
@Controller('/tasks')
class TaskController {
@Get()
async getAll() {
return [{ id: 1, title: 'Learn Nova', completed: false }];
}
@Get('/:id')
async getById(@Path('id') id: number) {
return { id, title: 'Learn Nova', completed: false };
}
@Post()
async create(@Body(CreateTaskSchema) data: z.infer<typeof CreateTaskSchema>) {
return { id: 2, ...data };
}
}
async function bootstrap() {
const app = await NovaFactory.create();
app.includeController(TaskController);
await app.listen(3000);
}
bootstrap(); 4. Run it
npx ts-node src/main.ts Your API is now running! Try it out:
# GET all tasks
curl http://localhost:3000/tasks
# GET task by ID
curl http://localhost:3000/tasks/1
# POST create task
curl -X POST http://localhost:3000/tasks \
-H "Content-Type: application/json" \
-d '{"title": "New task"}' Nova auto-validates the request body using your Zod schema. If validation fails, a detailed error response is returned automatically.