# Step-by-step development guide

This guide will cover what you need to know to get started on building your application on top of the Slyk API using our [Node SDK](https://github.com/slykio/slyk-sdk-node). The use case followed here is wanting to build a product that leverages a community built with Slyk, meaning that the application will use Slyk's user management as well as its e-commerce and reward systems. While it is possible to have your product manage its own users, outside of Slyk, that will not be covered on this guide.

The first thing you'll need to do is create an API key on your Slyk dashboard. You can see how that is done on [the first step of the quick start guide](broken://pages/-Llka017GhwnDeHtx0Qi#step-1-setup).

Keep in mind that building an application that uses the Slyk API requires a bit of backend development. This is because you'll want to keep your Slyk API key secure, and not include it on your frontend code. The part of your application that connects with the Slyk API should then be on the backend.

This guide uses [Next.js](https://nextjs.org/) as the framework to build the examples, because it allows creating API routes, which is where we'll write the integration with the Slyk API.

### Demo Application

{% hint style="info" %}
The code in this guide is also the base for the open source **demo application.** Its source is available here: <https://github.com/slykio/slyk-demo>
{% endhint %}

If you want to see it working right away, you can try our[`Live Demo`](https://demo.developers.slyk.io). Balances and checkout are fake and are only meant be used for testing purposes only.

### Create a new API Key

1. Go to your Slyk dashboard.
2. On the main menu, go to **Credentials** and click on the **CREATE NEW API KEY** button.

![](/files/-M3MikVzveX46CJ2KYnp)

### Using the Slyk Node SDK

Install the Slyk Node SDK package with:

```shell
npm install @slyk/slyk-sdk-node
```

Or with:

```shell
yarn add @slyk/slyk-sdk-nodea
```

Then you'll need a way to configure the API key you created. We advise using environment variables for this. In Next.js you can do so with a `.env` file, which would look like this:

```shell
SLYK_API_KEY=your-api-key
```

The name you give this environment variable is up to you.

With this set up, you should be able to access it on your code. You'll then need to create an instance of the Slyk SDK, like this:

```javascript
import createSlykClient from '@slyk/slyk-sdk-node';

const slyk = createSlykClient({ apikey: process.env.SLYK_API_KEY });
```

You're now ready to start using the Slyk API.

For more information on the Slyk Node SDK take a look at its [documentation](https://developers.slyk.io/slyk/developing-with-slyk/sdks/server-sdk).

### Serializing Slyk SDK models

The `getServerSideProps` method in Next.js [requires all returned values to be serializable](https://nextjs.org/docs/api-reference/data-fetching/get-server-side-props#getserversideprops-return-values), so it's necessary to serialize model instances returned by the Slyk SDK manually. This can be done with `JSON.stringify` and `JSON.parse` for example, like this:

```javascript
JSON.parse(JSON.stringify(user));
```

Keep that in mind when getting data from the Slyk API using the Slyk SDK.


---

# 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://developers.slyk.io/slyk/developing-with-slyk/step-by-step-development-guide.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.
