Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copy this file to server/.env (or export the variables) before running the Node service.
OPENAI_API_KEY=replace-with-your-openai-api-key
OPENAI_MODEL=gpt-4.1-mini
PORT=5001
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
client/node_modules/
server/node_modules/
dist/
client/dist/
server/dist/
.env
server/.env
.DS_Store
113 changes: 112 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,112 @@
# beta
# Insight Atlas CRM

Insight Atlas CRM is a local-first intelligence cockpit that fuses data management, predictive modelling, risk analysis, AI advice, and deep document comparison into a cinematic Vite + React experience powered by a hardened Node/Express API.

## Architecture

```
root
├── client # Vite + React + Tailwind front-end (TypeScript)
└── server # Node/Express API that orchestrates OpenAI calls (Responses API)
```

- UI served by Vite on **http://localhost:5173**
- API broker listens on **http://localhost:5001** (configurable via `PORT`)
- All OpenAI traffic is proxied through the server; the browser never sees your key

## Feature Matrix

| Capability | Details |
| --------------------- | ------- |
| Data Management | Drag-and-drop ingestion with AI summaries, keyword extraction, and tone analysis |
| Predictive Strategy | Scenario designer blending structured inputs + document context into forecasts, CRM plays, and AI actions |
| Risk Analysis | Threat matrix + mitigation sprints derived from the latest prediction run |
| AI Advisor | Contextual copilot chat with persistent history and provider attribution |
| Deep Comparison | Dual-document delta analysis highlighting matches, gaps, risk register, and automation plays |

Every endpoint returns curated sample data when the OpenAI key is absent so the workspace remains explorable offline.

## Prerequisites

- **Node.js 18+**
- **npm 9+**
- An OpenAI API key with access to the Responses API (`gpt-4.1-mini` by default)

## Quick start

### 1. Install dependencies

**Windows 11 (recommended):**

1. Right-click `install.bat` and run, or execute `scripts\windows\install.ps1` from PowerShell.
2. The installer validates Node/npm and installs dependencies for both `server` and `client`. Pass `-Force` to reinstall.

**macOS / Linux:**

```bash
cd server && npm install
cd ../client && npm install
```

### 2. Configure credentials

```bash
cp server/.env.example server/.env
# Edit server/.env and set OPENAI_API_KEY=your_key_here
# Optionally adjust OPENAI_MODEL or PORT
```

> The repository also provides a root `.env.example` you can copy into `server/.env`.

### 3. Run the stack

**Windows:** double-click `run.bat` (or run `scripts\windows\run.ps1`). The auto-runner:

- Verifies Node/npm
- Installs missing dependencies (unless `-SkipInstall` is passed)
- Warns if `server/.env` is missing
- Launches two terminals (API + Vite client)

**macOS / Linux:**

```bash
cd server && npm run dev
# In a second terminal
cd client && npm run dev
```

Visit **http://localhost:5173** once both processes are online.

### 4. Clean up legacy Flask builds

If you experimented with the prior Flask app, terminate it to free port 5000:

```powershell
taskkill /IM python.exe /F
```

Also delete old virtual environments to prevent accidental launches.

## Environment variables

| Variable | Default | Description |
| --------------- | ------------- | ----------- |
| `OPENAI_API_KEY`| _none_ | Required for live OpenAI responses |
| `OPENAI_MODEL` | `gpt-4.1-mini`| Adjust if your account lacks the default model |
| `PORT` | `5001` | API port (update Vite proxy if changed) |

## Testing & linting

- **Server:** `cd server && npm run lint`
- **Client:** `cd client && npm run lint`

Tailwind builds automatically when running `npm run dev`. For production builds use `npm run build` inside `client`.

## Troubleshooting

- **Installer complains about execution policy:** run PowerShell as Administrator and execute `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`.
- **Installer cannot find Node/npm:** install [Node.js 18+](https://nodejs.org/en/download/) which bundles npm.
- **Client cannot reach the API:** ensure the server terminal shows `Insight Atlas server listening on port 5001`. Update `client/vite.config.ts` if you change ports.
- **OpenAI quota or key issues:** the UI will still work using curated sample data, but a banner in the sidebar will show “OpenAI offline”.

Enjoy orchestrating predictive CRM excellence with Insight Atlas 🚀
21 changes: 21 additions & 0 deletions client/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
};
13 changes: 13 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Insight Nexus CRM</title>
</head>
<body class="bg-canvas text-white">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading