Next.jsReactAdmin dashboardDocumentationStarter

Apis4Tokens — Next.js Admin dashboard Template

By TheHalfTimePrince

A Next.js-based starter template for an API marketplace, including Stripe payments, JWT authentication, token billing, a user dashboard, and a documentation page, plus a helper function for creating new API endpoints.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-14View source

What stands out

A quick read of the recorded project description.

01

Provides a landing page, a pricing page connected to Stripe Checkout, a user dashboard, and a documentation page

02

Token-based API billing: accounts start with 1000 tokens by default, deducted according to the endpoint's configured token cost

03

apiTemplate helper function for creating new API endpoints, requiring only the logic and token cost

04

Email/password authentication, JWT stored in a cookie, with global and local middleware protecting routes and Server Actions

05

Activity log system records API usage and token consumption

06

Tech stack is Next.js, Postgres, Drizzle ORM, Stripe, and shadcn/ui

Template Details

Apis4Tokens is a starter template for building an API marketplace with Next.js. The README states that it includes a landing page, a pricing page connected to Stripe Checkout, a user dashboard (for managing API keys and token balance), a documentation page, and a helper function apiTemplate for creating new API endpoints—just fill in the business logic and token cost in the endpoint. The template uses token-based API billing: accounts start with 1000 tokens by default, and each call deducts the endpoint's configured token cost from the balance, with an activity log recording API usage and token consumption. Authentication is email/password, with JWT stored in a cookie, and provides global middleware to protect logged-in user routes and local middleware to protect Server Actions or validate Zod schemas. For the tech stack, the README lists Next.js, Postgres, Drizzle ORM, Stripe, and shadcn/ui. Deployment instructions cover the process using Coolify (push code, configure environment variables, run migrations and seeds, deploy) and setting up Stripe Webhooks via a script after deployment. The README does not provide information on performance, concurrency capacity, production readiness, or features beyond those described.

Next.jsBackendDocumentationStarter

Is it right for your project?

Use Cases

  • Building a token-billed API marketplace prototype
  • Adding token balance, API key, and call deduction mechanisms to an existing API service
  • Integrating Stripe Checkout and Webhook payment flows into a Next.js project
  • Providing a user dashboard and Markdown documentation page for an API product

Suitable For

  • Developers who want to start building an API marketplace or API billing product with Next.js
  • Developers who need a reference implementation of email/password JWT authentication and middleware-protected routes
  • Teams planning to use a combination of Postgres, Drizzle, and Stripe

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    After cloning the repository, run pnpm install and use pnpm db:setup to create the .env file

  2. 2

    Run pnpm db:migrate and pnpm db:seed in sequence to complete database migration and initial data seeding

  3. 3

    Start the development server with pnpm dev and visit http://localhost:3000

  4. 4

    To test Stripe payments, use card number 4242 4242 4242 4242, any future date, and any three-digit CVC

  5. 5

    Deploying to Coolify requires configuring environment variables such as BASE_URL, STRIPE_SECRET_KEY, POSTGRES_URL, AUTH_SECRET, and running pnpm deployWebhook after deployment to set up Stripe Webhooks

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in the public repository; the free scope is the code of that version and does not imply that external services or third-party assets are free.

Must comply with when using

  • Free use, modification, commercial use, and distribution of this version's code are permitted.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses; they cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur separate charges.
  • The pricing page relies on Stripe Checkout; using payment features requires a Stripe account and corresponding keys.
  • Payment features depend on the third-party service Stripe, which requires self-registration and configuration.
  • Testing API endpoints requires first registering an account and generating an API key in the dashboard.
  • Testing payments requires using Stripe test card information; actual payment collection requires configuring a real Stripe account.
  • Deploying to production requires self-installing or using the Coolify hosting service.
  • Production deployment requires configuring environment variables such as Stripe production keys.
  • Production deployment requires providing your own Postgres database and configuring the connection address.
  • After deployment, Stripe Webhooks must be set up to complete the payment callback flow.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

* Pricing page connected to Stripe Checkout

Original README

