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