Skip to main content

Supported Frameworks

Our Frontend SDK provides first-class support for modern JavaScript frameworks with built-in helpers, type safety, and framework-specific integrations.

SDK-Supported Frameworks

Angular

Full integration with Angular's dependency injection and reactive patterns.

npm install @23blocks/sdk
// app.config.ts
import { BlocksClient } from '@23blocks/sdk';

export const blocksClient = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: environment.appId,
apiKey: environment.apiKey
});

// auth.service.ts
import { Injectable } from '@angular/core';
import { blocksClient } from './app.config';

@Injectable({ providedIn: 'root' })
export class AuthService {
async login(email: string, password: string) {
return blocksClient.auth.login({ email, password });
}

async register(email: string, password: string) {
return blocksClient.auth.register({ email, password });
}

async getCurrentUser() {
return blocksClient.auth.me();
}
}

Features:

  • Works with standalone components
  • Compatible with signals and RxJS
  • SSR support with Angular Universal

React

Seamless integration with React hooks and state management.

npm install @23blocks/sdk
// blocks-client.ts
import { BlocksClient } from '@23blocks/sdk';

export const blocksClient = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: process.env.REACT_APP_APP_ID,
apiKey: process.env.REACT_APP_API_KEY
});

// useAuth.ts
import { useState, useEffect } from 'react';
import { blocksClient } from './blocks-client';

export function useAuth() {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);

useEffect(() => {
blocksClient.auth.me()
.then(setUser)
.catch(() => setUser(null))
.finally(() => setLoading(false));
}, []);

const login = async (email: string, password: string) => {
const result = await blocksClient.auth.login({ email, password });
setUser(result.user);
return result;
};

return { user, loading, login };
}

Features:

  • Works with React 18+ and hooks
  • Compatible with Next.js (App Router and Pages Router)
  • Supports React Server Components

React Native

Build mobile apps with the same SDK.

npm install @23blocks/sdk
// App.tsx
import { BlocksClient } from '@23blocks/sdk';
import AsyncStorage from '@react-native-async-storage/async-storage';

const blocksClient = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: 'your-app-id',
apiKey: 'your-api-key',
// Optional: Persist tokens
storage: AsyncStorage
});

// LoginScreen.tsx
import React, { useState } from 'react';
import { View, TextInput, Button, Alert } from 'react-native';

export function LoginScreen({ navigation }) {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');

const handleLogin = async () => {
try {
await blocksClient.auth.login({ email, password });
navigation.navigate('Home');
} catch (error) {
Alert.alert('Error', 'Invalid credentials');
}
};

return (
<View>
<TextInput value={email} onChangeText={setEmail} placeholder="Email" />
<TextInput value={password} onChangeText={setPassword} secureTextEntry />
<Button title="Login" onPress={handleLogin} />
</View>
);
}

Features:

  • Works on iOS and Android
  • Token persistence with AsyncStorage
  • Expo compatible

Other Frameworks

Since 23blocks is a standard REST API, you can use it with any framework:

FrameworkIntegration
Vue.jsUse SDK or direct HTTP calls
SvelteUse SDK or direct HTTP calls
Next.jsFull SDK support (client & server)
Nuxt.jsDirect HTTP calls
RemixDirect HTTP calls
AstroDirect HTTP calls
SolidJSDirect HTTP calls

Example: Vue.js

// composables/useBlocks.js
import { BlocksClient } from '@23blocks/sdk';

const client = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: import.meta.env.VITE_APP_ID,
apiKey: import.meta.env.VITE_API_KEY
});

export function useBlocks() {
return client;
}

Example: Svelte

<script>
import { BlocksClient } from '@23blocks/sdk';

const client = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: import.meta.env.VITE_APP_ID,
apiKey: import.meta.env.VITE_API_KEY
});

let user = null;

async function login(email, password) {
const result = await client.auth.login({ email, password });
user = result.user;
}
</script>

SDK Features

The 23blocks Frontend SDK provides:

FeatureDescription
TypeScript TypesFull type safety for all API responses
Auto-completionIDE support for all methods and parameters
Token ManagementAutomatic token storage and refresh
Error HandlingTyped error responses with helpful messages
Retry LogicAutomatic retry on network failures

Starter Templates

Skip the setup and start building immediately with our production-ready templates:

TemplateFrameworkFeaturesGet Started
Next.jsNext.js 15 + React 19App Router, SSR, TailwindUse Template
AngularAngular 19Standalone components, RxJSUse Template
MobileReact Native (Expo 52)iOS, Android, Expo RouterUse Template

Each template includes:

  • Pre-built authentication flows (sign-in, sign-up, password reset)
  • 23blocks SDK pre-configured
  • Full TypeScript support
  • Environment-based configuration

Learn more about templates →


Get Started

  1. Use a starter template or install the SDK: npm install @23blocks/react
  2. Read the Frontend SDK documentation
  3. Browse the API Reference