An open API service indexing awesome lists of open source software.

https://github.com/deadpoolx7/mockforge

REST Api to serve dummy mock JSON data for development and testing purpose. Built using SpringBoot and Java Faker. Try playground on 👇
https://github.com/deadpoolx7/mockforge

api-rest docker-compose dockerfile doker dummy-data dummyjson json playground spring-boot

Last synced: about 1 month ago
JSON representation

REST Api to serve dummy mock JSON data for development and testing purpose. Built using SpringBoot and Java Faker. Try playground on 👇

Awesome Lists containing this project

README

          

# MockForge

MockForge is a flexible mock data generation API that helps developers create realistic test data using [Java Faker](https://github.com/DiUS/java-faker) field paths.

It provides a simple REST endpoint to generate customized JSON data for development and testing purposes.

## Features

- Dynamic JSON data generation based on field paths
- Support for nested object structures
- Configurable number of mock objects
- OpenAPI/Swagger documentation
- Docker support
- Simple REST API interface

## Getting Started

### Prerequisites

- Java 17 or higher
- Maven 3.6+
- Docker (optional)

### Running Locally

1. Clone the repository:
```bash
git clone https://github.com/yourusername/mockforge.git
cd mockforge
```

2. Build the project:
```bash
./mvnw clean install
```

3. Run the application:
```bash
./mvnw spring-boot:run
```

The API will be available at `http://localhost:8080/`

### Using Docker

1. Build the Docker image:
```bash
docker build -t mockforge .
```

2. Run the container:
```bash
docker run -p 8080:8080 mockforge
```

### API Usage
Generate Mock Data
```bash
GET /mock?fields=name.firstName,address.city,phone.cellPhone&count=2
```

Parameters:

- `fields` : Comma-separated list of Java Faker field paths
- `count` (optional) : Number of Objects to generate (default : 1)

Example Response:

```json
[
{
"name": {
"firstName": "John"
},
"address": {
"city": "New York"
},
"phone": {
"cellPhone": "1-234-567-8900"
}
},
{
"name": {
"firstName": "Jane"
},
"address": {
"city": "Los Angeles"
},
"phone": {
"cellPhone": "1-234-567-8901"
}
}
]
```
Available Field Paths

The API supports all field paths available in Java Faker. Some commonly used paths include:

- `name.firstName`
- `name.lastName`
- `address.streetAddress`
- `address.city`
- `address.country`
- `internet.email`
- `phone.cellPhone`
- `company.name`
- `commerce.price`

For a complete list of available fields, visit the [Java Faker Documentation](https://dius.github.io/java-faker/apidocs/index.html)

## API Documentation
Access the OpenAPI/Swagger documentation at:

```bash
http://localhost:8080/swagger-ui.html
```

## Deployment

The project includes a render.yml configuration for deployment on Render.

### To deploy:

- Fork this repository
- Connect your fork to Render
- Create a new Web Service using the repository

---

## Contributing
- Fork the repository
- Create your feature branch (`git checkout -b feature/AmazingFeature`)
- Commit your changes (`git commit -m 'Add some AmazingFeature'`)
- Push to the branch (`git push origin feature/AmazingFeature`)
- Open a Pull Request

## License
This project is licensed under the MIT License - see the [LICENSE](#LICENSE) file for details.