Skip to content

throneless-tech/bitpart-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Bitpart Dashboard

This is a Next.js project bootstrapped with create-next-app. It uses the Chakra UI v3 component system, Auth.js for authentication, and Prisma to connect to a PostgreSQL database.

Getting Started

Install dependencies

First, install dependencies from your terminal:

$ npm install

Prepare authentication

Run npx auth secret to create a random value for Auth.js. See their docs for more info.

Add the following to your .env.local file (remember, you will also have a separate .env file with other vars):

NEXTAUTH_SECRET="thisisarandomsecret0123456789="

Attach the databse

This project uses Prisma ORM to connect to a PostgreSQL database. You must have a Postgres database running. See the Postgres website for more information on starting a PostgreSQL server.

Add the url to the database as your DATABASE_URL in your .env file.

Run npx prisma migrate dev in development or npx prisma migrate deploy in production to apply the migrations.

Seed the database with invite codes

Users may only sign up for a Bitpart dashboard account with an invite code. An invite code may only be used once per user, so do not plan to use the same invite codes for multiple users. To create 100 random invite codes, run node create-codes.mjs from the root directory. This will create a file called codes.json that will contain your randomized invite codes to add to the database.

Navigate to the prisma/seed.ts.example file. Duplicate this file within the prisma directory and name it seed.ts. Here, you will see where you can enter the invite codes you've created. Replace the example codes with your unique invite codes. Note that that seed.ts file will NOT be committed to your version history to keep your codes safe.

Finally, to seed the database, run npx prisma db seed in your terminal.

You can also run npx prisma studio to view the database info at http://localhost:5555.

Run Next

You can run the development server with:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Connecting to Bitpart server

For the dashboard to fully function, you will also need to run bitpart and bitpart-ems. Follow the links for instructions on how to run both.

Add to your .env file the following:

AUTH_DEBUG=true
AUTH_TRUST_HOST=false # true for production build

BITPART_SERVER_HOSTS=127.0.0.1:5000,127.0.0.1:5005,127.0.0.1:5010
BITPART_SERVER_TOKEN="YOURLONGSECRETHERE"

DATABASE_URL="postgresql://postgres:password@127.0.0.1:5432/bitpart-dashboard-postgres-instance?schema=public"

EMS_SERVER_HOST=127.0.0.1:3005

The .env is configured to be able to support multiple BITPART_SERVER_HOSTS for load balancing purposes. It will also work with one server host.

Deployment

The instructions above work for local deployment. However, if you'd like to use a container such as Docker, follow the commands below.

Container

Ensure your Bitpart, Bitpart EMS and Bitpart dashboard images are all running on the same network. To run the dashboard, customize the following command:

podman run -d --name bitpart-dashboard -e AUTH_DEBUG=true -e BITPART_SERVER_URL=127.0.0.1 -e BITPART_SERVER_PORT=5000 -e BITPART_SERVER_TOKEN="YOURLONGSECRETHERE" -e DATABASE_URL="postgresql://postgres:password@bitpart-dashboard-postgres:5432/bitpart-dashboard?schema=public" -e EMS_ENDPOINT="/ems" -e EMS_SERVER_URL=127.0.0.1 -e EMS_PORT=3005 -e ESIM_ENDPOINT="esim_codes" -e VPN_ENDPOINT="vpn_tokens" -e AUTH_TRUST_HOST=true -e NEXTAUTH_SECRET="thisisarandomsecret0123456789=" -p 4000:3000 --network bitpart bitpart-dashboard:latest

About

A user-facing dashboard for a Bot Creator to interface with Bitpart.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages