Serverless Shipping is a serverless application that calculates the price of each shipping quote available to a given zipcode.
This app is running on AWS Lamda service, that means there is no need for manual server, infrastructure and scalability management. The app is able to scale automatically based on the demand.
It has been used for the mobile app Sertton where the user can calculate the price based on their zipcode before buying an item on the e-commerce.
This app uses Melhor Envio API under the hood, a free shipment plataform that intermediates several brazilian shipping companies.
- This App should be authenticated by Melhor Envio API using OAuth protocol, where the former should behave client and resource server
- This App should request to Melhor Envio refresh the auth token every week on Sunday 00:00
- This App should validate the access token before sending to Melhor Envio API
- This App should store both access token and refresh token in cache
- This App should return the shipping quotes based on Sertton's zipcode and the customer's zipcode and price, quantity and dimensions of the requested products (width, height, weight and length)
-
NodeJs for running JavaScript on server side
-
Serverless Framework for helping to develop and deploy the serverless application
-
Melhor Envio for providing shipping service quote calculation
-
Redis for storing the tokens in cache for the authentication
For more details about the project's dependencies like specific versions of each dependency, see package.json
Before download the prject you will need install some tools:
-
Docker, the amazing technology to manage containers.
Besides that, it is good to have some tool to write the code like VSCode
Also it is pivotal setting the environment variables on the
.envfile before running the application. See the .env.example file to know which variables should be set
# Clone this repo
git clone https://github.com/JohnPetros/shipment-service.git .
# Install the node dependencies
npm install
# Run the application on the local environment
npm run local
# Start the redis docker container
docker compose up
Probably the aplication will be running on http://localhost:3002
# Fork this repo
$ git clone https://github.com/JohnPetros/shipment-service.git
# Create a nem branch for the new feature
$ git checkout -b new-feature
# Commit your changes:
$ git commit -m 'feat: <New Feature>'
# Push your branch:
$ git push origin new-feature
You must replace new-feature with the name the feature you are adding
You can also open a new issue about some problem, question or sugestion for the project. I will be happy to help as well as improve this application
This application is under MIT Licence. See the licence file to get more details about it.
Made with 💜 by John Petros 👋🏻