> For the complete documentation index, see [llms.txt](https://docs.reactium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reactium.io/reactium/reactium-guides/reactium-+-actinium.md).

# Reactium + Actinium (APIs)

The default API experience with Reactium is facilitated by a [separate API server](/actinium/actinium-core.md), Actinium, coupled with a front-end module that makes integration with the API server easy.

{% hint style="info" %}
The Actinium API module is installed by default. To install it manually, use Reactium CLI:

```
npx reactium install @atomic-reactor/reactium-api
```

{% endhint %}

Out of the box Reactium is ready to work with Actinium with a little configuration. Simply set the **REST\_API\_URL** and the **ACTINIUM\_APP\_ID** environment variables.&#x20;

```javascript
$ export REST_API_URL=https://my.actinium.url/api
$ export ACTINIUM_APP_ID=Actinium
$ npm start
```

In your Reactium code use the default helper module provided to immediately begin using the Actinium SDK.

{% code title="/SomeDomain/services.js" %}

```jsx
import Reactium from 'reactium-core/sdk'; 

export default {
    myCloudFunction: params => Reactium.Cloud.run('myCloudFunction', params)
    .then(data => { /* do something */ })
};
```

{% endcode %}

{% hint style="success" %}
Start Actinium then start Reactium and you're good to go!
{% endhint %}

While the extensible Reactium SDK is our opinion for the best way to quickly add backend API functionality to your webapp, supporting other client-side APIs is a snap. See [Reactium + REST](/reactium/reactium-guides/reactium-+-rest.md).

### Running the Full-Stack Locally

Start by installing both [Reactium](/installing-foundations/install.md) and [Actinium](/installing-foundations/install-actinium.md) locally.

Once you have Reactium and Actinium installed, you can run the UI server and the API server on the same machine.

For local development, Actinium runs on localhost on port 9000 and Reactium will run on localhost on port 3000 for browser-sync (and 3030 for the base Node/Express server).

See the [Architechure Diagram](/approach/architecture.md) to get a visual sense of the relationship between these two servers. In summary, Reactium is a micro-service for serving the front-end of your web-app, and Actinium is a micro-service for building an API (and database) for your application.

### Using Actinium in Express Middleware

There may be a time when you will want access to Actinium when creating Express middleware inside of a [***reactium-boot.js***](https://docs.reactium.io/reactium/reactium-guides/pages/HYFEMg0Q0BDsx6NRDRh2#reactium-boot.js) file. If you have the reactium-api module installed, Actinium is available out of the box as a global.&#x20;

{% code title="reactium-boot.js" lineNumbers="true" %}

```javascript
const bodyParser = require('body-parser');
const express = require('express');
const router = express.Router();

router.use(bodyParser.json());
router.use(bodyParser.urlencoded({ extended: false }));

router.post('/auth', async (req, res) => {
    const { username, password } = req.body;
    const result = await Actinium.Cloud.run('my-auth-function', { username, password });
    res.json(result);
});

ReactiumBoot.Server.Middleware.register('auth', {
    name: 'auth',
    use: router,
    order: ReactiumBoot.Enums.priority.highest,
});
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.reactium.io/reactium/reactium-guides/reactium-+-actinium.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
