Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
prisma
src
README.md
docker-compose.yml
package.json
tsconfig.json

README.md

PostgreSQL with Docker Example

This example shows how to set up Prisma using Docker and PostgreSQL locally on your machine. It then uses the Prisma client in a simple TypeScript script to read and write data in the database.

This example uses a new and empty database. Learn how to connect Prisma to your existing database here.

How to use

1. Download example & install dependencies

Clone the repository:

git clone git@github.com:prisma/prisma-examples.git

Install Node dependencies:

cd prisma-examples/typescript/docker-postgres
npm install

2. Launch Prisma with Docker

This example is based on Docker. If you don't have Docker installed, you can get it from here. Use the Docker Compose CLI to launch the Docker containers specified in docker-compose.yml:

docker-compose up -d

3. Install the Prisma CLI

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

npm install -g prisma

4. Set up database & deploy Prisma datamodel

To deploy the datamodel for this example, run the following command:

prisma deploy

5. Run the script

Execute the script with this command:

npm run start

Next steps

You can’t perform that action at this time.