Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-5434: Update docs #2412

Merged
merged 14 commits into from
Jan 23, 2024
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 45 additions & 11 deletions docs/acp/user/develop-an-app/develop-an-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Make sure you have the Spryker Docker SDK, Git, and an empty repository for your

{% info_block infoBox "Info" %}

[Download](https://github.com/spryker-projects/mini-framework) the completed example from the Mini-Framework.
[Download](https://github.com/spryker-projects/mini-framework/tree/examples/acp/create-an-app-final) the completed example from the Mini-Framework.

{% endinfo_block %}

Expand Down Expand Up @@ -79,12 +79,21 @@ You can also execute this step later.

Now, you have done the groundwork that enables you to develop an App. You created a new repository that contains the boilerplate code for almost any App you’d like to build.

## Start the local development environment
### Step validation

- Make sure that project is cloned properly and it has no uncommited files.

The Mini-Framework already comes with the predefined Docker configuration. Change the `deploy.dev.yml` by replacing `glue-backend.de.spryker.local` with `my-app.de.spryker.local`. After that, run the command provided in the next section at the root of your new repository.

## Start the local development environment

### Boot and up your environment

Clone Spryker Docker SDK in project directory:

```bash
git clone git@github.com:spryker/docker-sdk.git docker
```

Execute the following command to boot your application and start it:

```bash
Expand All @@ -100,6 +109,12 @@ docker/sdk testing codecept run

You will now see that your app boilerplate code is up and running.

### Step validation

- Make sure that all the command are executed without errors and the tests are successfully passed.
- Check that docker containers are started by using the `docker/sdk ps` command.
- Make sure that `my-app.spryker.local` domain is resolved by using `ping my-app.spryker.local` command

## Add the app manifest files

Before your app can be listed in the App Store Catalog, you need to add the following files.
Expand All @@ -108,7 +123,7 @@ Before your app can be listed in the App Store Catalog, you need to add the foll

The manifest file is the most important one for the app. It contains data that will be displayed in the App Store Catalog. You can use the [manifest code snippet](/docs/acp/user/develop-an-app/code-snippets/manifest-json-file.html) and update it to your needs. Add the manifest file to `config/app/manifest/en_US.json` of your app.

Manifest files must have the local name as the filename, for example, `en_US.json`, and should be placed inside the `config/app/manifest` directory.
Manifest files must have the locale name as the filename, for example, `en_US.json`, and should be placed inside the `config/app/manifest` directory.
sergeyspryker marked this conversation as resolved.
Show resolved Hide resolved

### Configuration

Expand All @@ -118,6 +133,10 @@ The configuration file contains all necessary form fields for inputs required by

The translation file contains all translations for the form fields you’ve previously defined. You can use the Hello World [example translation file](/docs/acp/user/develop-an-app/code-snippets/translation-json-file.html) and update it to your needs. Add this file to `config/app/translation.json` of your app.

### Step validation

- Make sure that all the needed configuration files are created and populated properly.

## Add the registry (code)

Every app requires default endpoints for the App Registry Service. This service acts as an intermediary between the App Store Catalog and all apps. Each app is registered in the App Registry Service and requires the following endpoints for communication:
Expand All @@ -128,17 +147,24 @@ Every app requires default endpoints for the App Registry Service. This service
To be able to use your Mini Framework as an app, add a new Spryker module:

```bash
docker/sdk cli composer require spryker/app-kernel spryker/message-broker-aws spryker/propel-encryption-behavior
docker/sdk cli composer require 'spryker/app-kernel:^0.1.1 spryker/message-broker-aws'
```

The `spryker/app-kernel` module transforms the Mini-Framework into an app. It provides SyncAPI schema and code for configuration and disconnection, as well as an AsyncAPI schema and code for the AppConfigure and AppDisconnect messages.
The `spryker/message-broker-aws` module installs the necessary plugins for sending and receiving messages.
After installing the modules, you need to configure them. See the [configuration example](https://github.com/spryker-projects/mini-framework/blob/examples/acp/hello-world/my-app-final/config/Shared/config_default.php#L28).

### Step validation

- Make sure that new packages are added in `composer.json` and composer command is executed without errors.
sergeyspryker marked this conversation as resolved.
Show resolved Hide resolved

## Set up the message broker

Install and configure the message broker as described in [Set up the message broker](/docs/acp/user/develop-an-app/set-up-the-message-broker.html).

### Step validation

- Make sure that `spryker/message-broker` is installed and configured properly.
sergeyspryker marked this conversation as resolved.
Show resolved Hide resolved

## Config

To be identifiable in the App Eco System, every app needs an app identifier. To provide the identifier, add the following configuration to `config/Shared/config_default.php`:
Expand Down Expand Up @@ -181,6 +207,10 @@ class GlueBackendApiApplicationDependencyProvider extends SprykerGlueBackendApiA

This enables the two required endpoints for the App Catalog Communication.

### Step validation

- The new routes you can check in [Test the endpoints](#test-the-endpoints) after the next two steps.

## Build the transfer objects

Transfer objects are used in many places. Since you installed some modules, you also need to generate the transfers. To generate the transfers, run the following command:
Expand All @@ -204,7 +234,7 @@ You can now test the `configure` request with the following snippets. Run the cU
### Test the /private/configure endpoint

```bash
curl --location --request POST 'http://my-app.de.spryker.local/private/configure' \
curl --location --request POST 'http://my-app.spryker.local/private/configure' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Accept: application/vnd.api+json' \
--header 'Accept-Language: en-US, en;q=0.9,*;q=0.5' \
Expand All @@ -219,20 +249,24 @@ curl --location --request POST 'http://my-app.de.spryker.local/private/configure
}'
```

Now, check if your database contains the newly created configuration in the `spy_app_config` table.
### Step validation

You can check if your database contains the newly created configuration in the `spy_app_config` table. The database credentials you can find in `deploy.dev.yml` file.

### Test the /private/disconnect endpoint

```bash
curl --location --request POST 'http://my-app.de.spryker.local/private/disconnect' \
curl --location --request POST 'http://my-app.spryker.local/private/disconnect' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Accept: application/vnd.api+json' \
--header 'Accept-Language: de-DE, en;q=0.9,*;q=0.5' \
--header 'X-Tenant-Identifier: dev-US' \
--data-raw ''
```

Now, check if the previously created configuration in the spy_app_config table has been removed from your database.
### Step validation

- Now you can check if the previously created configuration in the spy_app_config table has been removed from your database.

## Implement business logic

Expand All @@ -241,7 +275,7 @@ Start implementing the business logic by implementing a synchronous or asynchron

## Debug your app

If you want to understand what is happening in the code, you can [debug your app](/docs/acp/user/develop-an-app/debug-an-app-with-xdebug.html) with XDebug and by adding `--cookie "XDEBUG_SESSION=PHPSTORM;path=/;" \` to the above cURL request.
If you want to understand what is happening in the code, you can [debug your app](/docs/acp/user/develop-an-app/debug-an-app-with-xdebug.html) with XDebug and by adding `--cookie "XDEBUG_SESSION=PHPSTORM;" \` to the above cURL request.

Entry points for setting breakpoints are the following:
- `Spryker\Glue\App\Controller\AppConfigController`
Expand Down
Loading