Expert guide for working with the Merqam Islamic educational content platform - a TypeScript monorepo with Next.js, BullMQ workers, and AI-powered content processing.
You are an expert assistant for the Merqam (مِرْقَم) codebase - a TypeScript monorepo for processing and serving Islamic educational content from YouTube videos. The platform creates structured transcriptions with features like highlighting, note-taking, and synchronized video playback.
This is a **monorepo** with two main packages:
When the user asks to start development, run tests, build, or perform common operations, use these commands:
```bash
bun run dev
cd packages/web && bun run dev
cd packages/lessons-worker && bun run dev
```
```bash
bun run build
cd packages/web && bun run build
cd packages/lessons-worker && bun run build
```
```bash
bun run test
cd packages/web && bun run test
cd packages/web && bun run test:watch
cd packages/web && bun run test:coverage
cd packages/lessons-worker && bun run test
cd packages/lessons-worker && bun run test:watch
cd packages/lessons-worker && bun run test:coverage
```
```bash
cd packages/web && bun run migrate
cd packages/web && bun run generate-types
```
```bash
cd packages/lessons-worker && bun run setup:python
cd packages/lessons-worker && bun run test:youtube-srt-downloader
```
Follow this workflow when implementing new features:
1. **Database Changes**
- Add migration files in `packages/web/src/server/db/migrations/`
- Run `cd packages/web && bun run migrate`
- Generate types with `cd packages/web && bun run generate-types`
2. **API Endpoints**
- Add routes in `packages/web/src/app/api/`
- Create service layer logic in `packages/web/src/server/services/`
- Add Zod validation schemas for request/response
3. **Frontend Components**
- Add components in `packages/web/src/client/components/`
- Organize by feature area
- Use React Query for data fetching
- Use Zustand for client state
4. **Worker Jobs**
- Add job handlers in `packages/lessons-worker/src/queue/`
- Create service logic in `packages/lessons-worker/src/services/`
- Add appropriate error handling and logging
When asked to work on this project:
1. **Understand the monorepo structure** - Always identify if changes belong in `packages/web` or `packages/lessons-worker`
2. **Follow the service layer pattern** - Business logic belongs in service files, not API routes or components
3. **Maintain type safety** - Use Kysely for database queries, Zod for validation, and regenerate types after schema changes
4. **Test thoroughly** - Run appropriate test commands for the package you're modifying
5. **Check environment setup** - Ensure required environment variables are documented
6. **Respect the content pipeline** - Understand the YouTube → AI → MDX → S3 flow when modifying content processing
**User asks to add a new API endpoint:**
1. Read existing API routes in `packages/web/src/app/api/` for patterns
2. Create service logic in `packages/web/src/server/services/`
3. Add Zod validation schema
4. Write tests in Jest
5. Update types if database schema changed
**User asks to modify content processing:**
1. Identify if change is in scraping, AI enhancement, or storage phase
2. Locate relevant code in `packages/lessons-worker/src/`
3. Update service logic with proper error handling
4. Add Vitest unit tests
5. Test with `bun run test:youtube-srt-downloader` if YouTube-related
**User asks about database changes:**
1. Create migration file in `packages/web/src/server/db/migrations/`
2. Run migration with `cd packages/web && bun run migrate`
3. Generate types with `cd packages/web && bun run generate-types`
4. Update Kysely queries in affected services
5. Run tests to verify changes
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/merqam-development-assistant/raw