Skip to content

GroundLock/MarketAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ MarketAPI

A simple REST API for stores, built with Spring Boot.
You can add, delete, update, and view products from your store β€” all locally and easily via Swagger UI.


πŸš€ Features

  • Add new products to your store
  • View a list of all products
  • View product details by ID
  • Update existing product information
  • Delete products
  • Interactive API documentation with Swagger UI

πŸ“¦ API Endpoints

All endpoints are prefixed with /products:

Method Endpoint Description
GET /products Retrieve all products
GET /products/{id} Retrieve a product by ID
POST /products Create a new product
PUT /products/{id} Update an existing product by ID
DELETE /products/{id} Delete a product by ID

Error handling is included for not-found resources on GET, PUT, and DELETE.


🧰 Tech Stack

  • Java 17
  • Spring Boot 3.5.0
  • Spring Web
  • Spring Data JPA
  • PostgreSQL
  • Swagger (springdoc-openapi)
  • dotenv-java for loading environment variables

βš™οΈ Getting Started

1. Clone the repository

git clone https://github.com/your-username/marketapi.git
cd marketapi

2. Configure Environment Variables

Create a .env file in the root directory with your database credentials:

DB_URL=jdbc:postgresql://localhost:5432/yourdbname
DB_USERNAME=yourusername
DB_PASSWORD=yourpassword

    Make sure .env is in your .gitignore!

3. Create the PostgreSQL Database

Create a new database manually using your preferred tool or with:

createdb yourdbname

4. Run the API

./mvnw spring-boot:run

The app will start on http://localhost:8080
πŸ“˜ API Documentation

Once the app is running, visit the Swagger UI:

πŸ”— http://localhost:8080/swagger-ui/index.html
πŸ” Authentication

This API does not use authentication β€” it's meant for learning and local development.
πŸ§ͺ Testing

Unit and integration tests are located in src/test/java/.

Run all tests with:

./mvnw test

πŸ›  Deployment

This project is designed for local use only.
No production deployment or cloud support is set up.
πŸ“„ License

This project is for personal use and learning.
No license is currently applied.
πŸ‘¨β€πŸ’» Author

Made by GroundLock.
Feel free to fork, modify, and learn from it!

About

A REST api for supermarkets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages