Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arkitektio/arkitekt-ts

Meta Package for Arkitekt Typescript Clients
https://github.com/arkitektio/arkitekt-ts

arkitekt arkitekt-client javascript metapackage typescript

Last synced: about 1 month ago
JSON representation

Meta Package for Arkitekt Typescript Clients

Awesome Lists containing this project

README

        

# Arkitekt Typescript Client

This repository contains the Code for the Arkitekt Typescript client,
which provides convenience methods to integrate Arkitekt into React-based
applications.

## Installation

```bash
yarn add @jhnnsrs/arkitekt
```

## Usage

```typescript
import { Route, BrowserRouter as Router, Routes } from "react-router-dom";
import "./App.css";
import { EasyGuard, EasyProvider, useApp } from "./arkitekt";
import { AutoConfiguration } from "./arkitekt/autos/AutoConfiguration";
import { Callback } from "./arkitekt/components/Callback";
import { useArkitektConnect } from "./arkitekt/hooks/useArkitektConnect";
import { useArkitektLogin } from "./arkitekt/hooks/useArkitektLogin";

export const Test = () => {
const { manifest } = useApp();
const { registeredEndpoints, load } = useArkitektConnect();
const { login } = useArkitektLogin();

return (
<>

{manifest.identifier}



{registeredEndpoints.map((e) => {
return (

load({
endpoint: e,
})
}
>
Connect to {e.name}

);
})}
>
} // Endpoitns will be automatically autodiscoverd if local
notLoggedInFallback={
<>
login()}>Login
>
} // Will start the login workflow
> // Api calls to the Platform needs to be happening within a Guarded Connecs
Lets do something with this app

>
);
};

function App() {

return (






} />
} />




);
}

```

This is a basic Arkitekt App, which will be able to connnect to a local Arkitekt Service, retrieve configuration from it (or negotiate
to become a new app on the platform), and then authenticates the user via Oauth2 (using an oauth authorization-code grant).
Components within the "Easy Guard" will only be rendered once Arkitekt is connected.