How hamzabhiinder/openwebuibackend works
Project Type and Purpose
• This is a monolithic backend API (“OpenWebUI Backend”) built with Node.js, Express, and Prisma.
• It provides authentication, chat management, file processing, AI integration, payment processing, and admin features for a full-stack platform.
File-Structure–Based Architectural Insights
• Top-level “src/” contains:
• config/ – DB and Passport setup
• middleware/ – JWT auth, optional auth, file upload, usage tracking
• routes/ – REST endpoints grouped by feature (auth, chats, files, ai, payments, admin, etc.)
• services/ – business logic modules (AI, file processing, usage tracking, helper functions)
• server.js – Express bootstrapping, middleware registration, route mounting
• Prisma schema and migrations under “prisma/” drive a PostgreSQL database.
• A local “uploads/” directory (or S3 in production) stores user-uploaded files.
• External scripts under “scripts/” seed and set up the database.
README–Driven Technical Stack
• HTTP API: Express
• Database: PostgreSQL via Prisma ORM
• Auth: JWT, bcrypt, role-based access
• File Processing: multer upload middleware, Tesseract.js OCR, custom fileProcessor service
• AI: OpenAI/Anthropic via ai-service, token tracking via usage-service
• Payments: Stripe, PayPal, MercadoPago SDKs, subscription and webhook handling
• Admin: analytics, user & payment management