Africa's Premier Virtual Science Laboratory Platform
AfriLab is a comprehensive simulated laboratory platform designed for African universities, enabling students to perform hands-on science experiments in a safe, accessible virtual environment. Built entirely on Cloudflare's edge infrastructure with AI-powered tutoring.
- Chemistry Labs: Acid-base titrations, spectroscopy, organic synthesis
- Biology Labs: Microscopy, virtual dissections, cell studies
- Physics Labs: Mechanics, optics, circuit simulations
- Pharmacy Labs: Drug compounding, dosage calculations, interactions
- Medical Labs: Patient scenarios, diagnostic reasoning
- Intelligent Lab Assistant: Powered by Cloudflare Workers AI (Llama 3.1)
- Context-Aware Help: Understands your current experiment and progress
- Adaptive Hints: Progressive guidance without giving away answers
- Automated Assessment: AI-generated feedback on lab reports
- Real-time measurement recording
- Performance analytics dashboard
- Learning progress visualization
- Institution-wide reporting for instructors
- University registration codes
- Role-based access (Student, Instructor, Admin)
- SSO-ready architecture
- Cross-institution analytics
AfriLab is built entirely on Cloudflare's ecosystem:
| Component | Technology | Purpose |
|---|---|---|
| Frontend | SvelteKit + Cloudflare Pages | Fast, SEO-friendly UI |
| Database | Cloudflare D1 (SQLite) | Edge-located data storage |
| Sessions | Cloudflare KV | Low-latency session management |
| Assets | Cloudflare R2 | 3D models, videos, documents |
| AI | Cloudflare Workers AI | Intelligent tutoring (Llama 3.1) |
| Compute | Cloudflare Workers | Serverless backend logic |
┌─────────────────────────────────────────────────────────────┐
│ CLOUDFLARE EDGE │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────────────┐│
│ │ Pages │ │ D1 │ │ KV │ │ Workers AI ││
│ │ (UI/SSR)│ │(SQLite) │ │(Sessions│ │ (Llama 3.1) ││
│ └────┬────┘ └────┬────┘ └────┬────┘ └────────┬────────┘│
│ │ │ │ │ │
│ └────────────┴────────────┴────────────────┘ │
│ │ │
│ ┌──────┴──────┐ │
│ │ Workers │ │
│ │ (API/Auth) │ │
│ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
- Node.js 18+
- npm or pnpm
- Cloudflare account
- Wrangler CLI (
npm install -g wrangler)
-
Clone the repository
git clone https://github.com/ghwmelite-dotcom/AfriLab.git cd AfriLab -
Install dependencies
npm install
-
Create Cloudflare resources
# Create D1 database wrangler d1 create afrilab-db # Create KV namespace wrangler kv:namespace create SESSIONS # Create R2 bucket (optional) wrangler r2 bucket create afrilab-assets
-
Update
wrangler.tomlwith your resource IDs -
Run database migrations
npm run db:migrate # Local npm run db:migrate:prod # Production
-
Start development server
npm run dev # Vite dev server npm run preview # Wrangler preview with bindings
npm run deployThis builds the project and deploys to Cloudflare Pages.
afrilab/
├── migrations/ # D1 database migrations
├── src/
│ ├── lib/
│ │ ├── components/ # Svelte components
│ │ │ ├── ai/ # AI chat interface
│ │ │ ├── lab/ # Lab equipment components
│ │ │ └── layout/ # Header, Sidebar, Footer
│ │ ├── server/ # Server-side utilities
│ │ │ ├── auth.ts # Authentication logic
│ │ │ ├── db.ts # Database helpers
│ │ │ └── ai.ts # AI prompt builders
│ │ ├── simulations/ # Experiment logic
│ │ │ └── chemistry/ # Chemistry simulations
│ │ ├── stores/ # Svelte stores
│ │ ├── types/ # TypeScript definitions
│ │ └── utils/ # Helper functions
│ └── routes/
│ ├── api/ # API endpoints
│ ├── auth/ # Login, Register, Logout
│ ├── dashboard/ # Student dashboard
│ ├── instructor/ # Instructor dashboard
│ └── labs/ # Laboratory pages
├── static/ # Static assets
├── wrangler.toml # Cloudflare configuration
└── package.json
- Acid-Base Titration - Learn volumetric analysis with phenolphthalein indicator
- UV-Vis Spectroscopy - Beer-Lambert law and absorbance measurements
- Organic Synthesis (coming soon)
- Microscopy Basics (coming soon)
- Virtual Dissection (coming soon)
- Optics Lab (coming soon)
- Circuit Simulation (coming soon)
- Drug Compounding (coming soon)
- Pharmacokinetics (coming soon)
Create a .dev.vars file for local development:
# Optional: Override defaults
APP_ENV=developmentThe wrangler.toml file configures all Cloudflare services:
[[d1_databases]]
binding = "DB"
database_name = "afrilab-db"
database_id = "your-database-id"
[[kv_namespaces]]
binding = "SESSIONS"
id = "your-kv-namespace-id"
[[r2_buckets]]
binding = "STORAGE"
bucket_name = "afrilab-assets"
[ai]
binding = "AI"We welcome contributions from the community! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing code style
- Write TypeScript for type safety
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloudflare - For providing the edge infrastructure
- Svelte Team - For the amazing framework
- African Universities - For inspiring this project
- GitHub Issues: Report bugs or request features
- Discussions: Join the conversation
Built with ❤️ for African Education
Powered by Cloudflare