Skip to content
Branch: master
Find file History
Latest commit 181e457 May 28, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
prisma-client validate cli-app example Nov 28, 2018
prisma adjust datamodel to v1.1 Apr 15, 2019
Gopkg.lock validate cli-app example Nov 28, 2018
Gopkg.toml validate cli-app example Nov 28, 2018 update to v1.34 May 28, 2019
main.go validate cli-app example Nov 28, 2018

Simple TODO-App Example (CLI)

This example shows how to implement a TODO-app as a CLI tool with Golang and Prisma.

How to use

1. Download example & install dependencies

Clone the repository:

git clone

Ensure dependencies are available and up-to-date:

cd prisma-examples/go/cli-app
dep ensure -update

2. Install the Prisma CLI

To run the example, you need the Prisma CLI. Please install it via Homebrew or using another method:

brew install prisma
brew tap

3. Set up database & deploy Prisma datamodel

For this example, you'll use a free demo database (AWS Aurora) hosted in Prisma Cloud. To set up your database, run:

prisma deploy

Then, follow these steps in the interactive CLI wizard:

  1. Select Demo server
  2. Authenticate with Prisma Cloud in your browser (if necessary)
  3. Back in your terminal, confirm all suggested values
Alternative: Run Prisma locally via Docker
  1. Ensure you have Docker installed on your machine. If not, you can get it from here.
  2. Create docker-compose.yml for MySQL (see here for Postgres):
    version: '3'
        image: prismagraphql/prisma:1.34
        restart: always
        - "4466:4466"
          PRISMA_CONFIG: |
            port: 4466
                connector: mysql
                host: mysql
                port: 3306
                user: root
                password: prisma
                migrations: true
        image: mysql:5.7
        restart: always
          MYSQL_ROOT_PASSWORD: prisma
          - mysql:/var/lib/mysql
  3. Run docker-compose up -d
  4. Set the endpoint in prisma.yml to http://localhost:4466
  5. Run prisma deploy

You can now use Prisma Admin to view and edit your data by appending /_admin to your Prisma endpoint.

4. Use the CLI app

go run main.go

Add a Todo item

go run main.go create Groceries

List all Todo items

go run main.go list

Delete a Todo item

go run main.go delete Groceries

Next steps

You can’t perform that action at this time.