VIP.D.Tube - An Onboarding Platform for DTube

3 comments

wehmoen
61
3 months agoBusy3 min read

Repository

https://github.com/dtube/dtube.redeem

New Projects

  • What is the project about?
    In this post I want to show you the new onboarding platform I built for @dtube and @heimindanger. This platform allows @heimindanger to create voucher codes. He can then give those codes away to friends or potential content creators. These people then can redeem this voucher at https://vip.d.tube/r and get a brand new and free steem account within 2 minutes.

  • Technology Stack
    The platform is build with nodeJS, express, mysql and much more npm packages. It starts a http server and servesdynamicaly generated content to the user.
    When the user opens the page he will get a prompt to enter a voucher code:

image.png

The code will be checked. If the code is not valid or already used the user will get an error message:

https://github.com/dtube/dtube.redeem/blob/master/routes/index.js#L45

image.png

So when the code is valid the user will see a small form where he can choose a username, a display name and his profile picture:

image.png

In case the selected username is already taken a message is shown below the username input.

With clicking the next button the system creates the account and display the keys to the user as well as well as the masterpassword and links to his steemit blog and DTube channel:

image.png

This is all done by one method:

https://github.com/dtube/dtube.redeem/blob/master/routes/index.js#L68

The backend.

The application has a non public backend used for code generation. The access is secured by Steemconnect and will only allow certain users to login:

https://github.com/dtube/dtube.redeem/blob/master/utils/middleware.js

image.png

The "Codes" tab provides an overview of all vouchers in the database:

image.png

Clicking "Create Codes" will open a small form:

image.png

The admin can now enter the amount of codes to generate and if wanted a prefix for all codes.
After clicking the "Create" Button the codes are generated:

 let {prefix = null, amount = 0, type = "default"} = req.body;
    if (amount > 0) {
        let codes = [];
        let csv = "";
        for (let i = 0; i < amount; i++) {
            let code = prefix + serial.generate(10, "-", 6);
            codes.push({code, type});
            csv = csv + code + "\r\n";
        }

        database.code.addMany(codes);

        res.set('Content-Type', 'application/octet-stream');
        res.set('Content-Disposition', 'attachment; filename="codes.csv"');
        res.send(csv);

As you see a CSV file is generated which holds all the new codes.

If you want to test the platform goto:

http://dtube.host and use one of the codes from codes.txt

This instance of the platform runs on the testnet. That means it will NOT create a real steem account you could use on steemit.com.

  • Roadmap
    Integrate voucher codes which can be uses multiple times
    Improve the overall layout of the frontend
  • How to contribute?

GitHub Account

https://github.com/wehmoen

Comments

Sort byBest