A comprehensive full-stack application for managing research laboratories, researchers, and collaborations with advanced analytics and AI-powered features.
- FastAPI-based REST API with automatic OpenAPI documentation
- PostgreSQL database with SQLAlchemy ORM
- JWT authentication for secure user management
- Document processing (PDF, DOCX, TXT) with AI extraction
- Email integration for lab communications
- CORS support for frontend integration
- React 19 with modern hooks and functional components
- Chart.js for interactive data visualizations
- Tailwind CSS 4.0 for responsive, modern UI
- React Router for seamless navigation
- Dark mode support with theme persistence
- Real-time charts for analytics dashboard
- 📊 Dashboard: Overview of labs, researchers, and projects
- 📈 Analytics: Advanced insights with interactive charts
- 🔬 Labs Management: CRUD operations with document upload
- 📧 Email System: Communication management
- 👤 User Profile: Personalized settings and preferences
- Python 3.8+
- Node.js 16+ and npm
- PostgreSQL 12+
- Git
git clone https://github.com/ScientistSameer/History-of-Lab-Records
cd History-of-Lab-Records# From project root
pip install -r backend/requirements.txt# From project root
npm installCreate a .env file in the project root:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/lab_management
# Security
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# AI/API Keys (optional)
GOOGLE_API_KEY=your-google-api-key
OPENAI_API_KEY=your-openai-key
# Email Configuration (optional)
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your-email@gmail.com
SMTP_PASSWORD=your-app-password
# CORS
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000From the project root directory:
# Terminal 1: Start Backend from root
python -m uvicorn backend.app.main:app --reload --port 8001
# Terminal 2: Start Frontend (in a new terminal) from root
npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8001
- API Documentation: http://localhost:8001/docs
Backend:
# From project root
python -m uvicorn backend.app.main:app --reload --port 8001
# With hot reload
python -m uvicorn backend.app.main:app --reload --port 8001 --log-level debugFrontend:
# From project root
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewHistory-of-Lab-Records/
├── backend/ # FastAPI server root
│ ├── app/ # Main application logic
│ │ ├── routers/ # API route handlers
│ │ │ ├── __init__.py # Router package initialization
│ │ │ ├── collaboration_ai.py # AI suggestion routes
│ │ │ ├── collaboration.py # Lab networking routes
│ │ │ ├── doc_ingest.py # Document processing routes
│ │ │ ├── ideal_lab.py # Main lab management
│ │ │ ├── labs.py # External lab directory
│ │ │ ├── researchers.py # Staff management routes
│ │ │ └── users.py # User profile routes
│ │ ├── services/ # Business logic layer
│ │ │ └── collaboration_ai.py # AI processing logic
│ │ ├── __init__.py # App package initialization
│ │ ├── auth.py # JWT authentication logic
│ │ ├── crud.py # Database create-read-update-delete
│ │ ├── database.py # SQLAlchemy connection setup
│ │ ├── email.py # Mail service configuration
│ │ ├── models.py # Database SQL tables
│ │ ├── schemas.py # Pydantic data validation
│ │ └── main.py # Backend entry point
│ ├── __init__.py # Backend package initialization
│ ├── reset_db.py # Database clear script
│ ├── seed.py # Initial data population
│ └── requirements.txt # Python backend dependencies
│
├── node_modules/ # Installed frontend packages
├── other labs/ # Raw document storage
│ ├── lab1.docx # Sample Word document
│ ├── lab1.pdf # Sample PDF document
│ ├── lab1.txt # Sample text file
│ ├── lab2.txt # Research data file
│ ├── lab3.txt # Lab profile data
│ ├── lab4.txt # Research interest data
│ └── lab5.txt # Collaboration history file
│
├── public/ # Static public assets
│ ├── _redirects # Netlify routing rules
│
├── src/ # React frontend source
│ ├── api/ # Frontend API layer
│ │ ├── api/ # Service-specific calls
│ │ │ ├── auth.js # Login/Register API functions
│ │ │ ├── client.js # Axios/Fetch base configuration
│ │ │ ├── collaboration_ai.js # AI feature endpoints
│ │ │ ├── collaboration.js # Messaging API functions
│ │ │ ├── emails.js # Email service endpoints
│ │ │ ├── ideal_lab.js # Core lab endpoints
│ │ │ ├── labs.js # Directory API functions
│ │ │ ├── researchers.js # Researcher data endpoints
│ │ │ └── users.js # User data endpoints
│ ├── charts/ # Chart.js components
│ ├── components/ # Reusable UI components
│ ├── css/ # Global Tailwind styles
│ ├── images/ # Image asset storage
│ ├── pages/ # Page view components
│ ├── partials/ # Layout components
│ ├── utils/ # Utility functions
│ ├── App.jsx # Main app component
│ ├── favicon.svg # Browser tab icon
│ └── main.jsx # React entry point
│
├── .env # Environment variables (root)
├── .env.example # Environment template file
├── .gitignore # Git excluded files
├── atlas.db # SQLite database file
├── index.html # HTML entry point
├── LICENSE # Project license file
├── package-lock.json # NPM lock file
├── package.json # Frontend dependencies
├── pnpm-lock.yaml # PNPM lock file
├── postcss.config.cjs # PostCSS configuration
├── PROJECT_STRUCTURE.md # Detailed directory map
├── QUICK_START.md # Installation guide summary
├── README.md # General project documentation
└── vite.config.js # Vite configuration
package.json: Frontend dependencies and scripts vite.config.js: Vite bundler configuration postcss.config.cjs: PostCSS and Tailwind setup tailwind.config.js: Tailwind CSS customization .env: Environment variables (PROJECT ROOT)
backend/requirements.txt: Python dependencies
Once the backend is running, visit:
- Swagger UI: http://localhost:8001/docs
- ReDoc: http://localhost:8001/redoc
Authentication:
POST /users/register- Register new userPOST /users/login- Login and get JWT tokenGET /auth/me- Get current user info
Labs:
GET /labs/- List all labsPOST /labs/- Create new labPUT /labs/{lab_id}- Update lab detailsDELETE /labs/{lab_id}- Delete lab
IDEAL Lab (Management):
GET /ideal-lab/- Get details of the IDEAL LabPUT /ideal-lab/- Update IDEAL lab details
Researchers:
GET /researchers/- List all researchersPOST /researchers/- Add a new researcherGET /researchers/by-lab/{lab_id}- Get researchers assigned to a specific labGET /researchers/summary- Get statistical summary of researchers
Collaboration & AI:
GET /collaboration/suggestions- Get AI-driven collaboration suggestionsPOST /collaboration/send-email- Send collaboration email to another lab
Document Processing:
POST /ingest/document- Extract lab info from document
General:
GET /- API health check / Root
- Real-time metrics cards
- Interactive charts (doughnut, line, bar)
- Lab distribution by domain
- Researcher growth trends
- AI-powered insights
- Advanced data visualizations
- Workload distribution
- Equipment level analysis
- Resource utilization insights
- Top performing labs
- Grid and table view modes
- Advanced search and filtering
- Document upload for auto-extraction
- Full lab profile management
- Collaboration tracking
- JWT-based authentication
- Password hashing with bcrypt
- CORS configuration for frontend
- SQL injection prevention via ORM
- Environment-based secrets management
- FastAPI: Web framework
- SQLAlchemy: ORM
- Pydantic: Data validation
- python-jose: JWT handling
- passlib: Password hashing
- python-multipart: File uploads
- python-docx: DOCX processing
- PyPDF2: PDF processing
- React 19: UI library
- Chart.js: Data visualization
- React Router: Navigation
- Axios: HTTP client
- Tailwind CSS: Styling
- Vite: Build tool
Database Connection Error:
# Check PostgreSQL is running
sudo service postgresql status
# Verify credentials in .env (root directory)
# Ensure database existsPort Already in Use:
# Use different port
python -m uvicorn backend.app.main:app --reload --port 8002Module Import Errors:
# Ensure you're running from project root
# Reinstall dependencies
pip install -r backend/requirements.txtModule Not Found:
# From project root
rm -rf node_modules package-lock.json
npm installCORS Errors:
- Ensure backend CORS is configured for
http://localhost:5173 - Check
backend/app/main.pyCORS settings - Verify
.envhas correct ALLOWED_ORIGINS
-
Create Feature Branch
git checkout -b feature/your-feature-name
-
Make Changes
- Backend: Update models, add endpoints in
backend/app/ - Frontend: Create components, update pages in
src/
- Backend: Update models, add endpoints in
-
Test Locally
- Run backend:
python -m uvicorn backend.app.main:app --reload --port 8001 - Run frontend:
npm run dev - Test all affected features
- Run backend:
-
Commit Changes
git add . git commit -m "feat: description of changes"
-
Push and Create PR
git push origin feature/your-feature-name
# Set environment variables from .env
# Configure database URL
# Deploy using platform CLI or Git integration# Build production bundle
npm run build
# Deploy dist folder
# Configure build command: npm run build
# Configure output directory: dist- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License.
- Sameer Babar
- Tailwind CSS for the design system
- Chart.js for visualization components
- FastAPI team for excellent documentation
- React community for best practices
For issues and questions:
- Create an issue on GitHub
- Email: smeer.py@gmail.com
Made with ❤️ by Sameer Babar