A modern full-stack AI platform combining a powerful CLI tool with a beautiful web interface for seamless AI interactions
Features β’ Architecture β’ Quick Start β’ Documentation β’ CLI Usage
Neuro-CLI is a comprehensive AI-powered platform that provides multiple interfaces for interacting with advanced AI models. The project consists of:
- π₯οΈ Orbit CLI - A powerful command-line interface for AI interactions directly from your terminal
- π Web Application - A modern Next.js-based web platform with rich UI components
- π Authentication System - Secure device-flow authentication powered by Better-Auth
- πΎ Database Layer - PostgreSQL with Prisma ORM for robust data persistence
- π€ AI Integration - Google AI SDK for advanced conversational capabilities
| Feature | Description |
|---|---|
| Multi-Modal AI Chat | Engage with AI through chat, tool, and agent modes |
| Device Flow Auth | Secure authentication across CLI and web platforms |
| Conversation Management | Persistent conversation history and context |
| CLI & Web Sync | Seamless experience across command-line and browser |
| Rich UI Components | 50+ Radix UI components with TailwindCSS styling |
| Real-time Updates | Live session management and token validation |
- Framework: Next.js 16 with React 19
- Styling: TailwindCSS 4 with custom design system
- UI Components: Radix UI primitives (Accordion, Dialog, Dropdown, etc.)
- Form Management: React Hook Form with Zod validation
- Authentication: Better-Auth client integration
- Charts: Recharts for data visualization
- Theming: Next-themes for dark/light mode
- Runtime: Node.js with Express 5.1
- Database: PostgreSQL with Prisma ORM
- Authentication: Better-Auth with device flow
- AI: Google AI SDK (@ai-sdk/google, ai)
- CLI Framework: Commander.js with Clack prompts
- Styling: Chalk for terminal colors, Figlet for ASCII art
- Utilities: Boxen, Ora spinners, Inquirer for interactive prompts
graph TB
subgraph "Client Layer"
CLI[π₯οΈ Orbit CLI<br/>Terminal Interface]
WEB[π Web App<br/>Next.js Frontend]
end
subgraph "Server Layer"
API[β‘ Express API<br/>Port 3005]
AUTH[π Better-Auth<br/>Authentication Service]
AI[π€ AI Service<br/>Google AI SDK]
end
subgraph "Data Layer"
DB[(ποΈ PostgreSQL<br/>Database)]
PRISMA[π Prisma ORM]
end
CLI -->|HTTP Requests| API
WEB -->|HTTP Requests| API
API --> AUTH
API --> AI
API --> PRISMA
PRISMA --> DB
style CLI fill:#4CAF50,stroke:#2E7D32,stroke-width:3px,color:#fff
style WEB fill:#2196F3,stroke:#1565C0,stroke-width:3px,color:#fff
style API fill:#FF9800,stroke:#E65100,stroke-width:3px,color:#fff
style AUTH fill:#9C27B0,stroke:#6A1B9A,stroke-width:3px,color:#fff
style AI fill:#F44336,stroke:#C62828,stroke-width:3px,color:#fff
style DB fill:#607D8B,stroke:#37474F,stroke-width:3px,color:#fff
style PRISMA fill:#00BCD4,stroke:#00838F,stroke-width:3px,color:#fff
sequenceDiagram
participant CLI as π₯οΈ CLI/Web Client
participant Server as β‘ Express Server
participant Auth as π Better-Auth
participant DB as ποΈ Database
CLI->>Server: Request device code
Server->>Auth: Generate device code
Auth->>DB: Store device code
Auth-->>Server: Return user_code + device_code
Server-->>CLI: Display user_code
Note over CLI: User visits /device<br/>with user_code
CLI->>Server: Poll for authorization
Server->>Auth: Check device code status
Auth->>DB: Query device code
alt Not Approved Yet
Auth-->>Server: Status: pending
Server-->>CLI: Continue polling
else Approved
Auth->>DB: Create session
Auth-->>Server: Return access token
Server-->>CLI: Authentication success
end
erDiagram
User ||--o{ Session : has
User ||--o{ Account : has
User ||--o{ Conversation : has
Conversation ||--o{ Message : contains
User {
string id PK
string name
string email UK
boolean emailVerified
string image
datetime createdAt
datetime updatedAt
}
Session {
string id PK
string token UK
datetime expiresAt
string userId FK
string ipAddress
string userAgent
}
Account {
string id PK
string accountId
string providerId
string userId FK
string accessToken
string refreshToken
datetime accessTokenExpiresAt
}
Conversation {
string id PK
string userId FK
string title
string mode
datetime createdAt
}
Message {
string id PK
string conversationId FK
string role
string content
datetime createdAt
}
DeviceCode {
string id PK
string deviceCode
string userCode
string userId
datetime expiresAt
string status
}
Neuro-CLI/
βββ π client/ # Next.js Web Application
β βββ app/ # Next.js App Router
β β βββ (auth)/ # Authentication routes
β β βββ approve/ # Device approval flow
β β βββ device/ # Device code entry
β β βββ page.tsx # Home page
β βββ components/ # 50+ UI components
β β βββ ui/ # Radix UI primitives
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utilities and helpers
β βββ public/ # Static assets
β βββ package.json # Client dependencies
β
βββ π server/ # Express.js API Server
β βββ src/
β β βββ cli/ # Orbit CLI implementation
β β β βββ main.js # CLI entry point
β β β βββ commands/ # CLI commands
β β β β βββ auth/ # Auth commands (login, logout, whoami)
β β β β βββ ai/ # AI commands (wakeUp)
β β β βββ chat/ # Chat implementations
β β β βββ ai/ # AI service integrations
β β βββ config/ # Server configuration
β β βββ lib/ # Shared libraries
β β βββ services/ # Business logic
β β βββ index.js # Express server entry
β βββ prisma/
β β βββ schema.prisma # Database schema
β βββ package.json # Server dependencies
β
βββ README.md # This file
Ensure you have the following installed:
| Tool | Version | Download |
|---|---|---|
| Node.js | 18.x or higher | nodejs.org |
| npm | 9.x or higher | Included with Node.js |
| PostgreSQL | 14.x or higher | postgresql.org |
| Git | Latest | git-scm.com |
-
Clone the Repository
git clone <repository-url> cd Neuro-CLI
-
Install Server Dependencies
cd server npm install -
Install Client Dependencies
cd ../client npm install
-
Setup Environment Variables
Create
.envfiles based on the example templates:Server (
server/.env):cd ../server cp .env.example .env # Edit .env with your configuration
Client (
client/.env):cd ../client cp .env.example .env # Edit .env with your configuration
See Server Documentation and Client Documentation for detailed variable descriptions.
-
Setup Database
cd ../server npx prisma generate npx prisma db push
-
Start the Server (Terminal 1)
cd server npm run devServer will run on
http://localhost:3005 -
Start the Client (Terminal 2)
cd client npm run devWeb app will run on
http://localhost:3000 -
Use the CLI (Terminal 3)
cd server npm run cli -- --help
| Command | Description | Usage |
|---|---|---|
login |
Authenticate via device flow | npm run cli -- login |
logout |
End current session | npm run cli -- logout |
whoami |
Display current user info | npm run cli -- whoami |
wakeUp |
Start AI chat session | npm run cli -- wakeUp |
# 1. Authenticate
npm run cli -- login
# Follow the prompts to complete device authentication
# 2. Check authentication status
npm run cli -- whoami
# 3. Start chatting with AI
npm run cli -- wakeUp
# Choose your mode: chat, tool, or agent
# 4. Logout when done
npm run cli -- logout- π¨ Beautiful Terminal UI - Styled with Chalk and ASCII art
- β‘ Interactive Prompts - Powered by Clack and Inquirer
- π Real-time Feedback - Animated spinners and progress indicators
- π Markdown Rendering - Terminal-formatted AI responses
- πΎ Persistent Sessions - Token-based authentication
For detailed documentation, please refer to:
- Client Documentation - Next.js web application setup and development
- Server Documentation - Express API, CLI, and database documentation
| Endpoint | Method | Description |
|---|---|---|
/api/auth/* |
ALL | Better-Auth authentication endpoints |
/api/me |
GET | Get current session (Bearer token) |
/api/me/:access_token |
GET | Get session by token (deprecated) |
/device |
GET | Redirect to device code entry page |
| Command | Description |
|---|---|
npm run dev |
Start development server (hot reload) |
npm run build |
Build for production |
npm start |
Start production server |
npm run lint |
Run ESLint |
# Generate Prisma Client
npx prisma generate
# Push schema changes to database
npx prisma db push
# Open Prisma Studio
npx prisma studio
# Create migration
npx prisma migrate dev --name migration_nameContributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License.
Mausam Kar
- Portfolio: mausam04.vercel.app
- Built with β€οΈ using Next.js, Express, and Google AI SDK
Made with Next.js, Express, and Google AI SDK