W
Wasp7mo ago
Arnab

Prisma Studio for a deployed app

Hi how do I access the Prisma user management in a deployed app? I'd specifically like to see which files a user has uploaded
4 Replies
kapa.ai
kapa.ai7mo ago
Hi @Arnab. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To interact with the database of a deployed app using Prisma Studio, you can follow these steps: 1. Set the DATABASE_URL environment variable to your production database URL. You can do this in your main.wasp file or in your terminal. 2. Open a tunnel to your production database. For example, if you're using Fly, you can use the command fly proxy 5432 -a <db-name>. 3. Run wasp db studio or npx prisma studio --schema=./.wasp/out/db/schema.prisma in your terminal. Please note that you should be careful when interacting with your production database to avoid accidentally making unwanted changes. It's recommended to remove the DATABASE_URL with the production database URL from .env.server after you're done. For more information, you can refer to this support thread (https://discord.com/channels/686873244791210014/1220423321422663820) and this Github issue (https://github.com/wasp-lang/wasp/issues/1464). Regarding viewing which files a user has uploaded, this would depend on how your application is structured. If information about uploaded files is stored in your database, you should be able to view it using Prisma Studio. If not, you might need to implement additional functionality in your app to track and display this information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Arnab, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Arnab
ArnabOP7mo ago
@miho are there docs to use Prisma Studio? I'm uploading to a s3 bucket. I need a way to correlate and track which user is uploading files, so I can response with a (staged) image. So far I setup an email notification from AWS when there is a new uploaded image. Is there a better way more simple way to do this?
martinsos
martinsos7mo ago
@Arnab , Kapa provided a good answer here! That GH issue indeed describes how to connect to the remove DB wth Prisma Studio. As for Prisma Studio docs -> none on our side, but you can check Prisma's docs!
martinsos
martinsos7mo ago
Regarding s3 bucket: I am not quite sure I got it, what do you mean with correlating and tracking which user is uploading files so you can respond with a staged image? Specifically, what do you mean by staged image? Typical way would be to put all the images from all users into a single, private bucket, and a way to know who uploaded what is by saving it into database. You could have UploadedFile entity that has user id and identiifer of the image on S3, so you know that user "owns" that image on S3. Then, when you are handling user's upload to S3 bucket for them (and you should, using presigned urls), you will also be creating that UploadedFile entity in your database. Open Saas actually comes with implementation of this already and docs for it, check it out here: https://docs.opensaas.sh/guides/file-uploading/ Even if you are not using Open Saas currently, you can create a new app with it in order to get the file upload code and mostly just copy it over to your app.
OpenSaaS.sh
File Uploading
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
Want results from more Discord servers?
Add your server