export const meta = { title: "Using the Prisma CLI", position: 50, }
The Prisma command line interface (CLI) is the primary tool to deploy and manage your Prisma services.
The Prisma CLI helps you in areas such as:
- Bootstraping service configuration files for new services
- Deploying services to Prisma servers
- Generating authentication tokens
- Seeding, importing and exporting data
- ...and more
To get detailled information about all CLI commands, read the command reference.
The Prisma CLI can be installed from the NPM registry.
npm install -g prisma
yarn global add prisma
$ prisma
GraphQL Database Gateway (https://www.prisma.io)
Usage: prisma COMMAND
Service:
init Initialize a new service
deploy Deploy service changes (or new service)
introspect Introspect database schema(s) of service
info Display service information (endpoints, cluster, ...)
token Create a new service token
list List all deployed services
delete Delete an existing service
Data workflows:
playground Open service endpoints in GraphQL Playground
seed Seed a service with data specified in the prisma.yml
import Import data into a service
export Export service data to local file
reset Reset the stage data
Cloud:
login Login or signup to the Prisma Cloud
logout Logout from Prisma Cloud
console Open Prisma Console in browser
account Display account information
Use prisma help [command] for more information about a command.
Docs can be found here: https://bit.ly/prisma-cli-commands
Examples:
- Initialize files for a new Prisma service
$ prisma init
- Deploy service changes (or new service)
$ prisma deploy
Once installed, execute the following commands to get your Prisma API up-and-running and start sending queries and mutations to it:
prisma init hello-world
# Select a *demo server* from the interactive prompt
cd hello-world
prisma deploy
prisma playground
You can now start sending queries and mutations to your Prisma API. For a more comprehensive walkthrough, check out the Get Started section.
The Prisma CLI integrates with graphql-config
. If your project uses a .graphqlconfig
-file, you can use the prisma
extension and point it to your prisma.yml:
projects:
prisma:
schemaPath: prisma.graphql
extensions:
prisma: prisma.yml
The Prisma CLI supports custom HTTP proxies. This is particularly relevant when being behind a corporate firewall.
To activate the proxy, provide the environment variables HTTP_PROXY
and HTTPS_PROXY
. The behavior is very similar to how the npm
CLI handles this.
The following environment variables can be provided:
HTTP_PROXY
orhttp_proxy
: Proxy URL for http traffic, for examplehttp://localhost:8080
HTTPS_PROXY
orhttps_proxy
: Proxy URL for https traffic, for examplehttps://localhost:8080
NO_PROXY
orno_proxy
: To disable the proxying for certain URLs, please provide a glob forNO_PROXY
, for example*
.
To get a simple local proxy, you can use the proxy
module:
npm install -g proxy
DEBUG="*" proxy -p 8080
HTTP_PROXY=http://localhost:8080 HTTPS_PROXY=https://localhost:8080 prisma deploy