* **Payments**: [Stripe](https://stripe.com/)

Original README

To test the endpoint, create an account and generate an API key from the dashboard. Each account starts with 1000 tokens by default. You can make a request to the endpoint using `curl` like this:

Original README

To test Stripe payments, use the following test card details:

Original README

2. **Set up Coolify**: Install [Coolify]() on your server or use Coolify's managed service.

Original README

* `STRIPE_SECRET_KEY`: Your Stripe production secret key.

Original README

* `POSTGRES_URL`: Your production Postgres database URL.

Original README

After deployment, set up the Stripe webhook for the production environment. Use the following command:

Original README
https://github.com/TheHalfTimePrince/Apis4Tokens/blob/main/LICENSEhttps://github.com/TheHalfTimePrince/Apis4Tokens/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-14. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 82 / 100
Technologies
Next.js · React
Website type
Admin dashboard · Documentation · Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2024-11-09
Screenshot last checked
2026-10-14

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Review declaration: codex-user-requested-batch-review-20261017 · 2026-10-16

Inspect the recorded source material

SHA-256: c6c182d1bd7a7ef831665173f2a2b22a81ad7aadde2bc0d372aef84679dd4e75

2026-10-14T05:12:03.574Z

Source file / repository
# Next.js APIs for Tokens SaaS Starter

This is a starter template for building an API marketplace using **Next.js**. It includes features for authentication, Stripe integration for payments, documentation page, and a dashboard for users to manage their API Keys and token balance. There is also a helper function to create new API endpoints, simply add the logic and the token cost.

## Features

* Landing Page (/)
* Pricing page connected to Stripe Checkout
* User dashboard for managing API tokens and creating custom endpoints
* Token-based system for API usage
* Email/password authentication with JWTs stored in cookies
* Global middleware to protect routes for logged-in users
* Local middleware for protecting Server Actions or validating Zod schemas
* Activity logging system for tracking API usage and token consumption

## Tech Stack

* **Framework**: [Next.js](https://nextjs.org/)
* **Database**: [Postgres](https://www.postgresql.org/)
* **ORM**: [Drizzle](https://orm.drizzle.team/)
* **Payments**: [Stripe](https://stripe.com/)
* **UI Library**: [shadcn/ui](https://ui.shadcn.com/)

## Getting Started

1. Clone the repository:

```bash
git clone [https://github.com/TheHalfTimePrince/Apis4Tokens](https://github.com/TheHalfTimePrince/Apis4Tokens)
cd Apis4Tokens
pnpm install
```

1. Use the included setup script to create your `.env` file:

```bash
pnpm db\:setup
```

1. Run the database migrations and seed the database with initial data:

```bash
pnpm db\:migrate
pnpm db\:seed
```

1. Start the Next.js development server:

```bash
pnpm dev
```

1. Open [http://localhost:3000](http://localhost:3000) to see the app.

## Creating an API Endpoint

To create a new API endpoint, use the `apiTemplate` function. Here's an example:

```typescript
// app/api/example/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { apiTemplate } from '@/lib/easy-api-template';

async function exampleLogic(req: NextRequest) {
  const message = "Hello from the API!";
  return NextResponse.json({ message }, { status: 200 });
}

export const POST = apiTemplate({
  tokenCost: 100, // Cost of this API call in tokens`
  logic: exampleLogic,
});
```

This creates a new POST endpoint at `/api/example` that costs 100 tokens per call.

To test the endpoint, create an account and generate an API key from the dashboard. Each account starts with 1000 tokens by default. You can make a request to the endpoint using `curl` like this:


Copy code
```bash
`curl -X POST `[`https://yourdomain.com/api/example`](https://yourdomain.com/api/example)` -H "Authorization: Bearer <YOUR_API_KEY>"`
```

## Add Documentaiton

To add documentation for your new API, create a new markdown file in the `@/contents/docs` folder and explain how to use it.

The token usage will be deducted from the user's balance.

## Testing Payments

To test Stripe payments, use the following test card details:

* **Card Number**: 4242 4242 4242 4242
* **Expiration**: Any future date
* **CVC**: Any 3-digit number

## Going to Production

When you're ready to deploy your API marketplace to production, follow these steps:

### Deploy with Coolify

1. **Push your code to a Git repository**: This can be a public or private repository.
2. **Set up Coolify**: Install [Coolify]() on your server or use Coolify's managed service.
3. **Connect to your Git repository**: Once Coolify is installed, add your repository to Coolify by following the instructions in the platform's dashboard.
4. **Configure environment variables**: Add the necessary environment variables in Coolify's project settings. Make sure to include:
   * `BASE_URL`: Your production domain.
   * `STRIPE_SECRET_KEY`: Your Stripe production secret key.
   * `POSTGRES_URL`: Your production Postgres database URL.
   * `AUTH_SECRET`: A random string (use `openssl rand -base64 32` to generate one).
5. **Set up the database**: Use Coolify's database feature or your own managed Postgres instance. Make sure the database URL matches what’s in your `.env` file.
6. **Run database migrations**: In Coolify's dashboard, open the terminal and run:

   ```bash
   pnpm db:migrate
   pnpm db:seed
   ```

7. **Deploy the app**: Once everything is set up, click deploy in Coolify, and it will handle the rest.

### Set up the Stripe Webhook

After deployment, set up the Stripe webhook for the production environment. Use the following command:

```bash
pnpm deployWebhook
```

This script will create a webhook and update your `.env` file with the new `STRIPE_WEBHOOK_SECRET`.

## Scripts

* **pnpm db**: Create your `.env` file
* **pnpm db**: Run database migrations
* **pnpm db**: Seed the database with initial data
* **pnpm deployWebhook**: Deploy the Stripe webhook for production


Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.