@rivtor/kernel
v1.0.1
Published
Production-ready authentication, payments, and compliance kernel for B2B SaaS
Downloads
81
Maintainers
Readme
@rivtor/kernel
Production-ready authentication, payments, and compliance kernel for B2B SaaS applications.
Overview
@rivtor/kernel is a proprietary governance kernel that automates the hardest parts of EU software compliance:
- Authentication - Secure Supabase auth wrapper with pre-built components
- Payments & VAT - Stripe integration with EU VAT validation (VIES)
- Legal Compliance - GDPR-compliant legal components and data export
- GDPR Deletion - Cascading deletion engine with external API cleanup
- Accessibility - WCAG 2.1 AA compliant components (EAA 2025 ready)
- Data Residency - Egress blocking for EU data compliance
- Audit Logging - Enterprise-grade shadow recording
Installation
npm install @rivtor/kernelQuick Start
Server-Side (API Routes)
import { auth, billing } from '@rivtor/kernel';
// Protect API routes
export async function GET(request: Request) {
const user = await auth.requireUser(request);
return Response.json({ user });
}
// Create Stripe checkout with VAT validation
export async function POST(request: Request) {
const { priceId, vatNumber } = await request.json();
const user = await auth.requireUser(request);
const session = await billing.createCheckoutSession({
priceId,
userId: user.id,
vatNumber, // Optional: EU VAT number for reverse charge
successUrl: '/dashboard?checkout=success',
cancelUrl: '/pricing?checkout=cancelled',
});
return Response.json({ url: session.url });
}Client-Side (React Components)
import { RivtorAuth, CookieConsent } from '@rivtor/kernel/react';
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<CookieConsent />
{children}
</body>
</html>
);
}
// Login page
export default function LoginPage() {
return <RivtorAuth redirectUrl="/dashboard" />;
}Modules
Module A: Vault (Authentication)
Secure Supabase authentication with pre-built components.
import { auth } from '@rivtor/kernel';
// Client-side
await auth.loginWithGoogle();
await auth.logout();
// Server-side
const user = await auth.requireUser(request);
const token = await auth.verifyToken(request);Module B: Register (Payments & Billing)
Stripe integration with EU VAT validation.
import { billing } from '@rivtor/kernel';
// Create checkout with VAT validation
const session = await billing.createCheckoutSession({
priceId: 'price_...',
userId: user.id,
vatNumber: 'DE123456789', // Validates against VIES
});
// Validate VAT number
const isValid = await billing.validateVat('DE123456789');
// Get user invoices
const invoices = await billing.getInvoices(userId);Module C: Shield (Legal Compliance)
GDPR-compliant legal components.
import { PrivacyPolicy, TermsOfService } from '@rivtor/kernel/react';
<PrivacyPolicy
companyName="Acme Inc"
email="[email protected]"
updatedAt="2025-01-01"
/>
<TermsOfService
companyName="Acme Inc"
email="[email protected]"
jurisdiction="Delaware, USA"
/>Module 1: Erasure Engine (GDPR)
One-click user deletion with cascading cleanup.
import { privacy } from '@rivtor/kernel';
// GDPR Article 17 - Right to be Forgotten
const result = await privacy.obliterate(userId);
// Deletes from: users, projects, websites, logs
// Anonymizes: invoices
// Calls: SendGrid, OpenAI APIs
// Export user data (GDPR request)
const data = await privacy.exportUserData(userId);Module 2: EAA Enforcer (Accessibility)
WCAG 2.1 AA compliant components.
import { RivtorButton, RivtorInput, RivtorForm } from '@rivtor/kernel/react';
<RivtorButton aria-label="Submit form">Submit</RivtorButton>
// Automatically validates ARIA labels and contrast
<RivtorInput
label="Email"
type="email"
required
// Automatic label association and error handling
/>Module 3: Sovereignty Shield (Data Residency)
Block data from leaving the EU region.
import { residency } from '@rivtor/kernel';
// middleware.ts
export { middleware } from '@rivtor/kernel/residency';
// All outgoing requests are validated
// Non-EU destinations are blockedModule 4: Audit Log (Enterprise)
Shadow recording for all database mutations.
import { RivtorAuditLog } from '@rivtor/kernel/react';
<RivtorAuditLog
userId={user.id}
filters={{ action: 'UPDATE', table: 'projects' }}
/>Environment Variables
# Supabase (Required)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Stripe (Required)
STRIPE_SECRET_KEY=sk_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_...
STRIPE_WEBHOOK_SECRET=whsec_...
# App Configuration
NEXT_PUBLIC_APP_URL=https://yourapp.com
NEXT_PUBLIC_APP_NAME=Your App
[email protected]
[email protected]
# Data Residency (Optional)
RIVTOR_DATA_RESIDENCY_ENABLED=true
RIVTOR_DATA_REGION=eu
RIVTOR_RESIDENCY_STRICT_MODE=true
# Accessibility (Optional)
RIVTOR_ENFORCE_CONTRAST=true
RIVTOR_ENFORCE_ARIA=true
RIVTOR_CONTRAST_RATIO=4.5Philosophy
The Rivtor Kernel is built on the principle that AI should not write auth, payments, or compliance code.
These domains require:
- Deep security knowledge
- Legal compliance expertise
- Production hardening
- Continuous updates for regulations
By providing pre-built, tested, and compliant modules, we enable AI to focus on business logic while ensuring the critical infrastructure is secure and compliant.
License
MIT © Rivtor
Support
- Email: [email protected]
- Documentation: GitHub Wiki
Built with care by Rivtor
