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.

Example
Description
Complexity
Key Concepts

Task management API

⭐ Beginner

CRUD, pagination, search, errors

Complete blog platform

⭐⭐ Intermediate

Nested resources, relationships, comments

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.

Example
Description
Complexity
Use Case

Payment processing

⭐⭐ Intermediate

Local dev, CI/CD, testing

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.

Example
Description
Complexity
Key Concepts

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

  1. Start Simple: Basic CRUD

    • Learn CRUD fundamentals

    • Understand HTTP methods

    • Practice with curl commands

  2. Add Complexity: Blog API

    • Nested resources (posts β†’ comments)

    • Resource relationships

    • Advanced queries

  3. Real-World Integration: Stripe Mock

    • Mock external APIs

    • Error scenarios

    • Integration testing

  4. 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/:id patterns

  • βœ… 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

Core Concepts

How-to Guides

Getting Started

πŸ’‘ 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

  1. Fork the repository

  2. Create your example - Follow existing structure

  3. Test thoroughly - Ensure everything works

  4. Add diagrams - Mermaid diagrams are great!

  5. Submit pull request

πŸ“ž Need Help?


Ready to start? Pick an example above and begin mocking! πŸš€

Last updated

Was this helpful?