# DFX does not deploy backend canister

**URL:** <https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387>\
**Category:** Rust\
**Created:** [September 28, 2023, 7:48pm UTC](https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387 "2023-09-28T19:48:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![princess\_eth](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@princess\_eth](https://forum.dfinity.org/u/princess_eth)\
**Post date:** [September 28, 2023, 7:48pm UTC](https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387/1 "2023-09-28T19:48:40Z")

</div>

I am attempting to deploy the Rust program listed on the [Adding and searching simple records page](https://internetcomputer.org/docs/current/developer-docs/backend/rust/searching-records) as a backend canister.

I currently have the following `dfx.json`:

```auto
{
  "canisters": {
    "app": {
      "backend": {
        "main": "backend/main.rs",
        "type": "rust"
      },
      "frontend": {
        "entrypoint": "src/index.tsx"
      },
      "source": ["build"],
      "type": "assets"
    }
  }
}

```

Within my backend folder, I have a `cargo.toml` and `main.rs`. The main.rs consists of the code listed in [this page](https://internetcomputer.org/docs/current/developer-docs/backend/rust/searching-records).

When I run `dfx build` and then `dfx deploy`, it currently only builds and deploys the frontend. What could I be doing wrong?

---

<div class="post-metadata">

**Author:** ![zohaib29](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/zohaib29/32/29625_2.png) [@zohaib29](https://forum.dfinity.org/u/zohaib29)\
**Post date:** [September 28, 2023, 8:23pm UTC](https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387/2 "2023-09-28T20:23:17Z")

</div>

Replace the dfx.json with this one and rename your canister at your convenience

````auto
{
  "canisters": {
    "rust_profile_backend": {
      "candid": "src/rust_profile_backend/rust_profile_backend.did",
      "package": "rust_profile_backend",
      "type": "rust"
    },
    "rust_profile_frontend": {
      "dependencies": [
        "rust_profile_backend"
      ],
      "frontend": {
        "entrypoint": "src/rust_profile_frontend/src/index.html"
      },
      "source": [
        "src/rust_profile_frontend/assets",
        "dist/rust_profile_frontend/"
      ],
      "type": "assets"
    }
  },
  "defaults": {
    "build": {
      "args": "",
      "packtool": ""
    }
  },
  "output_env_file": ".env",
  "version": 1
}```
````

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [September 29, 2023, 7:42am UTC](https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387/3 "2023-09-29T07:42:43Z")

</div>

> [@princess\_eth](#):
>
> ```auto
> {
> "canisters": {
> "app": {
> "backend": {
> "main": "backend/main.rs",
> "type": "rust"
> },
> "frontend": {
> "entrypoint": "src/index.tsx"
> },
> "source": ["build"],
> "type": "assets"
> }
> }
> }
> 
> ```

This defines a single canister `"app"`, within which you have `"backend"`, which is ignored because the canister `app` is of type `assets`. Move `backend` up by one level and it should work

---

<div class="post-metadata">

**Author:** ![princess\_eth](https://avatars.discourse-cdn.com/v4/letter/p/ce7236/32.png) [@princess\_eth](https://forum.dfinity.org/u/princess_eth)\
**Post date:** [September 29, 2023, 9:46pm UTC](https://forum.dfinity.org/t/dfx-does-not-deploy-backend-canister/23387/4 "2023-09-29T21:46:10Z")

</div>

> [@zohaib29](#):
>
> Replace the dfx.json with this one and rename your canister at your conveni

Thank you for the response! How did

Ah, it seems like I will need to generate a candid file in order for it to work. I’ll take a look!
