PointsIssuer is a TypeScript SDK and Next.js application that allows projects to issue points to their users for off-chain actions. The SDK provides setter and getter functions for points management and stores the data in a PostgreSQL database. The project includes an API endpoint for registering API keys and a simple frontend utility for manually distributing points.
- Node.js (>=18.x)
- Vercel account (for deployment & db)
- Clone the repository:
git clone [email protected]:cryptodev523/point-issuer.git
cd point-issuer
- Install dependencies:
cd utility
npm install
- Create a new PostgreSQL on Vercel and connect the project.
- Create a
.env.local
file in theutility
folder with database connection details
- Start the utility:
npm run dev
- Open your browser and navigate to
http://localhost:3000
to access the frontend utility.
To register an API key for your project, send a POST request to /api/project
with your project details:
curl -X POST http://localhost:3000/api/project -d '{"name": "Your Project Name"}'
Record the project id from the /project
endpoint response.
Send a POST request to /api/credential
with the projectId.
curl -X POST http://localhost:3000/api/credential -d '{"projectId": "Your Project Id"}'
Run the utility Next.js project with the following command.
npm run dev
Go to 'http://localhost:3000' and input the api key, event name, number of points, address
Deploy the application to Vercel:
- Connect your GitHub repository to Vercel.
- Set up environment variables in Vercel with your database connection details.
- Deploy the project.