Project
Quick Start

Quick start

ℹ️

Prerequisite You should have installed Node.js (version 18.10.0 or higher).

Clone the project and install the dependencies

git clone https://github.com/AprilNEA/ChatGPT-Admin-Web.git
 
cd ChatGPT-Admin-Web
 
pnpm install

pnpm install: npm i -g pnpm

Initialize the database

Set the DATABASE_URL environment variable, for example:

export DATABASE_URL=postgres://postgres:your_password@localhost:5432/postgres

A PostgreSQL database can be started quickly with Docker.

docker run -itd --name caw -e POSTGRES_PASSWORD=your_password -p 5432:5432 -d postgres

Run it in the project root directory:

pnpm run db:init
``
 
You will see the following output, which indicates that the database has been initialized successfully:
 
```bash
> [email protected] db:init /path/to/ChatGPT-Admin-Web
> prisma db push && prisma db seed
 
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "localhost:5434"
 
🚀 Your database is now in sync with your Prisma schema. Done in 245ms
 
 Generated Prisma Client (v5.3.1) to ./prisma/client in 297ms
 
Environment variables loaded from .env
Running seed command `ts-node prisma/seed.ts` ...
{
    models: {count: 2},
    categories: {count: 1},
    products: {count: 1},
    limits: {count: 1}
}
 
🌱 The seed command has been executed.
 

Set the REDIS_URL environment variable, for example:

export REDIS_URL=redis://localhost:6379/0

A Redis database can be started quickly with Docker.

docker run -p 6379:6379 -d redis/redis-stack:latest

Start the project

pnpm run start

The project runs at http://localhost:3000 by default.

The first time you run the project, it will automatically generate config.json, and import DATABASE_URL and REDIS_URL environment variables, and you can modify config.json directly for subsequent changes.

👷

Dashboard is coming soon.

~~The first time you open it, you will be redirected to http://localhost:3000/install to set up your administrator account and password, and then you can log in. ~~

Configuration

ℹ️

Only Resend passed the test for the mail service.

SMS service only UniSMS passed the test.

Payment service only Xunhu passed the test.

 
{
  ... // Auto-generated section
  "openai": {
    "baseUrl": "https://api.openai.com/v1",
    "keys": [
      "fff"
    ]
  },
  "email": {
    "use": "resend",
    "domain": "example.com",
    "resend": {
      "apiKey": "fff"
    }
  },
  "sms": {
    "use": "uni",
    "uni": {
      "signature": "XX科技",
      "apiKey": "ffffff"
    }
  },
  "payment": {
    "use": "xunhu",
    "xunhu": {
      "wapName": "XX科技",
      "appId": "ffffff",
      "appSecret": "ffffff",
      "notifyUrl": "https://example.com",
      "returnUrl": "https://example.com"
    }
  }
}