GithubHelp home page GithubHelp logo

kshitij09 / tazabazar-backend Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 2.0 345 KB

MVP API Server for Grocery Store

Home Page: http://tazabazaar.ddns.net:8080/swagger-ui

License: Apache License 2.0

Java 98.82% Shell 0.87% Dockerfile 0.31%
spring-boot spring-data-jdbc postgresql docker docker-compose grocery-crud

tazabazar-backend's Introduction

TazaBazar-Backend

TazaBazar backend is an MVP API Server for Grocery Store. It's built with Spring Boot and uses Spring Data JDBC for modelling database entities in a Domain Driven manner. The project currently focuses on serving bootstrap data taken from www.siddhagirinaturals.com and supports rudimentary REST APIs to build client applications for a Grocery Shop. Supported features are as follows:

  • Get product list
    • Filter by Product Category
    • Search by Product Name (Full Text Search)
  • Create New User Account (email as unique identifier)
  • JWT Authentication (with refresh tokens)
  • Sync User Cart
  • Place Order
  • Check User Orders

Start browsing the Swagger UI here

Swagger UI Instructions

Checkout Current Database Schema here

Highlights

  • Asymmetric JWT

    The backend, while currently monolith, is written with Microservice mindset and Asymmetric JWT is one of the key aspects to enable the same. We use an asymmetric key pair to generate and validate the JWT token. This allows JwtCreateService to be pulled off into a Microservice and use private-key to generate the token, while other Microservices in the project can share a common implementation of JwtValidateService and public-key or use it as an API Gateway for validation purposes.

  • Authorized / Authenticated APIs

    Thanks to JWT and Spring Boot's excellent support for the same, TazaBazar-backend supports role-based security for REST endpoints. At the moment, three roles (admin, user, vendor) are created by the Initializer and we restrict reading all user details or deleting a user account to admin only. Moreover, certain APIs, such as reading order detail is first approved by matching principal email from the JWT and the Order owner's email, and those details are provided only when the identities match. Some APIs are authenticated using the bearer authentication method.

  • Well tested

    Given the early stage of development, the project tries to maximize the coverage by adding more integration tests than unit tests. v1 APIs started off with an in-memory Database providing a solid foundation for the next iteration, v2 continued with integration with Postgres Server for an extended set of APIs. Lastly, complex scenarios such as 1) creating an account, 2) logging in with those credentials, and 3) performing some action with the access token, are covered in the Controller Tests.

  • End to end deployable with Docker

    The project uses paulschwarz/spring-dotenv to provide a seed environment in the development while conforming to The Twelve-Factor App, uses Environment Variables to store the production configurations.

    The project doesn't have the most streamlined setup yet, but following certain steps, you can get the entire stack up and running with a docker compose up. Check out Install.md to know more about deployment.

    It's in fact has been deployed using the same instructions on a single EC2 spot instance, and DNS resolved to http://tazabazaar.ddns.net (No https as of now ๐Ÿ˜…)

  • OpenApi3 API Documentation

    We use springdoc-openapi for auto-generating the API documentation. Head over to swagger-ui to start interacting with the APIs right from your browser or you can get an openapi3 JSON schema by visiting api-docs. Save the response as a '.json' file to load it in an API Platform such as Postman

Disclaimer

All the content served by this project is taken from siddhagirinaturals.com and is only used for educational purpose. We do not seek to act on behalf of them and have no official business relations with siddhagiri naturals.

License

Copyright 2021 Kshitij Patil

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

tazabazar-backend's People

Contributors

kshitij09 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.