Getting Started

The fastest way to start building with Radiant is using our official project initializer. It sets up a new Radiant project with a recommended directory structure, a default configuration, and everything you need to start building immediately.

1. Initialize a New Project

Once you have installed the Radiant binary, you can initialize a new project anywhere on your system:

radiant init

During initialization, the CLI will guide you through a few quick questions:

  • What is your project named? (e.g., my-radiant-app)
  • Choose a template (Blank, Auth, E-commerce, etc.)
  • Where should the generated gen.ts be outputted? (e.g., .)

Once the setup is complete, navigate into your new project directory:

cd my-radiant-app

2. Define Your First Collection

Open radiant/collections.radiant in your code editor. Let's add a simple posts collection to see how easy it is to model data:

collection posts {
  fields: {
    title: text
    content: text
    published: boolean @default(false)
  }
}

This simple definition is enough for Radiant to generate a full CRUD API, TypeScript interfaces, and database schema!

3. Start the Development Server

To see your new API in action, start the Radiant development server:

radiant dev

This command does a lot of heavy lifting for you automatically:

  1. Compiles your .radiant files into an optimized runtime schema.
  2. Generates TypeScript definitions (radiant-types.ts) for your frontend or custom hooks.
  3. Starts the built-in API server on http://localhost:3000.

4. Test Your API

With the server running, Radiant has automatically created all the standard REST endpoints for your posts collection.

You can instantly test creating a new post:

curl -X POST http://localhost:3000/api/posts \
  -H "Content-Type: application/json" \
  -d '{"title": "My First Radiant Post", "content": "This backend was built in seconds."}'

And fetch it back:

curl http://localhost:3000/api/posts

What's Next?

You have a fully functional API running! From here, you can:

  • Define more complex Collections and relationships.
  • Add custom Access Control rules to secure your endpoints.
  • Check out the auto-generated Swagger UI at http://localhost:3000/api/docs.