# 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