
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@gftdcojp/gftd-orm
Advanced tools
Enterprise-grade real-time data platform with ksqlDB, inspired by Supabase architecture
🚀 Enterprise-grade real-time data platform with comprehensive authentication
A comprehensive TypeScript-first platform that combines ksqlDB real-time data processing with enterprise-grade authentication. Perfect drop-in replacement for @auth0/nextjs-auth0
with zero breaking changes and advanced enterprise features through separate authentication package @gftdcojp/gftd-auth.
GFTD ORM is an enterprise-grade platform under active development with:
🎯 Zero Migration Effort: Replace @auth0/nextjs-auth0
in 2 steps
🔐 Enterprise Security: Organizations, RBAC, Back-Channel Logout
🌐 Edge Runtime Support: Vercel, Cloudflare, Deno Deploy
📊 Real-time Data: ksqlDB + Schema Registry + WebSocket streaming
🛡️ Production Ready: Custom session stores, audit logging, rate limiting
🎪 100% Tested: 206 tests passing, complete quality assurance
Now available as separate package: @gftdcojp/gftd-auth
✅ Perfect Drop-in Replacement
@auth0/nextjs-auth0
getSession
, getAccessToken
, updateSession
, withMiddlewareAuthRequired
✅ Enterprise Extensions
✅ Developer Experience
useUser
, useAccessToken
, useLogout
withPageAuthRequired
, withApiAuthRequired
📦 Installation: npm install @gftdcojp/gftd-auth
(Q1 2025)
# Note: Package is under development. Use local development setup:
git clone https://github.com/gftdcojp/gftd-orm.git
cd gftd-orm
pnpm install && pnpm build
# Or use the fallback implementation from examples/
# Full npm package coming Q1 2025
⚡ Already using nextjs-auth0? Jump to 2-Step Migration Guide
Create .env.local
with your Auth0 credentials:
# Required - Auth0 Application Settings
# 🔐 統一認証: auth.gftd.ai ドメインとCLIENT_IDは SDK にデフォルト組み込み済み
# カスタム設定が必要な場合のみ環境変数を設定してください
AUTH0_DOMAIN=auth.gftd.ai # SDKデフォルト: auth.gftd.ai
AUTH0_CLIENT_ID=k0ziPQ6IkDxE1AUSvzx5PwXtnf4y81x0 # SDKデフォルト: k0ziPQ6IkDxE1AUSvzx5PwXtnf4y81x0
AUTH0_CLIENT_SECRET=your-client-secret # 必須: 個別設定
AUTH0_SECRET=your-32-char-secret-key # 必須: セッション暗号化キー(32文字以上)
AUTH0_BASE_URL=http://localhost:3000 # 必須: アプリケーションのベースURL
# Optional - Advanced Features
# AUTH0_AUDIENCE=https://auth.gftd.ai/api/v2/ # SDKデフォルト: https://auth.gftd.ai/api/v2/
# AUTH0_SCOPE=openid profile email read:users # SDKデフォルト: openid profile email
Option A: Simple Setup (Recommended)
// middleware.ts
import { withMiddlewareAuthRequired } from '@gftdcojp/gftd-auth/nextjs-auth0';
export default withMiddlewareAuthRequired();
export const config = {
matcher: [
'/((?!api/auth|_next/static|_next/image|favicon.ico).*)',
],
};
Option B: Direct Middleware
// middleware.ts
import { auth0Middleware } from '@gftdcojp/gftd-auth/nextjs-auth0';
export default auth0Middleware;
export const config = {
matcher: [
'/((?!api/auth|_next/static|_next/image|favicon.ico).*)',
],
};
App Router (app/layout.tsx)
import { UserProvider } from '@gftdcojp/gftd-auth/client';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
<UserProvider>
{children}
</UserProvider>
</body>
</html>
);
}
Pages Router (pages/_app.tsx)
import { UserProvider } from '@gftdcojp/gftd-auth/client';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return (
<UserProvider>
<Component {...pageProps} />
</UserProvider>
);
}
⚠️ 重要: Next.js 14 App RouterのRoute HandlerではNextResponse.next()
が使用できません。新しいRoute Handler専用APIを使用してください。
Option A: 統合Route Handler (推奨)
// app/api/auth/[...auth0]/route.ts
import { handleAuth } from '@gftdcojp/gftd-auth/nextjs-auth0';
import { NextRequest } from 'next/server';
export async function GET(request: NextRequest, { params }: { params: { auth0: string[] } }) {
return handleAuth(request, params.auth0[0]);
}
export async function POST(request: NextRequest, { params }: { params: { auth0: string[] } }) {
return handleAuth(request, params.auth0[0]);
}
Option B: 個別Route Handler
// app/api/auth/login/route.ts
import { handleAuthLogin } from '@gftdcojp/gftd-auth/nextjs-auth0';
export async function GET(request: NextRequest) {
return handleAuthLogin(request);
}
// app/api/auth/logout/route.ts
import { handleAuthLogout } from '@gftdcojp/gftd-auth/nextjs-auth0';
export async function GET(request: NextRequest) {
return handleAuthLogout(request);
}
// app/api/auth/callback/route.ts
import { handleAuthCallback } from '@gftdcojp/gftd-auth/nextjs-auth0';
export async function GET(request: NextRequest) {
return handleAuthCallback(request);
}
// app/api/auth/me/route.ts
import { handleAuthMe } from '@gftdcojp/gftd-auth/nextjs-auth0';
export async function GET(request: NextRequest) {
return handleAuthMe(request);
}
用途 | API | ファイル場所 | 説明 |
---|---|---|---|
Middleware | auth0Middleware | middleware.ts | ページアクセス時の認証チェック |
Route Handler | handleAuth | /api/auth/*/route.ts | 認証エンドポイントの処理 |
✅ Middleware(middleware.ts)
// middleware.ts - ページの認証保護
import { auth0Middleware } from '@gftdcojp/gftd-orm';
export default auth0Middleware;
export const config = {
matcher: [
'/((?!api/auth|_next/static|_next/image|favicon.ico).*)',
],
};
✅ Route Handler(/api/auth/*/route.ts)
// app/api/auth/[...auth0]/route.ts - 認証エンドポイント処理
import { handleAuth } from '@gftdcojp/gftd-orm';
export async function GET(request: NextRequest, { params }: { params: { auth0: string[] } }) {
return handleAuth(request, params.auth0[0]);
}
❌ Next.js App Routerでこれは動作しません:
// ❌ Route HandlerでNextResponse.next()を使用
export async function GET(request: NextRequest) {
return auth0Client.middleware(request); // Error: NextResponse.next() は使用不可
}
✅ 正しい実装:
// ✅ Route Handler専用APIを使用
export async function GET(request: NextRequest) {
return handleAuthCallback(request); // 完結したResponseを返す
}
📚 参考リンク:
Login/Logout Button
// components/AuthButton.tsx
import { useUser, useLogout } from '@gftdcojp/gftd-auth/client';
export default function AuthButton() {
const { user, isLoading } = useUser();
const logout = useLogout();
if (isLoading) return <div>Loading...</div>;
if (user) {
return (
<div className="flex items-center gap-4">
<img src={user.user_metadata?.picture} alt="Profile" className="w-8 h-8 rounded-full" />
<span>Welcome, {user.user_metadata?.name}!</span>
<button
onClick={() => logout()}
className="btn btn-ghost"
>
Logout
</button>
</div>
);
}
return (
<div className="flex gap-2">
<a href="/auth/login" className="btn btn-primary">Login</a>
<a href="/auth/login?screen_hint=signup" className="btn btn-secondary">Sign Up</a>
</div>
);
}
Protected Page Component
// app/dashboard/page.tsx
import { withPageAuthRequired, useUser } from '@gftdcojp/gftd-orm/client';
export default withPageAuthRequired(function Dashboard() {
const { user } = useUser();
return (
<div>
<h1>Dashboard</h1>
<p>Welcome back, {user?.name}!</p>
<p>Email: {user?.email}</p>
<p>User ID: {user?.sub}</p>
</div>
);
});
Protected API Route
// app/api/profile/route.ts
import { withApiAuthRequired } from '@gftdcojp/gftd-orm/client';
import { getSession, getAccessToken } from '@gftdcojp/gftd-orm/nextjs-auth0';
export const GET = withApiAuthRequired(async function handler(req) {
const session = await getSession();
const { accessToken } = await getAccessToken() || {};
return Response.json({
user: session?.user,
tokenInfo: {
hasToken: !!accessToken,
expiresAt: session?.expiresAt,
},
message: 'This is a protected API route',
});
});
Server-side Data Fetching
// app/admin/page.tsx (Server Component)
import { getSession } from '@gftdcojp/gftd-orm/nextjs-auth0';
import { redirect } from 'next/navigation';
export default async function AdminPage() {
const session = await getSession();
if (!session) {
redirect('/auth/login');
}
// Check admin role
const userRoles = session.user.metadata?.roles || [];
if (!userRoles.includes('admin')) {
redirect('/unauthorized');
}
return (
<div>
<h1>Admin Dashboard</h1>
<p>Welcome, {session.user.name}</p>
</div>
);
}
GFTD ORMプロジェクトでは、GitHub IssuesでClaude Codeを使用した自動化処理を設定できます。
GitHub リポジトリのSettings > Secrets and variables > Actions で以下のシークレットを設定してください:
CLAUDE_API_KEY
: Claude APIキー(Anthropic Consoleで取得)以下の方法でClaude Codeを実行できます:
方法1: ラベルによる自動実行
claude-code
ラベルを付与すると自動的にClaude Codeが実行されます方法2: コメントによる実行
@claude-code
を含むコメントを投稿すると実行されますClaude Codeは以下の処理を自動実行します:
# Issue例
Title: "パフォーマンスの改善"
Labels: ["claude-code", "enhancement"]
Body:
リアルタイムデータ処理のパフォーマンスを向上させたい。
具体的には以下の課題があります:
- WebSocketの接続数が多い場合の処理遅延
- メモリ使用量の最適化
- データベースクエリの効率化
@claude-code 分析して改善提案をお願いします。
Perfect for B2B SaaS applications with multiple tenants.
Organization Management API
import { Auth0Integration } from '@gftdcojp/gftd-orm/auth0-integration';
const auth0 = Auth0Integration.getInstance();
// Create organization
const org = await auth0.createOrganization({
name: 'acme-corp',
display_name: 'ACME Corporation',
branding: {
logo_url: 'https://example.com/logo.png',
colors: {
primary: '#FF6B6B',
page_background: '#F8F9FA',
},
},
metadata: {
tier: 'enterprise',
max_users: 1000,
},
});
// Invite members with roles
const invitation = await auth0.createOrganizationInvitation(org.id, {
inviter: { name: 'Admin' },
invitee: { email: 'user@example.com' },
client_id: process.env.AUTH0_CLIENT_ID!,
roles: ['org:admin', 'billing:manager'],
send_invitation_email: true,
ttl_sec: 86400, // 24 hours
});
// Manage members and roles
await auth0.addOrganizationMembers(org.id, ['auth0|user123']);
await auth0.addOrganizationMemberRoles(org.id, 'auth0|user123', ['org:admin']);
Organization-scoped Authentication
// components/OrgSelector.tsx
import { useRouter } from 'next/navigation';
export function OrgSelector({ organizations }: { organizations: Organization[] }) {
const router = useRouter();
const handleOrgLogin = (orgId: string) => {
// Redirect to organization-specific login
router.push(`/auth/login?organization=${orgId}&returnTo=/dashboard`);
};
return (
<div className="grid gap-4">
{organizations.map((org) => (
<div key={org.id} className="border rounded-lg p-4">
<img src={org.branding?.logo_url} alt={org.display_name} className="h-12" />
<h3>{org.display_name}</h3>
<button
onClick={() => handleOrgLogin(org.id)}
className="btn btn-primary"
>
Sign in to {org.display_name}
</button>
</div>
))}
</div>
);
}
Enterprise-grade session persistence with multiple storage backends.
Database Session Store (Recommended for Production)
// lib/sessionStore.ts
import { SessionStoreFactory } from '@gftdcojp/gftd-orm/auth0-session-store';
import mysql from 'mysql2/promise';
// Create database connection
const db = await mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
});
// Create session store
const sessionStore = SessionStoreFactory.createDatabaseStore(db, {
tableName: 'auth0_sessions',
schemaName: 'auth',
cleanupInterval: 3600, // Clean expired sessions every hour
});
// Initialize schema (run once)
await sessionStore.createSchema();
// Health check
const health = await sessionStore.health();
console.log(health); // { status: 'ok', message: '1,234 active sessions' }
Redis Session Store (High Performance)
import { SessionStoreFactory } from '@gftdcojp/gftd-orm/auth0-session-store';
import Redis from 'ioredis';
const redis = new Redis({
host: process.env.REDIS_HOST,
port: parseInt(process.env.REDIS_PORT || '6379'),
password: process.env.REDIS_PASSWORD,
db: 0,
});
const sessionStore = SessionStoreFactory.createRedisStore(redis, {
keyPrefix: 'auth0:session:',
defaultTtl: 7 * 24 * 60 * 60, // 7 days
enableCompression: true,
});
// Usage in middleware
const client = new NextJsAuth0Client({
sessionStore,
// ... other config
});
Memory Store (Development Only)
import { SessionStoreFactory } from '@gftdcojp/gftd-orm/auth0-session-store';
const sessionStore = SessionStoreFactory.createMemoryStore({
maxSessions: 10000,
cleanupIntervalMs: 300000, // 5 minutes
});
Deploy authentication to the edge for ultra-low latency worldwide.
Vercel Edge Functions
// middleware.ts
export { auth0Middleware as default } from '@gftdcojp/gftd-orm/nextjs-auth0-edge';
export const config = {
matcher: [
'/((?!api/auth|_next/static|_next/image|favicon.ico).*)',
],
runtime: 'edge',
};
Cloudflare Workers
// worker.ts
import { createEdgeAuth0Client } from '@gftdcojp/gftd-orm/nextjs-auth0-edge';
const client = createEdgeAuth0Client({
domain: process.env.AUTH0_DOMAIN!,
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
appBaseUrl: process.env.AUTH0_BASE_URL!,
secret: process.env.AUTH0_SECRET!,
});
export default {
async fetch(request: Request): Promise<Response> {
return await client.handleRequest(request);
},
};
Deno Deploy
// main.ts
import { createEdgeAuth0Client } from 'npm:@gftdcojp/gftd-orm/nextjs-auth0-edge';
const client = createEdgeAuth0Client({
domain: Deno.env.get('AUTH0_DOMAIN')!,
clientId: Deno.env.get('AUTH0_CLIENT_ID')!,
clientSecret: Deno.env.get('AUTH0_CLIENT_SECRET')!,
appBaseUrl: Deno.env.get('AUTH0_BASE_URL')!,
secret: Deno.env.get('AUTH0_SECRET')!,
});
Deno.serve(client.handleRequest);
Enterprise-grade session management with automatic session invalidation.
Setup in Auth0 Dashboard
https://your-app.com/auth/backchannel-logout
Automatic Handling (Zero Config)
// middleware.ts - Sessions are automatically invalidated
import { auth0Middleware } from '@gftdcojp/gftd-orm/nextjs-auth0';
export default auth0Middleware; // Back-channel logout is built-in
export const config = {
matcher: [
'/((?!api/auth|_next/static|_next/image|favicon.ico).*)',
],
};
Manual Session Management
// app/api/admin/invalidate-sessions/route.ts
import { Auth0Integration } from '@gftdcojp/gftd-orm/auth0-integration';
export async function POST(request: Request) {
const { userId } = await request.json();
const auth0 = Auth0Integration.getInstance();
// Invalidate all sessions for a user
await auth0.invalidateUserSessions(userId);
return Response.json({ success: true });
}
Powerful stream processing with ksqlDB and real-time TypeScript types.
Automatic Type Generation
# Generate TypeScript types from ksqlDB schemas
npx gftd-orm generate-types --table USERS_TABLE --output ./types
npx gftd-orm generate-types --table ORDERS_STREAM --output ./types
# Generate all types
npx gftd-orm generate-all --output ./types --watch
Real-time Data Streaming
import { createClient } from '@gftdcojp/gftd-orm';
// Initialize client with ksqlDB and Schema Registry
const client = createClient({
url: 'http://localhost:8088',
database: {
ksql: {
url: 'http://localhost:8088',
apiKey: process.env.KSQL_API_KEY,
},
schemaRegistry: {
url: 'http://localhost:8081',
apiKey: process.env.SCHEMA_REGISTRY_API_KEY,
},
},
realtime: {
url: 'ws://localhost:8088',
apiKey: process.env.REALTIME_API_KEY,
},
});
// Type-safe real-time subscriptions
const userActivityChannel = client.channel<UserActivity>('user_activity_stream');
userActivityChannel.on('insert', (payload) => {
console.log('New user activity:', payload); // Fully typed
});
userActivityChannel.on('update', (payload) => {
console.log('Updated activity:', payload);
});
// React Hook integration
import { useRealtimeSubscription } from '@gftdcojp/gftd-orm/hooks';
function ActivityFeed() {
const { data, isLoading, error } = useRealtimeSubscription(
client,
'user_activity_stream'
);
if (isLoading) return <div>Loading...</div>;
if (error) return <div>Error: {error.message}</div>;
return (
<div>
{data.map((activity) => (
<div key={activity.id}>{activity.description}</div>
))}
</div>
);
}
Stream Processing Queries
// Execute ksqlDB queries with type safety
import { executeQuery } from '@gftdcojp/gftd-orm';
const result = await executeQuery(`
SELECT
user_id,
COUNT(*) as activity_count,
WINDOWSTART() as window_start
FROM user_activity_stream
WINDOW TUMBLING (SIZE 1 HOUR)
GROUP BY user_id
EMIT CHANGES;
`);
// Real-time analytics dashboard
const analytics = client.channel('user_analytics');
analytics.on('update', (metrics) => {
updateDashboard(metrics); // Real-time dashboard updates
});
GFTD ORM is designed as a perfect drop-in replacement for @auth0/nextjs-auth0
with zero breaking changes and additional enterprise features.
⏱️ Migration Time: 2-5 minutes
Breaking Changes: None
Code Changes: Just import paths
# Remove old package
npm uninstall @auth0/nextjs-auth0
# Install GFTD ORM
npm install @gftdcojp/gftd-orm
Find & Replace in your codebase:
Old Import | New Import |
---|---|
@auth0/nextjs-auth0/client | @gftdcojp/gftd-orm/client |
@auth0/nextjs-auth0 | @gftdcojp/gftd-orm/nextjs-auth0 |
Client-side (React Hooks & Components)
// Find this:
import { useUser, UserProvider, withPageAuthRequired } from '@auth0/nextjs-auth0/client';
// Replace with:
import { useUser, UserProvider, withPageAuthRequired } from '@gftdcojp/gftd-orm/client';
Server-side (API Routes & Server Components)
// Find this:
import { getSession, withApiAuthRequired, getAccessToken, updateSession } from '@auth0/nextjs-auth0';
// Replace with:
import { getSession, withApiAuthRequired, getAccessToken, updateSession } from '@gftdcojp/gftd-orm/nextjs-auth0';
Middleware
// Find this:
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';
// Replace with:
import { withMiddlewareAuthRequired } from '@gftdcojp/gftd-orm/nextjs-auth0';
That's it! Your app should work exactly as before. To verify the migration:
npm run dev
/auth/login
Once migrated, you can gradually adopt new enterprise features:
// Enable Organizations (B2B)
const orgId = await auth0.createOrganization({
name: 'acme-corp',
display_name: 'ACME Corporation',
});
// Use Edge Runtime
export const config = {
runtime: 'edge', // Add this line
};
// Custom Session Store
import { SessionStoreFactory } from '@gftdcojp/gftd-orm/auth0-session-store';
const sessionStore = SessionStoreFactory.createRedisStore(redis);
Component Type | nextjs-auth0 | GFTD ORM |
---|---|---|
🎯 Client Components | @auth0/nextjs-auth0/client | @gftdcojp/gftd-orm/client |
🖥️ Server Components | @auth0/nextjs-auth0 | @gftdcojp/gftd-orm/nextjs-auth0 |
🔧 Edge Runtime | Not supported | @gftdcojp/gftd-orm/nextjs-auth0-edge |
Server-side functions (from @gftdcojp/gftd-orm/nextjs-auth0
):
import {
getSession, // Get user session
getAccessToken, // Get access token
updateSession, // Update session
withApiAuthRequired, // Protect API routes
withPageAuthRequired, // Protect pages
withMiddlewareAuthRequired, // Protect middleware
auth0Middleware, // Direct middleware
} from '@gftdcojp/gftd-orm/nextjs-auth0';
Client-side hooks (from @gftdcojp/gftd-orm/client
):
import {
useUser, // Get current user
useAccessToken, // Get access token
useLogout, // Logout function
UserProvider, // Context provider
withPageAuthRequired, // Protect components
withApiAuthRequired, // Protect API routes
AuthenticatedLayout, // Layout with auth
} from '@gftdcojp/gftd-orm/client';
From @gftdcojp/gftd-orm/client
:
// React Hooks
import {
useUser, // Get current user
useAccessToken, // Get access token
useLogout, // Logout function
} from '@gftdcojp/gftd-orm/client';
// React Components
import {
UserProvider, // Context provider
AuthenticatedLayout, // Layout with auth check
} from '@gftdcojp/gftd-orm/client';
// Protection HOCs
import {
withPageAuthRequired, // Protect pages
withApiAuthRequired, // Protect API routes
} from '@gftdcojp/gftd-orm/client';
Before (nextjs-auth0):
// app/layout.tsx
import { UserProvider } from '@auth0/nextjs-auth0/client';
// components/Profile.tsx
import { useUser } from '@auth0/nextjs-auth0/client';
// app/dashboard/page.tsx
import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
// app/api/protected/route.ts
import { withApiAuthRequired, getSession } from '@auth0/nextjs-auth0';
After (GFTD ORM):
// app/layout.tsx
import { UserProvider } from '@gftdcojp/gftd-orm/client';
// components/Profile.tsx
import { useUser } from '@gftdcojp/gftd-orm/client';
// app/dashboard/page.tsx
import { withPageAuthRequired } from '@gftdcojp/gftd-orm/client';
// app/api/protected/route.ts
import { withApiAuthRequired } from '@gftdcojp/gftd-orm/client';
import { getSession } from '@gftdcojp/gftd-orm/nextjs-auth0';
Your existing Auth0 environment variables work as-is:
AUTH0_DOMAIN=your-domain.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
AUTH0_SECRET=your-32-char-secret
AUTH0_BASE_URL=http://localhost:3000
❌ Cannot find module '@gftdcojp/gftd-orm/client'
✅ Solution: This error occurs when the package is not yet published. Use our fallback implementation:
// Use the working example with fallback implementation
import { useGftdOrmExample } from './examples/gftd-orm-example';
// This automatically detects if the package is available and falls back to mock implementation
const { client, isConnected, error } = useGftdOrmExample(config);
Once the package is published, use correct import paths:
@gftdcojp/gftd-orm/client
@gftdcojp/gftd-orm/nextjs-auth0
@gftdcojp/gftd-orm/nextjs-auth0-edge
❌ 'UserProvider' has no exported member
✅ Solution: Import from client path:
// ✅ Correct
import { UserProvider } from '@gftdcojp/gftd-orm/client';
// ❌ Wrong
import { UserProvider } from '@gftdcojp/gftd-orm';
❌ Middleware not working on Edge Runtime
✅ Solution: Use Edge-specific import:
// ✅ For Edge Runtime
import { auth0Middleware } from '@gftdcojp/gftd-orm/nextjs-auth0-edge';
// ✅ For Node.js Runtime
import { auth0Middleware } from '@gftdcojp/gftd-orm/nextjs-auth0';
❌ Session not persisting
✅ Solution: Check AUTH0_SECRET length:
# ❌ Too short
AUTH0_SECRET=short
# ✅ Minimum 32 characters
AUTH0_SECRET=your-32-character-secret-key-here
❌ React Hydration Error (Server/Client Mismatch)
✅ Solution: Use isMounted pattern to prevent SSR/CSR mismatch:
'use client';
import { useState, useEffect } from 'react';
import { useUser } from '@gftdcojp/gftd-orm/client';
export function AuthComponent() {
const { user, isLoading } = useUser();
const [isMounted, setIsMounted] = useState(false);
useEffect(() => {
setIsMounted(true);
}, []);
// Prevent hydration mismatch
if (!isMounted) {
return <div className="text-gray-500">読み込み中...</div>;
}
if (isLoading) return <div>Loading...</div>;
return user ? (
<div>Welcome, {user.name}!</div>
) : (
<a href="/auth/login">Login</a>
);
}
❌ Port Conflict (EADDRINUSE: address already in use)
✅ Solution: Kill existing processes:
# Find and kill processes using port 3000
lsof -ti:3000 | xargs kill -9
# Or kill all node/next processes
pkill -f "node.*3000|next.*dev"
# Start on different port if needed
PORT=3001 pnpm dev
❌ API Route Implementation Issues
🔄 Updated Solution: Use the latest API implementation:
// ❌ Old approach (from earlier documentation)
import { handleAuth } from '@gftdcojp/gftd-orm/nextjs-auth0';
export const { GET, POST } = handleAuth();
// ✅ Latest correct implementation
import { createNextJsAuth0Client, auth0Middleware } from '@gftdcojp/gftd-orm/nextjs-auth0';
// Option 1: Direct middleware (recommended)
export default auth0Middleware;
// Option 2: Custom client configuration
const client = createNextJsAuth0Client({
domain: process.env.AUTH0_DOMAIN!,
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
appBaseUrl: process.env.AUTH0_BASE_URL!,
secret: process.env.AUTH0_SECRET!,
});
export const GET = client.middleware.bind(client);
export const POST = client.middleware.bind(client);
❌ Environment Variables Missing
✅ Required Setup: Ensure these environment variables are configured:
# Required (must be individually configured)
AUTH0_CLIENT_SECRET=your-client-secret # Get from Auth0 Dashboard
AUTH0_SECRET=your-32-char-secret-key # Session encryption (32+ chars)
AUTH0_BASE_URL=http://localhost:3000 # Your app's base URL
# Optional (SDK defaults available)
# AUTH0_DOMAIN=auth.gftd.ai # SDK default
# AUTH0_CLIENT_ID=k0ziPQ6IkDxE1AUSvzx5PwXtnf4y81x0 # SDK default
# AUTH0_AUDIENCE=https://auth.gftd.ai/api/v2/ # SDK default
Once migrated, you get access to enterprise features:
// Organizations support
import { createAuth0Client } from '@gftdcojp/gftd-orm/auth0-integration';
// Edge runtime support
import { createEdgeAuth0Client } from '@gftdcojp/gftd-orm/nextjs-auth0-edge';
// Custom session stores
import { SessionStoreFactory } from '@gftdcojp/gftd-orm/auth0-session-store';
// Real-time data platform
import { createClient } from '@gftdcojp/gftd-orm';
┌─────────────────────────────────────────────────────────────────┐
│ GFTD ORM Platform │
├─────────────────────────────────────────────────────────────────┤
│ │
│ 🔐 Auth0 Integration 🏢 Organizations 🌐 Edge Runtime │
│ 📊 Real-time Data 🗄️ Session Store 🔄 Back-Channel │
│ ⚡ Type Generation 🛡️ Authorization 📋 Audit Logs │
│ │
└─────────────────────────────────────────────────────────────────┘
Metric | GFTD ORM | nextjs-auth0 |
---|---|---|
Session Lookup | < 1ms | ~2ms |
JWT Verification | < 2ms | ~3ms |
Edge Runtime | ✅ | ❌ |
Organizations | ✅ | ❌ |
TypeScript Types | ✅ | ✅ |
Feature | nextjs-auth0 | GFTD ORM | Import Path |
---|---|---|---|
Server-side Sessions | ✅ | ✅ | @gftdcojp/gftd-orm/nextjs-auth0 |
Next.js Middleware | ✅ | ✅ | @gftdcojp/gftd-orm/nextjs-auth0 |
Built-in Routes | ✅ | ✅ | @gftdcojp/gftd-orm/nextjs-auth0 |
React Hooks (useUser ) | ✅ | ✅ | @gftdcojp/gftd-orm/client |
React Provider (UserProvider ) | ✅ | ✅ | @gftdcojp/gftd-orm/client |
API Protection | ✅ | ✅ | @gftdcojp/gftd-orm/client |
Page Protection | ✅ | ✅ | @gftdcojp/gftd-orm/client |
Cookie Auth | ✅ | ✅ | @gftdcojp/gftd-orm/nextjs-auth0 |
TypeScript Support | ✅ | ✅ | All paths |
Configuration Validation | ✅ | ✅ | @gftdcojp/gftd-orm/nextjs-auth0 |
Feature | nextjs-auth0 | GFTD ORM |
---|---|---|
Organizations | ❌ | ✅ Full B2B support |
Back-Channel Logout | ❌ | ✅ Enterprise-grade |
Edge Runtime | ❌ | ✅ Vercel/Cloudflare/Deno |
Custom Session Store | ❌ | ✅ Database/Redis/Memory |
Authorization Extension | ❌ | ✅ Groups/Roles/Permissions |
Real-time Data | ❌ | ✅ ksqlDB integration |
Audit Logging | ❌ | ✅ Comprehensive logging |
Type Generation | ❌ | ✅ Automatic TypeScript |
// auth0.config.ts
export const auth0Config = {
// Basic settings
domain: process.env.AUTH0_DOMAIN!,
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
secret: process.env.AUTH0_SECRET!,
baseUrl: process.env.AUTH0_BASE_URL!,
// Advanced settings
scope: 'openid profile email',
audience: 'https://auth.gftd.ai/api/v2/',
// Session configuration
session: {
absoluteLifetime: 7 * 24 * 60 * 60, // 7 days
rollingDuration: 24 * 60 * 60, // 24 hours
rolling: true,
cookie: {
secure: true,
sameSite: 'lax',
httpOnly: true,
},
},
// Organizations
organization: {
paramName: 'organization',
acceptInvitations: true,
},
// Back-channel logout
backchannelLogout: {
enabled: true,
path: '/auth/backchannel-logout',
},
// Custom session store
sessionStore: sessionStore, // Your custom store
};
# Install dependencies
pnpm install
# Development
pnpm dev
# Build
pnpm build
# Test
pnpm test
# Type generation
pnpm generate-types
Phase | Status | Completion | Target Date |
---|---|---|---|
Phase 1: Foundation | ✅ Complete | 100% | ✅ Completed |
Phase 2: Auth0 Integration | 🚧 In Progress | 30% | February 2025 |
Phase 3: Production Release | ⏳ Planned | 0% | March 2025 |
Priority 1 Tasks (February 2025)
NextJsAuth0Client.getSession()
implementationNextJsAuth0Client.middleware()
implementationlogin
, logout
, callback
)Priority 2 Tasks (March 2025)
NPM Package Release
🎯 Production Readiness Criteria
Current Status: 70% Complete - Core features in development
examples/gftd-orm-example.tsx
For immediate use:
# Clone and build locally
git clone https://github.com/gftdcojp/gftd-orm.git
cd gftd-orm
pnpm install
pnpm build
# Use the fallback implementation
cp examples/gftd-orm-example.tsx your-project/
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
@auth0/nextjs-auth0
GFTD ORM integrates with Weblate for comprehensive translation management, supporting multi-language applications with enterprise-grade features.
Setup Translation Client
// app/layout.tsx
import { TranslatorClient, translatorConfig } from '@gftdcojp/gftd-orm/translator';
// Initialize translator
const translator = TranslatorClient.getInstance(translatorConfig.fromEnv());
// Set current user for tenant-specific translations
translator.setCurrentUser(user);
React Hook for Translation
// components/TranslatedComponent.tsx
import { useTranslator } from '@gftdcojp/gftd-orm/hooks';
export function TranslatedComponent() {
const { t, currentLanguage, changeLanguage, supportedLanguages } = useTranslator({
language: 'en',
namespace: 'components',
// No API key or user required for read-only operations
});
return (
<div>
<h1>{t('welcome.title', { name: 'User' })}</h1>
<p>{t('welcome.description')}</p>
<select value={currentLanguage} onChange={(e) => changeLanguage(e.target.value)}>
{supportedLanguages.map(lang => (
<option key={lang} value={lang}>{lang}</option>
))}
</select>
</div>
);
}
Translation Management (Admin)
// pages/admin/translations.tsx
import { useTranslatorAdmin } from '@gftdcojp/gftd-orm/hooks';
export function TranslationAdmin() {
const {
projects,
createProject,
initializeTenantProject,
canManage
} = useTranslatorAdmin();
if (!canManage) return <div>Access denied</div>;
const handleCreateTenantProject = async (tenantId: string) => {
await initializeTenantProject(tenantId);
};
return (
<div>
<h1>Translation Management</h1>
{projects.map(project => (
<div key={project.slug}>
<h2>{project.name}</h2>
<p>Languages: {project.languages.join(', ')}</p>
<p>Progress: {project.stats.translated_percent}%</p>
</div>
))}
<button onClick={() => handleCreateTenantProject('tenant-123')}>
Create Tenant Project
</button>
</div>
);
}
Translation Statistics
// components/TranslationStats.tsx
import { useTranslationStats } from '@gftdcojp/gftd-orm/hooks';
export function TranslationStats({ language }: { language: string }) {
const { stats, progressInfo, loading } = useTranslationStats(language);
if (loading) return <div>Loading...</div>;
return (
<div className="translation-stats">
<h3>Translation Progress: {language}</h3>
<div className="progress-bar">
<div
className="progress-fill"
style={{ width: `${progressInfo?.translatedPercent || 0}%` }}
/>
</div>
<p>
{progressInfo?.translated} / {progressInfo?.total} strings translated
</p>
<p>
{progressInfo?.wordsTranslated} / {progressInfo?.wordsTotal} words
</p>
</div>
);
}
Environment Variables
# Weblate Configuration
GFTD_WEBLATE_API_URL=https://weblate-gftd-ai.fly.dev/api
GFTD_WEBLATE_API_KEY=
# ↑ APIキーは書き込み操作(翻訳編集など)に必要
# 読み込み専用なら空でも動作します
GFTD_WEBLATE_PROJECT_SLUG=scap-gftd-ai
GFTD_WEBLATE_COMPONENT_SLUG=messages
GFTD_WEBLATE_DEFAULT_LANGUAGE=en
GFTD_WEBLATE_SUPPORTED_LANGUAGES=en,ja,zh-CN,es,fr,de,it,ko,pt,ru
GFTD_WEBLATE_CACHE_ENABLED=true
GFTD_WEBLATE_CACHE_TTL=3600
GFTD_WEBLATE_TENANT_SPECIFIC=false
Quick Start (No Setup Required)
// Works immediately without any configuration
const translator = TranslatorClient.getInstance();
// Fetch translations from public Weblate instance
const translations = await translator.getTranslations('en');
const stats = await translator.getTranslationStats('ja');
// Use in React components
const { t, currentLanguage, changeLanguage } = useTranslator();
Operation | API Key Required | Description |
---|---|---|
Read translations | ❌ No | Fetch existing translations |
View statistics | ❌ No | Get translation progress |
Search translations | ❌ No | Find specific strings |
Update translations | ✅ Yes | Edit translation strings |
Create projects | ✅ Yes | Add new translation projects |
Manage components | ✅ Yes | Configure translation components |
Option 1: Try with Fallback Implementation (Works immediately)
// No installation needed - works with fallback implementation
import { useGftdOrmExample } from './examples/gftd-orm-example';
const config = {
url: 'http://localhost:8088',
key: 'demo-key',
// ... other configuration
};
const { client, isConnected, error } = useGftdOrmExample(config);
Option 2: Install Package (Once published)
npm install @gftdcojp/gftd-orm
Follow the Quick Start Guide → 5 minutes setup
Current Status: Migration guide available, full package coming Q1 2025
# Current: Use development setup
git clone https://github.com/gftdcojp/gftd-orm.git
cd gftd-orm && pnpm install && pnpm build
# Future: Once published (Q1 2025)
# npm uninstall @auth0/nextjs-auth0
# npm install @gftdcojp/gftd-orm
Follow the Migration Guide → 2 steps planned, Auth0 integration in development
Join our development journey and help shape the future of enterprise-grade data platforms!
Current Reality Check (January 2025)
For Early Adopters
examples/
for testingProduction Use: Recommended to wait for Q1 2025 release with complete Auth0 integration
GFTD ORMは以下のパッケージ構成で提供されます:
Package | Description | Status |
---|---|---|
@gftdcojp/gftd-orm | メインプラットフォーム(リアルタイムデータ、翻訳) | ✅ Active |
@gftdcojp/gftd-auth | 認証システム(Auth0統合) | 🚧 開発中 |
@gftdcojp/ksqldb-orm | ksqlDBコア機能 | ✅ Active |
v1.752407329以降、認証機能は専用パッケージに移行されました:
@gftdcojp/gftd-auth
@gftdcojp/gftd-orm/nextjs-auth0
移行の利点:
FAQs
Enterprise-grade real-time data platform with ksqlDB, inspired by Supabase architecture
The npm package @gftdcojp/gftd-orm receives a total of 4 weekly downloads. As such, @gftdcojp/gftd-orm popularity was classified as not popular.
We found that @gftdcojp/gftd-orm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.