> ## Documentation Index
> Fetch the complete documentation index at: https://archie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Logic

> Logic is where you add backend code that runs next to your project's API. Generate it with AI, scaffold it in a language you choose, or connect a git repository you already have.

**Logic** is the part of the Backend Console where you add code that runs alongside your project's API. In the console, the page is titled **Custom Services**: backend services you own, deployed next to your API on a path you choose.

Use Logic for behavior that the auto-generated [GraphQL](https://archie.com/docs/backend/graphql-api-explorer.md) and [REST](https://archie.com/docs/backend/rest-api-explorer.md) APIs don't cover on their own, such as "when an order ships, notify the buyer and record the shipping date."

## Open Logic

Open your project, switch to **Backend**, and select **Logic** in the Backend Console navigation. Select the [environment](https://archie.com/docs/backend/environments.md) you want to work in from the environment menu on the right.

When the environment has no services yet, the page shows **Create your first custom service** and three ways to start.

![The Custom Services empty state with Start from scratch, Import from Git, and Generate with AI cards under the heading Create your first custom service.](https://mintcdn.com/archie-e998dbf6/FcInvfd50seksJIy/images/17-logic-empty-state.png?fit=max\&auto=format\&n=FcInvfd50seksJIy\&q=85\&s=3984cbbb96190751311a2ee86f3606ad)

## One service per project

For now, each project can have one service. When a service already exists, **New service** is unavailable and its tooltip reads "For now each project can have one service."

Once a service exists, the page lists it in a table with its **Service** name, **Origin** (for example, "From scratch"), **Language**, and **Status**. The **Status** column shows values such as **Not deployed yet**, **Succeeded**, and **Failed**. Use **Search services…** to filter the list and **Refresh** to reload it. Each row also has an **Actions** menu with **Open in new tab** and **Delete**. Click a service name to open it. See [Working with a service](https://archie.com/docs/backend/logic/working-with-a-service.md).

![The Custom Services list with one service and its origin, language, and status.](https://mintcdn.com/archie-e998dbf6/JW67AKv9r3EIl9M1/images/42-logic-services-list.png?fit=max\&auto=format\&n=JW67AKv9r3EIl9M1\&q=85\&s=022433da3bd2130f72c09fec8de75b5c)

## Ways to add logic

Click **New service** in the page header, or pick one of the cards in the empty state. The **Add Logic** dialog asks how you want to start.

![The Add Logic dialog with Add With AI, From Scratch, and From a Code Repository options.](https://mintcdn.com/archie-e998dbf6/FcInvfd50seksJIy/images/18-logic-add-logic-modes.png?fit=max\&auto=format\&n=FcInvfd50seksJIy\&q=85\&s=91cbedadbe7c1274a39be669fe8f6563)

> **[Add With AI](https://archie.com/docs/backend/logic/creating-with-ai.md)**
>
> Describe what should happen. Archie maps out the functions it needs and you choose which to generate. Archie marks this option as recommended.

> **[From Scratch](https://archie.com/docs/backend/logic/from-scratch.md)**
>
> Archie creates and hosts the code. You edit it in Archie and deploy with one click.

> **[From a Code Repository](https://archie.com/docs/backend/logic/from-a-repository.md)**
>
> Connect your own git repository. It deploys on every push.

## After you create a service

Open the service to edit its code, deploy it, and set its variables:

> **[Working with a service](https://archie.com/docs/backend/logic/working-with-a-service.md)**
>
> The service page, the code editor, the deploy file, and deleting a service.

> **[Deployments](https://archie.com/docs/backend/logic/deployments.md)**
>
> Deploy, compare Head with the live version, read the pipeline, and fix a failed deploy.

> **[Environment variables](https://archie.com/docs/backend/logic/environment-variables.md)**
>
> Configuration and secrets shared by the services in an environment.

## Services and functions

A **service** is the deployable unit. It has one repository, one language, and one deploy history. A **function** is one operation inside a service, such as a GraphQL query, a GraphQL mutation, or a REST route. When a deploy finishes, Archie registers the service's operations with your project's API.

## Supported languages

Services can use **Node.js**, **Python**, **Go**, **.NET**, or **Java**. The AI option also offers **Let Archie Decide**.

## FAQ

> **Why is this page called Custom Services?**
>
> **Logic** is the name in the Backend Console navigation. The page header reads **Custom Services**. Both names refer to the same page.

> **Which option should I pick?**
>
> Pick **Add With AI** when you can describe the behavior in plain words. Pick **From Scratch** when you want to write the code yourself in Archie. Pick **From a Code Repository** when the code already lives in GitHub, GitLab, or another git host.

> **Is Logic the same as scheduled tasks?**
>
> No. A [scheduled task](https://archie.com/docs/backend/scheduled-tasks.md) is a schedule that calls a target. Logic is code you add and deploy.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.