Ddlibrary
Free and open educational resources for Afghanistan
Install / Use
/learn @ddlibrary/DdlibraryREADME
Darakht‑e Danesh Online Library
'Darakht‑e danesh' means "knowledge tree" in Dari, one of the official languages of Afghanistan. The Darakht‑e Danesh Online Library for Educators is a repository of open educational resources for teachers, teacher trainers, school administrators, literacy workers and others involved in furthering education in Afghanistan. These open source resources include lesson plans, pedagogical tools, exercises, experiments, reading texts, work books, curricula and other resources for use in Afghan classrooms.
Overview
This repository contains the web application that powers the Darakht‑e Danesh Library. It is a Laravel 10 application (PHP) with a Vue/JavaScript front‑end built using Laravel Mix (Webpack). It ships with a Dockerized development environment (Nginx + PHP‑FPM + MySQL + Redis).
Tech Stack
- Language: PHP 8.1+ (composer platform set to 8.1)
- Framework: Laravel 10
- Front‑end: Vue 3, Bootstrap 5, jQuery; built with Laravel Mix (Webpack)
- Package managers: Composer (PHP), npm (Node)
- Database: MySQL 8 (dev via Docker; tests use SQLite in‑memory)
- Caching/Queues: Redis (via Docker) and Laravel queue; default sync driver in .env
- Storage: Local filesystem and AWS S3 via Flysystem
- Web server (dev): Nginx proxying to PHP‑FPM (Docker)
Requirements
Choose one of the following setups.
Option A — With Docker (recommended for development):
- Docker Desktop 4.x+
- docker-compose v2+
Option B — Without Docker (native):
- PHP 8.1+ with extensions commonly required by Laravel (OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype, JSON, BCMath, Fileinfo)
- Composer 2.x
- Node.js 16–20 and npm 8+
- MySQL 8 and Redis (optional for local queues/cache)
Getting Started
1) Clone and bootstrap
git clone <this-repo-url> ddlibrary
cd ddlibrary
cp .env.local .env
Update values in .env as needed (see Environment Variables below).
2A) Run with Docker
docker compose up -d --build
This starts:
- web: Nginx serving
public/on http://localhost:8080 - app: PHP‑FPM container (port 9000)
- db: MySQL 8 (port 3306)
- redis: Redis (port 6379)
Inside the app container, install dependencies and set up the app:
docker compose exec app composer install
docker compose exec app php artisan key:generate
# Create storage symlink for public files
docker compose exec app php artisan storage:link
# Install JS dependencies and build assets
docker compose exec app npm ci
docker compose exec app npm run dev
# Run database migrations (and seed if applicable)
docker compose exec app php artisan migrate
# docker compose exec app php artisan db:seed # TODO: enable if seeds exist/required
Open http://localhost:8080
2B) Run natively (no Docker)
composer install
php artisan key:generate
php artisan storage:link
npm ci
npm run dev
# Set up your database (create schema), then:
php artisan migrate
# php artisan db:seed # TODO: enable if seeds exist/required
php artisan serve --host=127.0.0.1 --port=8080
App will be available at http://127.0.0.1:8080
NPM Scripts
Defined in package.json:
npm run dev— Build assets in development modenpm run dev— Build and watch for changesnpm run dev-poll— Watch with polling (useful in Docker/VMs)npm run dev— HMR via Mixnpm run build— Build minified production assets
Composer Scripts
Defined in composer.json:
post-root-package-install— Copies.env.localto.envif not presentpost-create-project-cmd— Generates app keypost-autoload-dump— Laravel package discoverypost-update-cmd— Publishes Laravel assets
Application Entry Points
- HTTP entry:
public/index.php(served by Nginx in Docker, or PHP’s built‑in server viaphp artisan serve) - Console/cron:
artisan(Laravel CLI)
Environment Variables
The .env file configures the app. Common keys (examples from the provided .env):
Core app
APP_NAME— Application nameAPP_ENV—local|staging|productionAPP_KEY— Set viaphp artisan key:generateAPP_DEBUG—true/falseAPP_URL— Base URL (e.g., http://localhost:8080)PHP_VERSION— Used by Docker build ARG
Database
DB_CONNECTION—mysqlDB_HOST,DB_PORT,DB_DATABASE,DB_USERNAME,DB_PASSWORD
Queues/Cache/Sessions
QUEUE_DRIVERorQUEUE_CONNECTION— Defaults tosynclocally- Redis config — TODO: document if non‑defaults are required
Storage (S3)
FILESYSTEM_DISK—local|public|s3(defaults tolocal)AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGION,AWS_BUCKET,AWS_URL,AWS_ENDPOINT,AWS_USE_PATH_STYLE_ENDPOINTS3_OBJECT_ACCESS_SECRET— App‑specific secret used for resource access
Misc
LOG_CHANNEL— DefaultstackCAPTCHA—noor provider flag (usage in app code)- Social login (Google/Facebook via Socialite) —
- TODO: add
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET,GOOGLE_REDIRECT_URI - TODO: add
FACEBOOK_CLIENT_ID,FACEBOOK_CLIENT_SECRET,FACEBOOK_REDIRECT_URI
- TODO: add
- Analytics/other integrations (Spatie Analytics, etc.) — TODO: list required keys if used
Running Tests
PHPUnit is configured in phpunit.xml.
Local (native):
php artisan test
# or
./vendor/bin/phpunit
Docker:
docker compose exec app php artisan test
# or
docker compose exec app ./vendor/bin/phpunit
Tests use an in‑memory SQLite database as configured in phpunit.xml.
Project Structure
High‑level layout:
app/— Laravel application (controllers, models, console, etc.)bootstrap/— Framework bootstrap and cacheconfig/— App configuration (seefilesystems.phpfor S3 config)database/— Migrations, seeders, factoriespublic/— Web root; front controllerindex.phpresources/— Views (Blade), assetsroutes/— Route definitions (seeroutes/web.php)storage/— Logs, cache, compiled views, andapp/publicfor public filestests/— Unit and Feature testsdocker/— Docker config (Nginx, PHP, MySQL)ddl-lite/— Project‑specific assets/tools (TODO: document usage)docs/— Contribution and other documentation
Database (migrations + seeders/factories)
This project uses Laravel migrations, seeders, and model factories to set up local data.
Seed the database after running migrations:
Native:
php artisan migrate --seed
# To reset and reseed:
php artisan migrate:fresh --seed
Docker:
docker compose exec app php artisan migrate --seed
# To reset and reseed:
docker compose exec app php artisan migrate:fresh --seed
Notes:
- Seeders live in
database/seeders(e.g.,RoleSeeder,SettingsSeeder,SubjectAreaSeeder,LearningResourceTypeSeeder, etc.). - Model factories live in
database/factoriesand are used by seeders to generate sample data. - If you need a larger or smaller dataset, adjust the seeder counts in
DatabaseSeederor run specific seeders:- Native:
php artisan db:seed --class=Database\\Seeders\\YourSeeder - Docker:
docker compose exec app php artisan db:seed --class=Database\\Seeders\\YourSeeder
- Native:
Common Artisan Commands
php artisan migrate— Run migrationsphp artisan storage:link— Createpublic/storagesymlinkphp artisan tinker— REPLphp artisan queue:work— Run queue worker (if using a queue driver)
Deployment
- Build production assets:
npm run build - Ensure correct
.envfor environment and setAPP_KEY - Configure
FILESYSTEM_DISKand S3 credentials if storing on S3 - Run database migrations
- Serve
public/via a web server (Nginx/Apache) pointing PHP‑FPM toartisan
License
The project is published under an MIT license.
To Contribute
We welcome contributions through PRs that includes code enhancements, new features or any other improvements to the codebase. Please check how you can contribute and how you can submit a pull request.
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
sec-edgar-agentkit
10AI agent toolkit for accessing and analyzing SEC EDGAR filing data. Build intelligent agents with LangChain, MCP-use, Gradio, Dify, and smolagents to analyze financial statements, insider trading, and company filings.
Kiln
4.7kBuild, Evaluate, and Optimize AI Systems. Includes evals, RAG, agents, fine-tuning, synthetic data generation, dataset management, MCP, and more.
