Giter Site home page Giter Site logo

paywall-demo's Introduction

Demonstration of a paywall using expressjs

Running instruction

Development Mode

# install dependencies
yarn

# Run the server
yarn dev

# Start stripe local listener
stripe listen --forward-to localhost:8000/webhook

Environment variables

# Server settings
NODE_ENV=development
SERVER_PORT=8000
HOST=http://127.0.0.1:8000

RESEND_API_KEY=
MONGO_CONNECTION_URI="mongodb://root:toor@localhost:27017/paywall_demo?authSource=admin"

# Run the command `openssl rand -base64 60`
JWT_TOKEN_SECRET=
JWT_EXPIRE=1h

# Stripe API settings
STRIPE_SECRET_KEY=
# generated by stripe listen --forward-to localhost:8000/webhook (in test environment)
STRIPE_WEBHOOK_SECRET=whsec_...

Endpoints

method endpoint description
GET / test endpoint
POST /signup user registration
POST /login login user
GET /account get logged in user details
GET /verify-account/:token Email verification
PUT /account/password Reset password for authenticated user
GET /account/credits Get available credits
GET /packages Get available credit packages that can be bought
POST /packages Create a new credit package
POST /packages/buy Buy a credit package
GET /packages/transactions Get all credit purchase transactions
GET /packages/transactions/:id Get more information about a particular credit purchase transaction (TODO)
GET /resources Fetch all resources
POST /resources Create new resource
GET /resources/:id Fetch a particular resource. If it's a paid resource, resource data will be shown only if user has bought the resource
POST /resources/:id/buy Buy a resource
GET /transactions Fetch all resource transactions for a user
POST /webhook Stripe webhook endpoint

paywall-demo's People

Contributors

srijanmukherjee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.