Skip to content

JohnPetros/serverless-shipping

Repository files navigation

Serverless Shipping 📦


🖥️ About the project

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.


✨ Features

Auth

  • 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

Shipping quote calculation

  • 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)

⚙️ Architecture

🛠️ Technologies, tools and services

  • 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


🚀 How to run the application?

🔧 Prerequisites

Before download the prject you will need install some tools:

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 .env file before running the application. See the .env.example file to know which variables should be set

📟 Running the application

# 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


🤝 how to Contribute

# 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


📝 Licence

This application is under MIT Licence. See the licence file to get more details about it.


Made with 💜 by John Petros 👋🏻

About

Serverless application for shipping quote calculation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published