Getting Started

Learn how to build your first API with Frey in just a few minutes

Getting Started

Welcome to Frey! This guide will help you get up and running with Frey in just a few minutes.

What is Frey?

Frey is a lightweight, entity-driven API framework built with Fastify and TypeScript. It provides a structured way to define entities with Zod schemas and automatically generates RESTful APIs with full type safety.

Key Features

  • ๐Ÿš€ Entity-driven API generation - Define entities and get full CRUD APIs automatically
  • โšก Multi-runtime support - Works with both Node.js and Bun
  • ๐Ÿ”’ Type-safe - Built with TypeScript strict mode for maximum type safety
  • ๐Ÿงช Well-tested - Comprehensive tests across unit and integration
  • ๐Ÿ“ Automatic validation - Parameter parsing and validation with Zod
  • ๐Ÿ› ๏ธ Custom routes - Extend generated APIs with custom route handlers
  • ๐Ÿ“ฆ Minimal dependencies - Only essential dependencies (Fastify + Zod)

Installation

Your First API

Let's create a simple user API to get started:

What Just Happened?

When you run this code, Frey automatically creates the following REST endpoints:

  • GET /users - List all users (calls your findAll handler)
  • POST /users - Create a new user (calls your create handler)
  • GET /users/:id - Get a specific user (calls your findOne handler)
  • PUT /users/:id - Update a user (calls your update handler)
  • DELETE /users/:id - Delete a user (calls your delete handler)

Testing Your API

You can test your API using curl or any HTTP client:

Next Steps

Now that you have a basic understanding of Frey, explore these topics:

Need Help?

  • Check out the API Reference for detailed documentation
  • Look at Examples for inspiration
  • Join our community discussions for support