Examples Overview
Welcome to the moclojer examples collection! These are complete, production-ready examples that demonstrate real-world use cases and best practices.
π― What's Included
Each example includes:
β Complete configuration - Ready-to-run YAML files
β Architecture diagrams - Visual understanding with Mermaid
β Usage examples - Curl commands and test scripts
β Best practices - Following RESTful and API design patterns
β Related documentation - Links to learn more
π Examples by Category
π· REST APIs
Perfect for learning CRUD operations and API design fundamentals.
Learn:
CRUD operations (Create, Read, Update, Delete)
Proper HTTP status codes
Pagination and filtering
Error handling
Resource relationships
πΆ Third-Party API Mocks
Mock popular external APIs for testing without real API calls.
GitHub API Mock π
Repository management
ββ Intermediate
OAuth, webhooks (Coming Soon)
Slack API Mock π
Team communication
ββ Intermediate
Webhooks, bots (Coming Soon)
Learn:
Third-party API integration patterns
Payment flows without real transactions
Webhook event simulation
Error scenario testing
πΆ Microservices (Coming Soon)
Advanced patterns for microservice architectures.
Service Mesh π
Multi-service communication
βββ Advanced
Service discovery, load balancing
Event-Driven π
Async message processing
βββ Advanced
Events, queues, pub/sub
π Quick Start
1. Choose an Example
Browse the categories above and pick an example that matches your needs.
2. Download Configuration
Each example includes a complete YAML configuration file. Copy the configuration from the example page.
3. Run with moclojer
4. Explore & Modify
Test with the provided curl commands
Run the test scripts
Modify the configuration to fit your needs
Add your own endpoints
π Learning Path
Beginner β Intermediate β Advanced
Start Simple: Basic CRUD
Learn CRUD fundamentals
Understand HTTP methods
Practice with curl commands
Add Complexity: Blog API
Nested resources (posts β comments)
Resource relationships
Advanced queries
Real-World Integration: Stripe Mock
Mock external APIs
Error scenarios
Integration testing
Production Patterns: How-to Guides
Pagination strategies
Authentication patterns
Deployment (Docker, K8s)
π What You'll Learn
API Design Principles
β RESTful conventions - Resource naming, HTTP methods
β Status codes - When to use 200, 201, 400, 404, etc.
β Error handling - Meaningful error messages
β Pagination - Handle large datasets
β Filtering & search - Query parameters
moclojer Features
β Template variables - Dynamic responses
β Path parameters -
/users/:idpatternsβ Query parameters - Filters and pagination
β JSON body handling - Request data access
β Header parameters - Authentication, CORS
Testing Strategies
β Local development - No external dependencies
β CI/CD integration - Automated testing
β Error simulation - Test failure scenarios
β Frontend development - Backend not ready yet
π Related Documentation
Core Concepts
YAML Format Guide - Configuration syntax
HTTP Methods - GET, POST, PUT, DELETE
Template Variables - Dynamic content
How-to Guides
CRUD Operations - Detailed CRUD patterns
Pagination - Pagination strategies
Docker Deployment - Production deployment
Getting Started
Your First Mock Server - Beginner tutorial
Dynamic Responses - Template variables
Multiple Endpoints - API structure
π‘ Tips & Best Practices
Do β
Start with working examples - Copy and modify instead of starting from scratch
Test frequently - Use curl or the provided test scripts
Follow RESTful conventions - Makes APIs predictable and easy to use
Add meaningful errors - Help users understand what went wrong
Include pagination - Essential for list endpoints
Don't β
Don't over-engineer - Start simple, add complexity as needed
Don't skip error handling - Real APIs fail, your mock should too
Don't forget documentation - Comment your custom modifications
Don't use in production - These are mocks for testing only
π€ Contributing Examples
Have a great example? We'd love to include it!
What Makes a Good Example
β Complete and working - All code must run without errors
β Well-documented - Clear explanations and comments
β Real-world relevant - Solves actual problems
β Best practices - Demonstrates proper patterns
β Test scripts included - Easy to verify functionality
How to Contribute
Fork the repository
Create your example - Follow existing structure
Test thoroughly - Ensure everything works
Add diagrams - Mermaid diagrams are great!
Submit pull request
π Need Help?
Questions? Join GitHub Discussions
Issues? Check the Troubleshooting Guide
Found a bug? Open an issue
Ready to start? Pick an example above and begin mocking! π
Last updated
Was this helpful?