Skip to content

samay-hash/bayax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ THE NEXT-GEN AI PRODUCT ARCHITECT

BayaX is an ultra-advanced AI engine that converts chaotic startup ideas into mathematically structured, foolproof execution blueprints. No more guessing. Just pure execution.

Gemini AI Groq AI React Node.js TypeScript MongoDB

๐Ÿš€ ๐Ÿง  ๐ŸŒŒ


๐ŸŒŒ The Vision

Most startups fail because of a lack of clarity and structure. BayaX bridges the gap between an abstract thought and a billion-dollar execution plan. Just feed it a niche or a raw idea, and watch the AI construct your entire path.


โšก Core Arsenal (Features)

๐Ÿง  Startup Blueprint Generator
Harnesses Generative LLMs to validate, refine, and structure your abstract ideas into a highly coherent product thesis, complete with Tech Stack recommendations and Market Feasibility parameters.
๐Ÿ“š Automated Lesson Plan Architect
Dynamically generates comprehensive K-12 educational lesson plans complete with factual/conceptual objectives, expected queries, and automated .docx document exports directly downloaded to the browser.
๐Ÿ›ก๏ธ Secure JWT Authentication
Enterprise-grade security using HttpOnly cookies, Bcrypt password hashing, and Access/Refresh token rotation flows to securely protect user portfolios and lesson histories.
โšก Multi-LLM Fallback Engine
Guaranteed uptime through a robust Strategy Pattern. If Google's Gemini SDK faces downtime or rate limits, the engine instantaneously pivots to Groq's blazing-fast Llama 3 model silently in the background.

๐Ÿงฌ Architectural DNA (System Design)

BayaX operates on a highly optimized 3-Tier MVC Architecture integrated with bleeding-edge AI API gateways.

graph TD
    A[๐Ÿ‘จโ€๐Ÿ’ป User] -->|HTTP Request| B(โš›๏ธ React Dashboard)
    B -->|Encrypted Payload| C{โšก Express Controller}
    
    C -->|Verify HTTP Cookie| F[๐Ÿ›ก๏ธ Auth Middleware]
    F -->|Delegate Task| S[โš™๏ธ Business Service]
    
    S -->|Persist History| D[(MongoDB Atlas)]
    S -->|Idea / Lesson Prompt| E((๐Ÿง  AIEngine Singleton))
    
    E -->|Primary Target| G[Google Gemini API]
    E -.->|Rate Limit Fallback| H[Groq Llama API]
    
    G -->|Strict JSON Output| S
    H -.->|Strict JSON Output| S
    S -->|REST Response| C
    C -->|JSON Payload| B
    B -->|Render UI / Export Docx| A
    
    style A fill:#0f172a,stroke:#38bdf8,stroke-width:2px,color:#fff
    style B fill:#0c4a6e,stroke:#0ea5e9,stroke-width:2px,color:#fff
    style C fill:#164e63,stroke:#06b6d4,stroke-width:2px,color:#fff
    style D fill:#064e3b,stroke:#10b981,stroke-width:2px,color:#fff
    style E fill:#4c1d95,stroke:#8b5cf6,stroke-width:2px,color:#fff
    style F fill:#9d174d,stroke:#f43f5e,stroke-width:2px,color:#fff
    style S fill:#b45309,stroke:#f59e0b,stroke-width:2px,color:#fff
Loading

๐Ÿ—๏ธ Design Patterns & SOLID Principles

BayaX is built on a highly robust, enterprise-grade architecture. To ensure scalability, testability, and maintainability, the following design patterns and SOLID principles are deeply integrated into the codebase:

