# Definiti

## Describe your domain

Does your language enable you to describe your domain? Does it only describe you domain or do technical stuffs are in your way?

The objective of **Definiti** is to provide a declarative language and tools to help you describe your domain and throw out technical code at the edge of your application.

## How does it work?

Define all your domain logic in **Definiti** language, then generate sources code in your technical languages such as Scala or Typescript.

It is also possible to generate other things than sources files, as glossary, plantUML diagrams and more.

The following diagram represents a simple workflow with **Definiti**:

![](https://2424049599-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDWXSWI6V1EJYtUlJYc%2F-LDWjlwxc6N8vct0qp2b%2F-LDWvNvhp3L5iCxIoypd%2Fworkflow.png?alt=media\&token=4e2173ff-fe1d-4676-bfe2-841946d79651)

{% hint style="info" %}
**Definiti** is not intended to work as a standalone language. Please check which languages are supported before using it.
{% endhint %}

## Getting started

{% hint style="warning" %}
We use docker to download and execute the **Definiti** compiler. Please refers to the documentation to install it on your environment.
{% endhint %}

To start using **Definiti**, execute the following installation command:

```bash
bash -c "$(curl https://raw.githubusercontent.com/definiti/definiti/master/script/install.sh -sSf)"
```

You will be ask for the version, the languages and the plugins to use. For instance, we will take following configuration:

* version: *default*
* languages: **scala**
* plugins: *none*

Once done, write your first **Definiti** file in `src/main/definiti/blog.def` (we will come back to the syntax later):

{% code title="src/main/definiti/blog.def" %}

```
package my.blog

type BlogArticle {
  title: String
  description: String
  date: Date
}
```

{% endcode %}

Then compile it:

```bash
./definiti
```

You will see a new directory: `target/scalamodel` with the most interesting file `my/blog/blog.scala`:

{% code title="src/main/scala-definiti/my/blog/blog.scala" %}

```scala
package my

import definiti.native._
import java.time.LocalDateTime

package object blog {
  case class BlogArticle(title: String, description: String, date: LocalDateTime)
  object BlogArticle {
    val verification: Verification[BlogArticle] = Verification.none[BlogArticle]
  }
}
```

{% endcode %}

You can now use it in your own project:

{% code title="src/main/scala/my/app/App.scala" %}

```scala
package my.app

import java.time.LocalDateTime
import my.blog.BlogArticle


object App {
  def main(args: Array[String]): Unit = {
    val firstArticle = BlogArticle(
      title = "My first article",
      description = "My description",
      date = LocalDateTime.now()
    )
    println(firstArticle)
  }
}
```

{% endcode %}

## What's next?

Please check the left panel to go through the documentation.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://definiti.gitbook.io/definiti/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
