API Configuration
Launchtoday comes with a backend service that your mobile app will make API requests to. The service provides secure endpoints for payment processing through Stripe, with planned expansion for push notifications and other features.Prerequisites
Before getting started, you should be familiar with:- TypeScript: The backend services are written in TypeScript
- Koa: Used as the web framework for building backend services
- Docker: Required for containerizing the application
- fly.io: Used for deploying and hosting the backend services
Repository Setup
First, clone the repository and install dependencies:The project contains a
.nvmrc
file which specifies Node.js version 18.18.2.
You can either: - Use this version by running nvm use
to automatically
switch to 18.18.2 - Or modify the .nvmrc
file to use your preferred Node.js
version (must be ≥18.18.2)Environment Setup
Copy the example environment file to create your.env
using the following command:
.env
file should look like this:
Running the API Service
Once you have the repository setup and the environment variables set up, you can start the API service using the following command:http://0.0.0.0:3000/hello
in your web browser. You should see a JSON response like this:
Deploying the API Service
As previously mentioned, the API service is deployed to fly.io. There are several other alternatives to fly.io, but for now we’ll focus on deploying with fly.io. Ensure you have a fly.io account and are logged in before proceeding. You can run the following command to deploy the API service:- Run
fly auth signup
if you don’t have an account - Run
fly auth login
to login to your fly.io account - Run
fly launch
to launch the API service
fly deploy
.