๐Ÿงฉ Core Design Patterns

  1. MVC-S (Model-View-Controller-Service) (Architectural Pattern)
    How & Why: The backbone of BayaX's separation of concerns. Controllers exclusively handle HTTP requests, Services manage all heavy business logic and API orchestration, and Models bind strictly to the database. This prevents spaghetti code and makes components fiercely scalable.

  2. Singleton Pattern (AIEngine.ts, DatabaseConnection.ts) (Creational Design Pattern)
    How & Why: Guarantees that only one instance of the AI SDK or MongoDB connection exists in memory. This prevents the server from crashing or getting rate-limited if 100 users attempt to generate ideas simultaneously by forcing them to queue through a highly optimized global engine.

  3. Fallback Strategy Pattern (AIEngine.ts) (Behavioral Design Pattern)
    How & Why: AI networks can have downtime. BayaX implements a dynamic fallback strategy. The primary strategy attempts callGemini(). If it hits a rate limit or failure, the system automatically catches the exception and pivots to a backup strategy: callGroq(). The user experiences zero downtime.

  4. Chain of Responsibility (auth.ts) (Behavioral Design Pattern / Middleware)
    How & Why: Instead of repeating token validation logic across 50 controllers, the AuthMiddleware intercepts incoming requests, decodes the JWT, and verifies the user. If valid, it passes control forward via next(); if compromised, it terminates the chain with a 403 Forbidden.

  5. Facade Pattern (JWTService.ts, ConvertUtils.ts) (Structural Design Pattern)
    How & Why: Masks complex third-party library internals. Generating mathematical .docx table structures is complex, but the controllers never see itโ€”they just call createDocument(). Swapping dependencies in the future requires zero changes to the core application.

๐Ÿ›๏ธ SOLID Principles Implemented

  • S (Single Responsibility Principle): Controllers manage HTTP, Services manage execution logic, and Utilities manage distinct tasks (like Tokens). No file attempts to do two unrelated jobs.
  • O (Open/Closed Principle): The AIEngine.execute() method is firmly closed for modification to the outside services, but internally open for extension (e.g., adding an OpenAI handler method does not require changing the Idea Service).
  • I (Interface Segregation Principle): BayaX strictly relies on segregated, tiny functional interfaces like LessonInput or AuthTokens instead of forcing a massive IUserPayload onto services that don't need all the data properties.
  • D (Dependency Inversion Principle): Controllers interact with high-level service abstractions (e.g., ideaService.storeProject()) rather than writing low-level Mongoose query instructions. You could swap MongoDB for PostgreSQL without breaking the presentation layer.

๐ŸŽฎ Execution Flow (Sequence)

How exactly does BayaX read your mind? Here is the data flow vector:

sequenceDiagram
    autonumber
    actor User
    participant Frontend as โš›๏ธ UI Dashboard
    participant Middle as ๐Ÿ›ก๏ธ Auth Middleware
    participant Service as โš™๏ธ Business Service
    participant AI as ๐Ÿง  AI Core (Gemini/Groq)
    participant DB as ๐Ÿ—„๏ธ MongoDB Atlas

    User->>Frontend: Submit Idea / Lesson Form
    Frontend->>Middle: POST Request (with Cookie)
    activate Middle
    Middle->>Middle: Verify JWT Access Token
    Middle->>Service: Forward Authenticated Payload
    deactivate Middle
    activate Service
    Service->>AI: Trigger AIEngine (Execution Blueprint)
    activate AI
    AI-->>Service: Structured JSON Response
    deactivate AI
    Service->>DB: Mongoose.create() to save history
    Service-->>Frontend: Return Analyzed Payload
    deactivate Service
    Frontend-->>User: Display Output / Trigger .docx Download
Loading

โš™๏ธ Hyper-Drive Boot Sequence (Setup)

Ready to run BayaX on your local mainframe?

1. Clone the Matrix

git clone https://github.com/samay-hash/bayax.git
cd bayax

2. Ignite the Backend Core

cd src/backend
# Setup your environment variables via .env.example
cp .env.example .env
npm install
npm run build
npm start

3. Spin up the Visualizer (Frontend)

cd ../frontend
# Setup your environment variables
cp .env.example .env
npm install
npm run dev

Target Acquired: Open http://localhost:5173 in your browser to experience the future.


Designed for Visionaries. Built by the BayaX Team.
Leave a โญ if BayaX blew your mind!

About

BayaX is an ultra-advanced AI engine that converts chaotic startup ideas into mathematically structured, foolproof execution blueprints. No more guessing. Just pure execution.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors