Skip to content

Proof of concept two table CRUD implementation of a simple ecommerce store with shopping cart. It has a typescript react ionic cross platform app that uses an openapi/swagger client which is autogenerated from pydal and served via web2py. It uses elasticsearch for indexing and faceted search. Forms are generated from jsonschema7 via react-json-s…

License

Notifications You must be signed in to change notification settings

myiremark/web2py-restful-openapi-crossplatform-app

Repository files navigation

web2py-restful-openapi-crossplatform-app

This repo contains a proof of concept two table CRUD implementation of a simple ecommerce store with shopping cart.

Users can register and login.

Users create inventory items which are available for faceted search.

Users add items to their cart.

Users then checkout, which creates purchase orders for their items.

Users can view their purchase orders later.

Implementation details

  • database definitions are implemented in pydal
  • pydal definitions are converted to swagger / openAPI 3.0 definitions to describe a restful API
    • developers can extend the autogenerated routes via statically defined routes
  • open API defintions generate a typescript-axios API client SDK.
    • axios was chosen over fetch due to first class support for non-standard HTTP headers
  • open API definitions generate forms for database interaction as jsonschema7 via react-json-schema-form
  • elasticsearch indexes inventory items via simple requests API.

HIGHLIGHTS:

Screenshots

User Registration

User Login

Inventory CRUD

Inventory index

Search

Sidemenu

Cart

Development Environment (Vagrant - 2.0.2)

vagrant up will install all dev dependencies in a virtual machine.

alternatively, look in the Vagrantfile for installing individual components.

Customizable Vagrant machine options and defaults

# use an apt proxy and local host shared cache to speed up iterative builds
USE_APT_PROXY = true
USE_APT_CACHE = true
APT_CACHE_HOST_DIR = ""

# if you have multiple vagrant environments
DEV_BOX_NAME = "development"
DEV_BOX_CLUSTER = "SPADevCluster"

Fabric management commands

  extractSchemasAndPathsFromEditorOutput   parses editor-output.json into separate paths.json and schemas.json files for autogenerator to load
  generateAPISpec                          generates a new swagger.json on disk. equivalent to curl -o http://127.0.0.1:9999/api/autogenerated/swagger.json >>
                                           RELATIVE_PATH_TO_API_FILE
  generateAPISpecClient                    generates a new Typescript rest client api from swagger.json on disk
  startAPISpecEditor                       starts swagger editor ui on 192.168.205.21:8080
  startDevAPIServer                        start web2py web server on port 9999 without gui (no admin)
  startDevWebClientServer                  start ionic web server on port 8100 without opeoning browser
  startES                                  start ephemeral elasticsearch on port 9200. modify settings in compose to add a volume and persist data
  testDockerCompose                        turns on and off a busybox image using docker-compose
  typescriptDebug                          check typescript compile diagnostics

License

This repo contains code licensed under more than one license.

web2py has its own license (LGPL) at:

server/web2py/LICENSE.

api application located at:

server/web2py/applications/api/*

has is licensed according to this repo

TODO: build process and remove web2py from repo for clarity

About

Proof of concept two table CRUD implementation of a simple ecommerce store with shopping cart. It has a typescript react ionic cross platform app that uses an openapi/swagger client which is autogenerated from pydal and served via web2py. It uses elasticsearch for indexing and faceted search. Forms are generated from jsonschema7 via react-json-s…

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published