An AI-powered research agent that accepts topics from users, runs automated research workflows, and returns structured results with summaries and key insights.
- Frontend: React + TypeScript + Vite + TailwindCSS + DaisyUI
- Backend: Node.js + Express + TypeScript + Prisma + BullMQ
- Database: PostgreSQL with Prisma ORM
- Queue: Redis with BullMQ for background job processing
- AI: OpenRouter API for content analysis
- News: NewsAPI for article data
- Node.js (v18 or higher)
- npm or yarn
- PostgreSQL database
- Redis instance
- Navigate to the backend directory:
cd backend- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env with your actual values (see .env.example section below).
- Set up the database:
npx prisma generate
npx prisma db push- Run the backend server:
npm run dev- Run the worker process (in a separate terminal):
npm run worker:devThe backend will run on http://localhost:3000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env- Run the frontend:
npm run devThe frontend will run on http://localhost:5173
- Build the production bundle:
cd frontend
npm run build-
Deploy the
distfolder to your hosting service (Vercel, Netlify, etc.) -
Update environment variables in your hosting platform:
VITE_BACKEND_URL: Your deployed backend URL
- Build the application:
cd backend
npm run build-
Deploy to your hosting service (Railway, Heroku, AWS, etc.)
-
Set up environment variables in your hosting platform (see .env.example)
-
Run database migrations:
npx prisma db push- Start both the main server and worker process:
npm start &
npm run worker# Database
DATABASE_URL=postgresql://username:password@localhost:5432/cerebro_db
# Server
BACKEND_PORT=3000
FRONTEND_URL=http://localhost:5173
NODE_ENV=development
JWT_SECRET=your-super-secret-jwt-key-here
# APIs
OPENROUTER_APIKEY=sk-or-v1-your-openrouter-api-key
NEWSAPI_APIKEY=your-newsapi-key
# Redis (for background jobs)
UPSTASH_REDIS_URL=redis://localhost:6379
UPSTASH_REDIS_REST_URL=https://your-redis-instance.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-redis-tokenVITE_BACKEND_URL=http://localhost:3000version: '3.8'
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: cerebro_user
POSTGRES_PASSWORD: cerebro_password
POSTGRES_DB: cerebro_db
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://cerebro_user:cerebro_password@postgres:5432/cerebro_db
- UPSTASH_REDIS_URL=redis://redis:6379
- NODE_ENV=development
- BACKEND_PORT=3000
- FRONTEND_URL=http://localhost:5173
depends_on:
- postgres
- redis
volumes:
- ./backend:/app
- /app/node_modules
worker:
build:
context: ./backend
dockerfile: Dockerfile
command: npm run worker
environment:
- DATABASE_URL=postgresql://cerebro_user:cerebro_password@postgres:5432/cerebro_db
- UPSTASH_REDIS_URL=redis://redis:6379
- NODE_ENV=development
depends_on:
- postgres
- redis
- backend
volumes:
- ./backend:/app
- /app/node_modules
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "5173:5173"
environment:
- VITE_BACKEND_URL=http://localhost:3000
depends_on:
- backend
volumes:
- ./frontend:/app
- /app/node_modules
volumes:
postgres_data:
redis_data:FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "run", "dev"]- Start all services:
docker-compose up -d- Initialize the database:
docker-compose exec backend npx prisma db push-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
-
Stop all services:
docker-compose downPOST /auth/signup- User registrationPOST /auth/login- User loginGET /auth/logout- User logout
POST /research- Submit a new research topicGET /research- Get all research topicsGET /research/:id- Get specific research detailsGET /user/:id- Get user's research topics
GET /jobs/stats- Get queue statisticsGET /jobs/:jobId- Get job statusGET /jobs- Get all jobs
- Start the database and Redis (via Docker or local installation)
- Run backend server:
npm run dev(in backend directory) - Run worker process:
npm run worker:dev(in backend directory) - Run frontend:
npm run dev(in frontend directory)
The system will automatically:
- Queue research jobs when topics are submitted
- Process articles and generate AI summaries in the background
- Update the database with results
- Provide real-time status updates
- User authentication with JWT
- Background job processing for research workflows
- AI-powered content analysis and summarization
- Real-time job status monitoring
- Responsive UI with modern design
- RESTful API architecture
- Type-safe development with TypeScript