@build0.ai/core
v1.5.11
Published
Core functionality for Build0.ai including authentication, credentials, error propagation, and shared ESLint rules
Downloads
157
Maintainers
Readme
@build0.ai/core
A comprehensive core library for Build0.ai applications that provides authentication, credentials management, blob storage, error propagation, and shared ESLint rules.
Features
- Authentication: User authentication and session management
- Credentials: Encrypted credential handling for API routes
- Blob Storage: S3-compatible storage with session cookie authentication
- Error Propagation: Comprehensive error handling and monitoring for React applications
- ESLint Rules: Shared ESLint rules to prevent common React/Radix UI pitfalls
Installation
npm install @build0.ai/coreFor Blob Storage functionality, you'll also need:
npm install @aws-sdk/client-s3Note: The package handles HTTP transport internally using NodeHttpHandler, which is optimized for server-side file uploads and automatically handles headers like Expect: 100-continue.
Quick Start
Authentication
import { authenticate } from '@build0.ai/core';
export async function GET(request: Request) {
const { user } = await authenticate(request);
return Response.json({ user });
}Credentials
import { getCredentials } from '@build0.ai/core';
export async function GET(request: Request) {
const credentials = await getCredentials(request);
return Response.json({ success: true });
}Blob Storage
import { createS3Client, getS3BucketName } from '@build0.ai/core';
import { PutObjectCommand } from '@aws-sdk/client-s3';
export async function POST(request: Request) {
const s3Client = createS3Client(request.headers);
const bucketName = getS3BucketName();
await s3Client.send(new PutObjectCommand({
Bucket: bucketName,
Key: 'example.txt',
Body: 'Hello World',
}));
return Response.json({ success: true });
}Error Propagation
import { Build0Wrapper } from '@build0.ai/core/client';
function App({ children }) {
return (
<Build0Wrapper
forwardConsole={["error", "warn"]}
suppressHydrationWarnings={true}
>
{children}
</Build0Wrapper>
);
}Environment Variables
BUILD0_AUTH_URL=https://your-auth-endpoint.com
BUILD0_CREDENTIALS_URL=https://your-credentials-endpoint.com
BUILD0_ENCRYPTION_KEY=your-encryption-key-hex
BUILD0_BLOB_URL=https://your-blob-storage-endpoint.com
BUILD0_BLOB_BUCKET_NAME=blob # optional, defaults to "blob"Documentation
For complete documentation, examples, and architecture details, see CLAUDE.md.
License
MIT
