Install dependencies: bash
npm install
Create .env from .env.example and set:
OPENAI_API_KEYREDIS_URLAPIFY_TOKENOPENAI_MODEL, PORTStart Redis before running the backend.
Prefer single-service mode when validating full user flows (dashboard + chat + API):
bash
npm run build
npm start
Open http://localhost:3001.
Use split mode only when focusing on one side:
npm run devnpm run dev:serverserver.js: Express API, Redis seeding, /api/query, static hosting of dist/.agent.js: OpenAI relevance scoring and follow-up action generation.redis.js: Redis connection lifecycle, connection storage, query-context cache (30 min TTL).apify.js: Connection ingestion adapter (currently placeholder dataset).src/components/AIChatPanel.jsx: chat UX and /api/query client call.src/data/placeholders.js: dashboard placeholder cards/lists/map seed data.Return this shape from /api/query:
json
{
"results": [
{
"name": "string",
"role": "string",
"company": "string",
"platforms": ["string"],
"relevanceScore": 0,
"reason": "string",
"suggestedActions": ["string", "string"]
}
]
}
If changing fields, update both server.js and src/components/AIChatPanel.jsx together.
When replacing the stub in apify.js:
id, name, role, company, location, platforms, tags, lastInteraction, notessaveConnection(connection.id, connection).apify.js; avoid spreading Apify-specific code through server.js.When editing agent.js:
response_format: { type: 'json_object' }.safeJsonParse, bounded score 0-100).server.js if action generation fails.Build frontend: bash
npm run build
Start server: bash
npm start
Smoke test query endpoint: bash
curl -X POST http://localhost:3001/api/query \
-H "Content-Type: application/json" \
-d "{\"query\":\"Who in my network works in AI and is based in SF?\",\"sessionId\":\"local-test-session\"}"
Confirm the response includes ranked results and cached repeat requests return quickly.
npm run dev serves only frontend; /api/query will not work there unless a proxy/backend is also configured.server.js CORS currently allows http://localhost:3000; adjust if using different local origins.redis.js uses keys('connection:*'); avoid very large production datasets without pagination/scans..env or hardcode API tokens.