This example shows the basics of Prisma Optimize in a Todo app. It uses a SQLite database file with some initial dummy data which you can find at ./prisma/dev.db
.
Download this example:
npx try-prisma@latest --template optimize/starter
Install npm dependencies:
cd starter
npm install
Alternative: Clone the entire repo
Clone this repository:
git clone [email protected]:prisma/prisma-examples.git --depth=1
Install npm dependencies:
cd prisma-examples/optimize/optimize_starter
npm install
Run npm run build
from project root to create your SQLite database.
Login and create an API key (also called a token) in the Optimize dashboard.
Navigate to packages/server
and add a .env
file that matches the .env.example
file.
cd packages/server
cp .env.example .env
Copy your API key (also called token) to the PRISMA_OPTIMIZE_TOKEN
.
PRISMA_OPTIMIZE_TOKEN="<your_token_here>"
- Got to recordings in the Optimize dashboard and click the "Start recording" button.
- Run
npm start
from the project root. - Open the demo app @ http://localhost:5173 in the browser. Perform a bunch of actions - add a Todo, mark a Todo as complete, delete a Todo, etc.
- Go back to the Optimize dashboard and click the "Stop recording" button.
- Enjoy some sweet queries, groups, and most importantly recommendations with our friendly AI chat.
- Check out the Prisma docs
- Share your feedback on the Prisma Discord
- Create issues and ask questions on GitHub