How varuno8/eigen_login works
Project type and purpose
• This is a full-stack Next.js (React) web application with built-in API routes (app/api), server-side rendering (SSR), authentication (NextAuth), database access (Prisma ORM), and separate UI flows for admin, auth, and user dashboards.
• Its purpose is to present an authenticated user experience (sign-in/sign-up), expose a user dashboard with search and subscription management features, and provide an admin interface for analytics, feature requests, user/subscription management, and service creation.
File structure
• Top-level “app” directory is the Next.js App Router:
• /(auth) contains sign-in and sign-up pages
• /(dashboard) contains user-facing dashboard pages (homepage, account, search, subscriptions, service detail)
• /(admin) contains admin UI subpaths (analytics, feature-requests, settings, subscriptions, users, new-service)
• app/api holds serverless API endpoints for auth (NextAuth), user data, Streamlit token, etc.
• “components” and “components/ui” hold shared React components and design-system primitives.
• “lib” holds shared utilities: auth helpers, constants, database client (Prisma), and utils.
• “prisma” directory holds DB schema and migration history.
• Configuration files: next.config.ts, postcss.config, tailwind.config, tsconfig.
README for additional insights
• Confirms Next.js app created with create-next-app, uses next/font for custom fonts, deployable on Vercel.
• Mentions standard dev server and deployment instructions.
Main components of the system
a. Client Browser (React SSR/CSR)
b. Next.js Server (Node.js on Vercel/Node runtime)
c. API layer (app/api routes)
d. Authentication subsystem (NextAuth integration, Google OAuth)
e. Database (PostgreSQL or other, accessed via Prisma ORM)
f. External services: Google OAuth Provider, Streamlit token service
g. Shared UI Component Library (components/ui)
h. Prisma Migrations subsystem
Relationships and interactions
• Client Browser sends HTTP requests to Next.js Server (page navigation and API calls).
• Next.js Server renders pages (SSR) or serves static assets; routes API calls under /api/*.
• The API layer interacts with Prisma to read/write the database.
• NextAuth middleware in the API layer and pages manages session tokens, refreshes, and integrates with Google OAuth.
• Prisma Client communicates with the Database.
• The Streamlit-token API route calls an external Streamlit authentication service.
• The database migrations are managed offline by Prisma Migrate, not part of runtime flow but crucial for schema versioning.
Architectural patterns and design principles
• Separation of Concerns:
• UI components vs. page-level layouts vs. business logic (app/actions, lib) vs. persistence (Prisma)
• Auth flow isolated to its own route group (app/api/auth & NextAuth config in lib/auth.ts)
• Modular Code Organization: components/ui for design primitives, components/form for forms, hooks for custom React logic.
• Serverless Micro-endpoints: each API route is its own function/handler.
• Convention-over-configuration via Next.js app directory routing.
Relevant technologies, frameworks, and libraries
• Next.js (App Router) for server-side rendering and routing
• React for UI
• Tailwind CSS for styling
• Prisma ORM & Migrate for DB access and schema evolution
• NextAuth.js for authentication and session management
• Vercel (implied) or Node.js serverless runtime for deployment
• External OAuth (Google) and Streamlit token service