DevHub is a full-stack web application for developers with authentication, profiles, AI chatbot, and more.
- React 18.3.1 - UI library
- Vite 5.4.21 - Build tool
- Tailwind CSS 3.4.15 - Styling
- React Router DOM 6.28.0 - Routing
- Lucide React - Icons
- Node.js + Express 4.18.2 - Server
- SQLite (Better-SQLite3) - Database
- bcryptjs - Password hashing
- Express-Session - Session management
- OpenAI - AI chatbot
- Multer - File uploads
- Passport + Google OAuth - Authentication
src/
βββ components/ # Reusable UI components
β βββ Button.jsx
β βββ FormInput.jsx
β βββ ErrorMessage.jsx
βββ pages/ # Page components
β βββ Home.jsx
β βββ Login.jsx
β βββ SignUp.jsx
β βββ Dashboard.jsx
β βββ ProfileSettings.jsx
βββ context/ # React context
β βββ AuthContext.jsx
βββ utils/ # Utilities
β βββ validation.js
β βββ constants.js
β βββ helpers.js
βββ App.jsx # Root component
server/
βββ index.js # Server entry point
βββ auth.js # Auth routes
βββ profile.js # Profile routes
βββ chatbot.js # Chatbot routes
βββ history.js # Navigation history routes
βββ db.js # Database operations
βββ devhub.db # SQLite database file
βββ .env # Environment variables
users - User accounts
- id, email, username, password (hashed)
- avatar_url, bio, location, social_links
- created_at
sessions - User sessions
- sid, sess, expired
navigation_history - User navigation
- id, user_id, item_type, item_name, item_url, visited_at
chat_messages - Chatbot conversations
- id, user_id, message, response, created_at
Database File: /home/pradhyum/project /Home page/server/devhub.db
VITE_API_URL=http://localhost:5000PORT=5000
FRONTEND_URL=http://localhost:5173
JWT_SECRET=your-secret-key-change-this
SESSION_SECRET=your-session-secret-change-this
GOOGLE_CLIENT_ID=your-google-client-id-here
GOOGLE_CLIENT_SECRET=your-google-client-secret-here
OPENAI_API_KEY=your-openai-api-key-here# Start backend (Terminal 1)
cd server
npm start
# Start frontend (Terminal 2)
npm run dev# Build frontend for production
npm run build
# Preview production build
npm run preview# View database contents
cd server
node view_db.js
# Backup database
cp devhub.db devhub.db.backupPOST /api/auth/signup- Create accountPOST /api/auth/login- LoginGET /api/auth/verify- Verify sessionPOST /api/auth/logout- Logout
GET /api/profile- Get profilePUT /api/profile- Update profilePOST /api/profile/avatar- Upload avatar
GET /api/chatbot/history- Get chat historyPOST /api/chatbot/message- Send message
GET /api/history- Get historyPOST /api/history- Add history entry
GET /api/health- Server health
| Data | Location |
|---|---|
| User accounts | server/devhub.db β users table |
| Sessions | server/devhub.db β sessions table |
| Chat history | server/devhub.db β chat_messages table |
| Navigation history | server/devhub.db β navigation_history table |
| User avatars | public/uploads/avatars/ |
| Config | .env files |
- Check backend is running:
http://localhost:5000/api/health - Verify
VITE_API_URLin.env - Check CORS settings in
server/index.js
- Ensure
credentials: truein CORS config - Check
credentials: 'include'in fetch requests - Verify session secret is set in
server/.env
- Delete
server/devhub.dband restart server - Check migration code in
server/db.js
mkdir -p public/uploads/avatars- Add
OPENAI_API_KEYtoserver/.env - Get key from https://platform.openai.com
Checked:
- β All imports are valid
- β Database schema is correct
- β API routes are properly configured
- β Session management is working
- β CORS is configured correctly
- β File upload is configured
- β Environment variables are documented
Console.log Statements:
- Present in
server/profile.jsfor debugging profile updates - Present in
server/db.jsfor database migration logging - Present in
server/auth.jsfor session debugging - These are intentional and helpful for development
Recommendations:
- Consider using a proper logging library (Winston/Morgan) for production
- Remove or disable debug console.logs in production
- Add ESLint configuration file for code quality checks
- Change all secrets in
server/.env - Set
NODE_ENV=production - Set
cookie.secure = truein session config - Build frontend:
npm run build - Update
VITE_API_URLto production URL - Set up database backups
- Configure proper CORS origins
- Add rate limiting
- Set up logging
- Frontend: Vercel, Netlify
- Backend: Railway, Render, Heroku
- Database: Consider PostgreSQL for production
- DOCUMENTATION.md - Complete technical documentation
- README.md - Project overview
- walkthrough.md - Frontend simplification walkthrough
- implementation_plan.md - Simplification plan
- task.md - Task checklist
β
User registration and login
β
Session-based authentication
β
User profiles with avatars
β
Social links (GitHub, LinkedIn, Instagram, Website)
β
AI-powered chatbot
β
Navigation history tracking
β
Responsive design
β
Dark theme
β
Protected routes
β
Form validation
βοΈ Google OAuth login
βοΈ OpenAI chatbot
- Create component in
src/pages/ - Add route in
src/App.jsx - Wrap with
<ProtectedRoute>if auth required
- Create route in appropriate file (
server/auth.js, etc.) - Add
requireAuthmiddleware if auth required - Update documentation
- Use
FormInputcomponent for fields - Use
Buttoncomponent for submit - Use validation functions from
utils/validation.js - Use
ErrorMessagefor error display
- Frontend: http://localhost:5173
- Backend: http://localhost:5000
- Health Check: http://localhost:5000/api/health
- Database:
/home/pradhyum/project /Home page/server/devhub.db
For issues or questions:
- Check DOCUMENTATION.md for detailed info
- Check troubleshooting section above
- Review server logs for errors
- Check browser console for frontend errors
Project Version: 1.0.0
Last Updated: November 26, 2024