Skip to content

rachit23tech/Devmind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

DevMind

DevMind is a full-stack AI coding assistant built with a static frontend, a FastAPI backend, MongoDB for persistence, and Groq for model inference.

The app supports:

  • User registration and login with JWT auth
  • Persistent chat sessions
  • Multiple agent modes: explain, debug, doc, test, and auto
  • Usage statistics by mode

Stack

  • Frontend: HTML, CSS, vanilla JavaScript
  • Backend: FastAPI
  • Database: MongoDB
  • AI provider: Groq
  • Auth: JWT + bcrypt

Project Structure

Devmind/
├─ frontend/
│  ├─ index.html
│  ├─ style.css
│  └─ app.js
├─ backend/
│  ├─ main.py
│  ├─ config.py
│  ├─ requirements.txt
│  ├─ db/
│  │  └─ database.py
│  ├─ middleware/
│  │  └─ auth.py
│  ├─ models/
│  │  └─ schemas.py
│  └─ routes/
│     ├─ auth.py
│     ├─ chat.py
│     └─ sessions.py
└─ readme.md

Features

Authentication

  • Register a new user
  • Log in and receive a JWT token
  • Fetch current user profile and usage stats

Chat Modes

  • explain: explain code and concepts
  • debug: find bugs and suggest fixes
  • doc: generate docs and docstrings
  • test: generate tests
  • auto: generate scripts and automation workflows

Persistence

  • Sessions are stored in MongoDB
  • Messages are stored per session
  • Usage logs track tokens and mode usage

Backend API

Base URL:

http://localhost:8000/api

Key endpoints:

  • POST /auth/register
  • POST /auth/login
  • GET /auth/me
  • GET /sessions
  • POST /sessions
  • GET /sessions/{session_id}
  • PATCH /sessions/{session_id}
  • DELETE /sessions/{session_id}
  • POST /chat
  • GET /chat/stats
  • GET /health

Interactive docs:

http://localhost:8000/api/docs

Environment Variables

Create a .env file for the backend or export these in your shell:

MONGODB_URL=mongodb://127.0.0.1:27017
DB_NAME=devmind
MONGODB_TIMEOUT_MS=5000
JWT_SECRET=change_this_in_production
JWT_ALGORITHM=HS256
JWT_EXPIRE_DAYS=7
GROQ_API_KEY=your_groq_api_key
GROQ_MODEL=llama-3.3-70b-versatile
ENVIRONMENT=development
FRONTEND_URL=*

Notes:

  • GROQ_API_KEY is required for chat replies.
  • The current backend defaults already point to mongodb://127.0.0.1:27017.

Backend Setup

From the project root:

python -m venv .venv
.venv\Scripts\activate
pip install -r backend\requirements.txt

Start the API:

python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000 --reload

Alternative:

python backend\main.py

MongoDB Setup

The backend requires a running MongoDB instance on port 27017.

Option 1: MongoDB service on Windows

If MongoDB is installed as a Windows service:

sc.exe start MongoDB

Option 2: Run mongod manually

If the service is unavailable, run MongoDB manually:

mkdir .mongo-data
mkdir .mongo-log
"C:\Program Files\MongoDB\Server\8.2\bin\mongod.exe" --dbpath "C:\path\to\Devmind\.mongo-data" --logpath "C:\path\to\Devmind\.mongo-log\mongod.log" --bind_ip 127.0.0.1 --port 27017

If startup fails, the backend now returns a clearer MongoDB connection error instead of hanging indefinitely.

Frontend Setup

The frontend is static and expects the backend at:

http://localhost:8000/api

You can open frontend/index.html directly, but using a simple static server is better for browser behavior.

Example with Python:

cd frontend
python -m http.server 5500

Then open:

http://localhost:5500

Default Demo Credentials

The UI shows a demo login hint:

test@devmind.ai / password123

That account is not seeded automatically by the backend. Create it first through registration if you want to use those exact credentials.

How It Works

  1. The frontend authenticates against the FastAPI backend.
  2. The backend stores users, sessions, messages, and usage logs in MongoDB.
  3. Chat requests are routed through the selected mode prompt.
  4. The backend sends the prompt and recent history to Groq.
  5. The response is saved and returned to the frontend.

Development Notes

  • Auth uses HTTPBearer tokens.
  • Passwords are hashed with bcrypt through passlib.
  • Rate limiting is enabled through slowapi.
  • Session titles are auto-generated from the first message when a chat starts.
  • The frontend uses plain JavaScript and does not require a build step.

Troubleshooting

Backend starts but /api/health is unavailable

Check:

  • MongoDB is running on 127.0.0.1:27017
  • The backend terminal has no startup exception
  • Port 8000 is free

MongoDB connection error on startup

Make sure:

  • MongoDB is installed
  • The MongoDB service is running, or mongod.exe is running manually
  • MONGODB_URL matches the server bind address

Chat returns a 500 error

Check:

  • GROQ_API_KEY is set
  • Your Groq model name is valid
  • Outbound network access is available

License

No license file is currently included in this repository.

About

Devmind is an intelligent web AI agent built to enhance developer productivity by assisting across the entire workflow—from ideation and code generation to debugging and optimization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors