2bttns
  • Getting Started
    • What is 2bttns?
    • Quick Start
    • 🆕You Asked We Listened
  • HOW TO
    • Set up your Console
    • Use the API
    • Build a game
    • Manage game data
    • Integrate game via API
    • Retrieve scores via API
  • References
    • APIs
      • Authentication
      • Generate Game URL
      • Games
      • Game Objects
      • Tags
      • Players
      • Admin
      • Export/Import
    • Command Line Interface (CLI)
      • Install
      • Usage
      • Configuration
  • TUTORIALS
    • ✨Personalize profiles with 2bttns and Next.js
Powered by GitBook
On this page
  • Create New Console
  • Database Migration & Seeding
  • Migrations
  • Seeding
  • Creating Admins
  • Interactive
  • Command Line
  • Configuration Values

Was this helpful?

  1. References
  2. Command Line Interface (CLI)

Usage

How to create a new console, handle seeding, migrations, create admin users, and configure environment variables from any terminal.

Create New Console

With the CLI installed, you can now create a new console. Follow the steps to configure your Console with your DATABASE_URL. In your terminal, execute:

Make sure Docker is running!🐳

2bttns-cli new

Behind the scenes, this will:

  • create a docker-compose.yml file in the current directory.

  • launch your Console,

  • apply migrations to your specified database,

  • seed the database with examples (optional)

Database Migration & Seeding

Migrations

Migrate a specified database or the one set in your configuration.

2bttns-cli db migrate -d <database-url> # pass database-url if not already set

Seeding

Seed a specified database.

IMPORTANT: Ensure the database is migrated before seeding.

2bttns-cli db seed -d <database-url> # pass database-url if not already set

Creating Admins

Interactive

Create an admin interactively (recommended):

2bttns-cli admin create -d <database-url> -s <nextauth-secret>

Command Line

Create an admin using command line arguments:

## Using credentials:

2bttns-cli admin create credentials -u <username> -p <password> -d <database-url> -s <nextauth-secret>
## Using OAuth:

2bttns-cli admin create oauth-allow -e <email> -d <database-url> -s <nextauth-secret>

Configuration Values

Configuration Key
Description

DATABASE_URL

The URL of the Postgres database to connect to.

NEXTAUTH_SECRET

The secret used by NextAuth.

NEXTAUTH_URL

The URL of the 2bttns app.

GITHUB_ID

The GitHub OAuth app ID, if you want to allow admin users to sign in via GitHub.

GITHUB_SECRET

The GitHub OAuth app secret that corresponds to your GITHUB_ID.

SERVER_LOG_LEVEL

The log level for the server.

SERVER_LOG_LOCALE

The log locale for the server.


PreviousInstallNextConfiguration

Was this helpful?