Developer Architecture

Developers can interact with GuaridOS modules using SDKs and APIs. Example integrations:

Identity (Authenticator)

// Verify a user session with Privy/GuaridOS
import { verifyAuth } from "@privy-io/server-auth";

export async function GET(req: Request) {
  const token = req.headers.get("authorization")?.replace("Bearer ", "");
  const user = await verifyAuth(token!, { appId: process.env.GUARIDOS_APP_ID });
  return Response.json({ ok: true, user });
}

Mail Service

# Send email using Postmark (SMTP relay)
export SMTP_HOST=smtp.postmarkapp.com
export SMTP_PORT=587
export SMTP_USER=$POSTMARK_TOKEN
export SMTP_PASS=$POSTMARK_TOKEN

# Example Node.js email send
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
  host: process.env.SMTP_HOST,
  port: process.env.SMTP_PORT,
  auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS }
});

await transporter.sendMail({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome to GuaridOS',
  text: 'Your account is ready.'
});

Drive (S3 Compatible)

# Upload file using AWS SDK compatible with GuaridOS Drive
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";

const client = new S3Client({
  endpoint: process.env.S3_ENDPOINT,
  region: process.env.S3_REGION,
  credentials: {
    accessKeyId: process.env.S3_ACCESS_KEY,
    secretAccessKey: process.env.S3_SECRET_KEY
  }
});

await client.send(new PutObjectCommand({
  Bucket: process.env.S3_BUCKET,
  Key: "example.txt",
  Body: "Hello from GuaridOS Drive"
}));

Vault (Secrets)

// Client-side encryption before storing in Vault
import crypto from 'crypto';

function encryptData(data: string, key: Buffer) {
  const iv = crypto.randomBytes(16);
  const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
  let encrypted = cipher.update(data, 'utf8', 'hex');
  encrypted += cipher.final('hex');
  return { encrypted, iv: iv.toString('hex') };
}

const key = crypto.randomBytes(32);
const secret = encryptData("My private API key", key);
console.log(secret);

VPN

# Example Flux node config for GuaridOS VPN relay
services:
  vpn-node:
    image: guaridos/vpn-node:latest
    environment:
      - NODE_ID=${FLUX_NODE_ID}
      - BANDWIDTH_LIMIT=100mbps
    ports:
      - "1194:1194/udp"
    restart: always

Chat (Decentralized Messaging)

// Example WebSocket setup for GuaridOS Chat
import WebSocket from 'ws';

const ws = new WebSocket('wss://chat.guaridos.me');
ws.on('open', () => ws.send(JSON.stringify({
  type: 'message',
  user: '[email protected]',
  text: 'Hello World!'
})));

ws.on('message', (msg) => console.log(JSON.parse(msg.toString())));

Ecosystem Benefits via Flux

  • Resilience: Services operate across multiple Flux nodes, avoiding central points of failure.

  • Scalability: Easily scale Mail, Drive, or VPN capacity through Flux Marketplace.

  • Security: Vault & Authenticator provide client-side encryption and blockchain-based identity.

  • Privacy-first UX: VPN + Browser ensure users stay anonymous and protected.

  • Composability: Developers can build on GuaridOS modules like Drive, Vault, or Chat directly.


Last updated