A simple GraphQL express API service to build your own headless viral waitlist.
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
I wanted to build a viral waitlist (where people can move up the waitlist by referring other people) for recent project.
I wanted to control the UX and experience, so I needed it as a headless API. There are a number of "viral waitlist as a service" services out there, but only few of them offered APIs, and none of them were good.
So I built my own real quick and this is it.
Through this service's API users can be added to the waitlist (with optional referral ID), confirm email addresses, and get a users position. It also has some common sense stuff like validating email addresses, rate limiting, and disallowing disposable email providers. That's pretty much it.
It's a single simple express server that uses MySQL for storing user data.
Ratelimiting is just done in memory, you'll want to add Redis if you have multiple servers running.
- npm (v6 or greater)
- node (v12 or greater)
- MySQL
- Fork and clone this repo
- Install NPM packages
npm install
- Copy
.env.example
to.env
and update values - Create a MySQL database and set it into the
.env
file - Run npm build (does database migrations, etc.)
npm run build
- Update instances of "example" throughout the codebase with your URL / name (TODO: move this to env var)
- Run locally
npm run dev
The service is almost entirely used via the GraphQL API (can add a REST API if there's enough demand). There is a single endpoint at /confirmEmail
used as a link in welcome emails to confirm their email address.
The GraphQL endpoint is at /graphql
by default. The mutation signup
takes the arguments of email
(and optional referrerId
which is the ID of the referring user).
This returns the user which includes their position. This mutation is idempotent and can always be used to return a user's position (along with the user
query).
When a user / email is signed up, they receive an email to confirm their email address. They confirm their email address by clicking on a link which takes them to /confirmEmail
. Update the link they are emailed to your instance URL in src/libraries/nodemailer.ts
.
(TODO: update this to an env var).
Every 5 minutes all the users positions are updated (by the number of points/referrals they have, then by sign up time).
There is no functionality to remove people from the list or "invite" them. I just did this manually with direct access to the database.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU GPLv3 License. See LICENSE
for more information.
Adrian Artiles - @AdrianArtiles
Project Link: https://github.com/AdrianArtiles/viral-waitlist-api