Dynamic Donations | Lightweight express.js + MySQL API

This API is built with express.js and MySQL as the underlying database.
I decided to use express.js because the majority of the Roblox community is not very expert with web development and a Node.js project is really a good way of getting started thanks to its simplicity and ease of configuration.

This does not come with an API wrapper for Roblox games, but it’s relatively simple to create one yourself, to do that refer to the documentation for the dev product creation endpoint: GitHub - iKingNinja/DynamicDonations: Lightweight express.js server for creating dynamic developer products.. Though, if this gets enough attraction I might release one.

Use case

If you ever added donations to your game, you probably created 4/5 developer products and added buttons to the game’s UI to prompt their purchase.
With Dynamic Donations you can replace those buttons with a TextBox and a Confirm button that players can use to donate any amount of robux they want.
Moreover the API supports a coverTax parameter which if set to true, will increase the price of the dev product that the player will be prompted to purchase by 30%.

Source

GitHub Repo: GitHub - iKingNinja/DynamicDonations: Lightweight express.js server for creating dynamic developer products.

Documentation

Documentation is available here (GitHub).

:clapper: Live demo

Further development

If you want to expand the API you can take a look at how the project is set up.

The server uses an automatic router so if you want to add another endpoint you can create a file in the routes folder and paste the following template:

import { NextFunction, Request, Response } from "express";
import { MappableRouter, Middleware } from "../../../types/utils/mappable-router.js";
import authenticateWithApiKey from "../../../middlewares/authenticate-with-api-key.js";
import prisma from "../../../db/prisma.js";

export const router: MappableRouter = {
    method: "get", // All HTTP methods are supported
    endpoint: "/api/v1/hello-world,
    middlewares: new Set<Middleware>().add(authenticateWithApiKey), // Remove this line if you do not want authentication
    controller: async (req: Request, res: Response, next: NextFunction) => {
         res.send("Hello world!");
    }
}

Additionally, here’s a Postman workspace if you want to test it locally: Postman

7 Likes