DevSphere AI is a production-grade AI platform with:
- Frontend: React 19 + Vite + Tailwind CSS
- Backend: Node.js + Express + MongoDB
- AI Engine: Ollama integration for local LLMs
- Architecture: Modern monorepo with clear separation of concerns
- Node.js 18+
- MongoDB (local or cloud)
- Ollama (for AI features)
-
Clone & Install
cd devsphere-ai npm run setup -
Configure Environment
cp .env.example .env # Edit .env with your configuration: # - MONGODB_URI # - JWT_SECRET # - OLLAMA_BASE_URL (default: http://localhost:11434)
-
Start Development
npm run dev:all
Backend: http://localhost:5000
Frontend: http://localhost:5173
devsphere-ai/
├── backend/ # Backend API
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # MongoDB schemas
│ │ ├── routes/ # API endpoints
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Auth, errors
│ │ └── utils/ # Helpers, logging
│ └── package.json
├── devsphere-frontend/ # React app
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Full pages
│ │ ├── services/ # API client
│ │ └── App.jsx
│ └── package.json
└── docs/ # Documentation
npm run backend:dev # Start backend (port 5000)
npm run frontend:dev # Start frontend (port 5173)
npm run dev:all # Start both concurrentlynpm run build:frontend # Build React app for productionnpm run setup # Install all dependenciesPOST /api/v1/auth/register- Register userPOST /api/v1/auth/login- Login user (returns JWT token)
POST /api/v1/agent/chat- Send message to AI{ "message": "Your message", "agentType": "general|coding|resume", "sessionId": "optional-session-id" }GET /api/v1/agent/sessions- Get all sessionsGET /api/v1/agent/messages/:sessionId- Get session messagesPUT /api/v1/agent/sessions/:sessionId- Rename sessionDELETE /api/v1/agent/sessions/:sessionId- Delete session
Note: All agent endpoints require JWT authentication (Bearer token in header)
-
Register:
curl -X POST http://localhost:5000/api/v1/auth/register \ -H "Content-Type: application/json" \ -d '{"email":"user@example.com","password":"pass123","name":"John"}'
-
Login:
curl -X POST http://localhost:5000/api/v1/auth/login \ -H "Content-Type: application/json" \ -d '{"email":"user@example.com","password":"pass123"}'
-
Use Token:
curl http://localhost:5000/api/v1/agent/sessions \ -H "Authorization: Bearer <JWT_TOKEN>"
The app integrates with Ollama for local LLM deployment.
- Install Ollama: https://ollama.ai
- Download a model:
ollama pull llama2
- Start Ollama server:
ollama serve
- Update .env:
OLLAMA_BASE_URL=http://localhost:11434 OLLAMA_MODEL=llama2
- general: General-purpose assistant
- coding: Code generation & debugging
- resume: Resume review & optimization
- Log files located in
backend/logs/ - Winston logger configured for structured logging
- Check console output for real-time logs
- Use React DevTools browser extension
- Check browser console for API errors
- Network tab to inspect API requests
- MongoDB connection logs in backend console
- Use MongoDB Compass to inspect data
- Models: User, AgentSession, Message
Create .env file in root:
# Server
NODE_ENV=development
PORT=5000
# Database
MONGODB_URI=mongodb://localhost:27017/devsphere
# JWT
JWT_SECRET=your-super-secret-key-change-in-production
# AI Engine
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama2
# CORS
CORS_ORIGIN=http://localhost:5173Run error scan:
npm run lint:frontend # Lint frontend codeCheck compilation:
- VS Code will show errors inline
- Check "Problems" tab in terminal
cd devsphere-frontend
npm run build
# Outputs to dist/ - deploy to any static host# Deploy backend/src to Node.js hosting
# Set environment variables
# Start with: npm start- Set NODE_ENV=production
- Use secure JWT_SECRET
- Configure MONGODB_URI for cloud DB
- Update CORS_ORIGIN to your domain
- README.md - Project overview
- ARCHITECTURE.md - System design details
- CONTRIBUTING.md - Development guidelines
- PRODUCTION_AUDIT_REPORT.md - Quality audit
Port 5000 already in use:
# Kill process on port 5000
lsof -ti:5000 | xargs kill -9MongoDB connection error:
- Check MONGODB_URI in .env
- Ensure MongoDB is running
- Verify database credentials
Ollama not available:
- Ensure Ollama is installed and running
- Check OLLAMA_BASE_URL is correct
- App will warn but continue without AI features
Frontend API calls failing:
- Check CORS_ORIGIN in backend .env
- Verify API URLs use /api/v1 prefix
- Check JWT token in Authorization header
- Hot Reload: Both frontend and backend support hot reload
- Database: Messages and sessions persist in MongoDB
- Testing: Use Postman/Insomnia for API testing
- Logs: Check terminal output and browser console
- Git: Follow conventional commits
For issues or questions:
- Check the documentation in
/docs - Review error logs
- Check the Production Audit Report
- Verify environment configuration
Happy coding! 🎉