1.0.1 • Published 8 months ago

bap-boilerplate-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

BAP SDK

What is BAP SDK?

A comprehensive NodeJS + React Native SDK, empowering developers to efficiently create Beckn-enabled consumer-facing applications (BAPs) using a streamlined boilerplate codebase. The SDK takes care of Beckn's backend code, allowing developers to prioritize UI/UX enhancements and simplify the overall development process.

What is the Project Application?

The SDK not only manages the backend code but also offers a pre-designed UI template. This eliminates the need for users to start their applications from scratch. They can make modifications to the provided UI, while the SDK handles the backend intricacies. This approach lets developers focus sharply on refining UI and UX, thus streamlining the development process.

Getting started

To get started with the BAP Boilerplate SDK, please try out our cloud-based demo site at: https://experience-guide-staging.becknprotocol.io/select-experience/

Features

  • CLI based tool for initialisation
  • Boilerplate UI Templates
  • Backend SDK Code
  • Search use case for 2 domains
  • Sorting as per rating use case

Tech Stack

Client: React Native, Expo, Axios

Server: Node.js, Beckn Protocol

Tools: Postman

Table of contents


Prerequisites

Software dependenciesVersions
node> 14.x.x (Install the latest release of LTS version)
expo-cli> 6.x.x (Install the latest release: npm install -g expo-cli)
ts-nodeLatest version of yarn: npm install -g ts-node
yarnLatest version of yarn: npm install -g yarn
nodemonLatest version of nodemon: npm install -g nodemon

Project Setup

1. Using GitHub Repo

Clone the project

  git clone https://github.com/beckn/BAP-Boilerplate-SDK.git

Open BAP-Boilerplate-SDK folder in your terminal and run

  sudo npm install -g

Open a new folder in which you want to create your project and run

  bap-sdk

Choose the required prompts and enter the required fields provided by the CLI tool. This will setup a template project in your current folder, which can be modified by users.

2. Using NPM Package

Install the npm package globally

  sudo npm i bap-boilerplate-sdk -g

Open a new folder in which you want to create your project and run

  bap-sdk

Choose the required prompts and enter the required fields provided by the CLI tool. This will setup a template project in your current folder, which can be modified by users.

3. Using Docker Images

Pull the latest docker image

  docker pull sandeeppillai/bap-sdk:v1

Run the container in interactive mode

  docker container run -it sandeeppillai/bap-sdk:v1

Choose the required prompts and enter the required fields provided by the CLI tool. This will setup a template project in the working directory of the docker container.

Copy the project-name created above Create a new directory and copy the newly created project from docker container to your working directory

  docker cp {container-id}:/app/{project-name} .

Type docker ps -a to find the container id


Running Application

Once the application is setup in your working directory follow the below steps to run your app:

Installing Dependencies

  npm install

Setup Enviornment Variables To run this project, you will need to add the following environment variables to your .env file.

Create .env file in current working directory: touch .env

Fill the env variables as shown above

Env VariablesDescriptionType
BECKN_URLThis is the api endpoint used to make call's to the protocol serverstring
MONGO_INITDB_ROOT_USERNAMEusername for the mongodb imagestring
MONGO_INITDB_ROOT_PASSWORDpassword for the mongodb imagestring
MONGO_INITDB_DATABASEdatabase name for the mongodb imagestring
RABBITMQ_DEFAULT_USERusername for the rabbitmq imagestring
RABBITMQ_DEFAULT_PASSpassword for the rabbitmq imagestring

Replace the default url in beckn.config.ts with process.env.BECKN_URL, similarly replace default variables inside docker-compose.yaml file if needed.

Setting up Backend Server Run all the required infrastructure and services using: docker-compose up in the current working directory.

If the developer is provided with an api endpoint add it in the env file in BECKN_URL. All the backend calls will be made to this api.

Else if the developer want's to test the local backend follow the steps provided here: Protocol Server Setup

Run application

  npm start

Demo Links

1. Link to Demo recording: video

2. Link to Deployed Application: demo


Project Structure

├── templates/
│   ├── BAP-Education/             # Boilerplate for education
│   │    └── docker-compose.yaml  
│   │  
│   ├── BAP-Mobility/              # Boilerplate for mobility
│   │    └── docker-compose.yaml  
│   │   
│   └── BAP-Retail/                # Boilerplate for retail 
│        └── docker-compose.yaml 
│ 
├── Dockerfile                     # File to deploy docker images
├── index.js                       # sdk entry point for initialisation 
├── outputDirectory.js             # sdk output file
└── package.json

Reporting Issues

We have an open and active issue tracker. Please report any issues.

1.0.1

8 months ago

1.0.0

8 months ago