Platform Overview
Dzaleka Online Services is built on a modern, scalable architecture designed to serve the refugee community efficiently while remaining maintainable by non-technical contributors.Architecture Overview
Technology Stack
Astro 5.x
Static site generator with partial hydration for optimal performance
React 18
Interactive components for dynamic functionality
Tailwind CSS
Utility-first CSS framework with custom design system
MDX
Markdown with JSX for content authoring
Core Dependencies
Project Structure
Content Collections Architecture
Content Collection Definition
Content is managed through Astro’s Content Collections with Zod schemas for type safety:Content Collections Overview
All content collections use the same pattern: Markdown files with frontmatter validated by Zod schemas.
| Collection | Schema Key Features | Example Fields |
|---|---|---|
| services | Contact info, location, verification | title, category, contact, location, verified |
| events | Date, organizer, panelists, registration | date, location, organizer, panelists, registration |
| jobs | Job type, skills, deadline, contact | type, category, skills, deadline, salary |
| resources | File metadata, languages, downloads | fileType, fileSize, languages, downloadUrl |
| news | Category, author, business info | category, author, businessName, tags |
| photos | Photographer, date, gallery | photographer, date, tags, gallery |
| marketplace | Vendor, price, delivery | vendor, price, priceType, deliveryOptions |
| stores | Menu, hours, payment methods | type, menu, hours, paymentMethods |
Example Content File
API Architecture
API Endpoints
The platform provides RESTful API endpoints using Astro’s API routes:API Utilities
Available API Endpoints
/api/services
GET all services with filtering options
/api/events
GET events with date filtering
/api/jobs
GET job listings with status filters
/api/resources
GET resources with category filters
/api/news
GET news and announcements
/api/photos
GET photo gallery metadata
API Response Format
Design System
Tailwind Configuration
Component Library
Base UI Components
Feature Components
- Header: Site navigation with mobile menu
- Footer: Links, contact info, social media
- ServiceCard: Display service information
- EventCard: Show event details with date badges
- JobCard: Job listing with metadata
- SearchBar: Real-time search with MiniSearch
- Pagination: Navigate through content pages
- CategoryFilter: Filter content by categories
Search Implementation
MiniSearch Integration
Deployment Architecture
Netlify Configuration
Build Process
Content Processing
Astro loads all MDX files from content collections and validates them against Zod schemas
Performance Optimizations
- Partial Hydration: Only interactive components load JavaScript
- Image Optimization: Automatic responsive images with lazy loading
- Code Splitting: Per-page JavaScript bundles
- CDN Caching: Static assets cached globally
- Prerendering: Most pages generated at build time
Data Flow
Content Management Workflow
Security Features
API Security
- Rate Limiting: 60 requests per minute per IP
- CORS Headers: Configured for safe cross-origin access
- Input Validation: All API inputs validated with Zod
- Error Handling: Safe error messages without exposing internals
Content Security
- Schema Validation: All content validated before build
- Sanitization: HTML and user inputs sanitized
- HTTPS Only: All connections encrypted
- CSP Headers: Content Security Policy headers configured
Monitoring & Analytics
Built-in Analytics
Metrics Tracked
- Total content items by collection
- Active vs inactive services
- Open vs closed job postings
- Upcoming vs past events
- Featured content counts
- API usage statistics
Development Setup
Local Development
Environment Variables
Extending the Platform
Adding a New Content Collection
Adding a New API Endpoint
Best Practices
Content Authoring
- Use descriptive filenames (lowercase, hyphens for spaces)
- Include all required frontmatter fields
- Optimize images before uploading (max 1MB)
- Use relative paths for internal links
- Test content locally before committing
Component Development
- Keep components small and focused
- Use TypeScript for type safety
- Follow Astro’s component patterns
- Minimize client-side JavaScript
- Use semantic HTML
Performance
- Lazy load images and heavy components
- Minimize bundle sizes
- Use partial hydration strategically
- Optimize database queries in API routes
- Cache API responses when appropriate
Troubleshooting
Common Issues
Build fails with schema validation error
Build fails with schema validation error
Check that all MDX files have required frontmatter fields and correct data types. Review
src/content.config.ts for schema requirements.API returns 429 rate limit error
API returns 429 rate limit error
You’ve exceeded 60 requests per minute. Wait for the rate limit window to reset or implement request throttling.
Images not loading
Images not loading
Ensure images are in the
public/images/ directory and paths start with /images/. Check file permissions and extensions.Search not returning results
Search not returning results
Verify search index is built correctly. Check that documents have searchable fields (title, description, tags).
Resources
Astro Documentation
Official Astro framework documentation
Tailwind CSS
Tailwind CSS documentation and guides
MDX
MDX syntax and component usage
Netlify Docs
Netlify deployment and configuration
For technical support or questions, contact the development team at dzalekaconnect@gmail.com