Skip to content

BDucar/dreamnet-agent-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DreamNet Agent Store

This repository contains a minimal implementation of an AgentKit‑compatible marketplace for DreamNet. It is designed as a proof‑of‑concept that demonstrates how to wire up a Next.js 14 application with a Postgres database (via Prisma), Stripe payments and a simple API for managing agents and purchases. The code here is not production ready, but it provides a clear starting point for building a full‑fledged marketplace.

Project structure

  • package.json – project metadata and dependencies.
  • src/app – Next.js 14 (app router) pages and API routes.
    • layout.tsx – top level layout shared by all pages.
    • page.tsx – home page that redirects to /store.
    • store – store listing and detail pages.
    • account – simple account page showing installed agents.
    • api – Next.js route handlers implementing the marketplace API (see below).
  • prisma – database schema and seed script.
    • schema.prisma – Prisma schema defining the database models.
    • seed.ts – seeds three internal agents (ProcureNet, DeployKeeper, DreamKeeper).
  • .env.example – template for environment variables (see Configuration).
  • postman_collection.json – example Postman collection illustrating the API.

API overview

The API is implemented with Next.js route handlers under src/app/api. Each route corresponds to an operation in the store:

Method & route Purpose
GET /api/agents List all agents with optional filters.
POST /api/agents Create a new agent (admin only).
GET /api/agents/[slug] Fetch a single agent by slug.
POST /api/agents/[slug]/verify Mark an agent as verified (admin only).
POST /api/checkout/[slug] Initiate a Stripe Checkout session for an agent.
POST /api/webhooks/stripe Handle Stripe webhooks to activate licenses.
POST /api/install/[slug] Perform an AgentKit import for the agent and register a license.
GET /api/me/agents List the current user's installed agents.
POST /api/metrics/usage Endpoint for agents to report usage metrics.

Note on authentication

This skeleton does not implement a full authentication system. It assumes that your application will provide a user ID (via wallet or magic link login) on the request object. You should replace the getUserId helper in src/lib/auth.ts with your own logic.

Configuration

Copy .env.example to .env and fill in the following environment variables:

  • DATABASE_URL – Postgres connection string for Neon.
  • STRIPE_SECRET_KEY – secret key for your Stripe account.
  • STRIPE_WEBHOOK_SECRET – webhook secret used to verify Stripe webhook signatures.
  • NEXT_PUBLIC_STORE_URL – public URL of your deployed store (used in webhook handlers).
  • AGENTKIT_API_BASE – base URL for the AgentKit service.
  • AGENTKIT_API_KEY – API key for AgentKit import/export.
  • JWT_SECRET – secret used to sign JSON Web Tokens (if you implement authentication).

Running locally

  1. Install dependencies:

    npm install
  2. Generate the Prisma client and run the migrations:

    npx prisma generate
    npx prisma migrate dev --name init
  3. Seed the database:

    npm run seed
  4. Start the development server:

    npm run dev

The application will be available at http://localhost:3000.

Deployment

Deploy the app to Vercel and set the environment variables on the project dashboard. Make sure to configure the Postgres database (e.g. on Neon) and apply your migrations. For Stripe webhooks to work, set the NEXT_PUBLIC_STORE_URL to the public URL of your deployment.

Licence

This project is provided under the MIT licence. See LICENSE for more details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published