Getting Started with Nile
Nile is a functional-first, type-safe backend framework built on Hono. It works with Bun, Node.js, and Deno, uses Zod for validation, and returns Results from all action handlers using the Ok / Err pattern from slang-ts.
1. Installation
Scaffold with the CLI (recommended)
The CLI creates a working project with services, database setup, and dev tooling:
The generated project includes a tasks service, PGLite database, Drizzle ORM, and a running server. You can add more services and actions with npx @nilejs/cli generate service <name> and npx @nilejs/cli generate action <service> <name>. To extract Zod schemas and TypeScript types from your actions, run npx @nilejs/cli generate schema.
Manual install
:::tabs
@tab Bun
@tab npm
@tab pnpm
:::
2. Quick Start
2.1 Create Actions
Actions are the core building blocks. Each action has a name, optional Zod validation schema, and a handler that returns a Result.
2.2 Group Actions into a Service
2.3 Create and Start the Server
Run with Bun:
2.4 Invoke Your Actions
Nile uses a single POST endpoint with an intent-driven payload:
3. Project Structure
4. Next Steps
- Learn about Actions and Services
- Explore the Context for accessing resources like databases
- Set up a database layer with model files for structured data access
- See Server Configuration for more options
This documentation reflects the current implementation and is subject to evolution.