Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Remix app with Prisma and Postgres #260

Open
kubeworkz opened this issue Dec 23, 2022 · 3 comments
Open

Deploy Remix app with Prisma and Postgres #260

kubeworkz opened this issue Dec 23, 2022 · 3 comments
Labels
feature New feature

Comments

@kubeworkz
Copy link

kubeworkz commented Dec 23, 2022

Would it be possible to use Meli to deploy an application built with Remix using Prisma/Postgres on the backend? The backend would be hosted elsewhere (like Supabase or something). If so, we were wondering if you're available for some consulting.

@gempain
Copy link
Contributor

gempain commented Dec 23, 2022

Hi there 👋 This is a great question, thanks for brining it up.
When we wrote Meli, we went with Mongo because at the time that's what we were used to work with. To be honest, I have now adopted TypeORM for all my latest projects. I'm not against Prisma as I have heard it's becoming very popular, and is probably more actively maintained than TypeORM. I am also curious to try out this new ORM.
I don't have much time on my ends at the moment, but I would certainly like to stop the dependency on Mongo and start using Postgres as a default. Whether it be with Prisma (totally for it) or TypeORM (what I am used to) it could be the next major change in Meli.
Is this something you would be interested to get into ? My free time has been very limited for the past few months, reason why not many commits have seen daylight here, but I am eagerly seeking help from the community to start digging with me on this.

@gempain gempain added the feature New feature label Dec 23, 2022
@kubeworkz
Copy link
Author

Thanks for getting back. If you could give me a quick high level overview of what would be required to make the change, I can review it. I think this is something worth checking out.

@gempain
Copy link
Contributor

gempain commented Jan 8, 2023

The db directory contains the code used for initializing the db + setting up migrations. That's where TypeORM's code such as createDatasource and migrations handling will go. This directory also contains index definitions for Mongo entities, but with TypeORM these definitions are annotations defined on the entity class.

In the entities directory, you will find one directory per entity and that's where you'll find the model definitions. For example, in the releases contains a file named release.ts at its root, which creates the Mongo model as export const Releases = () => AppDb.db.collection<Release>('releases');. This Releases model is "Mongo ORM" object used everywhere else in the project to manage releases from the db (created, read, update, delete...). This is the equivalent of your TypeORM "entity".

Other than that, most of the work required will be to translate the existing Mongo models into TypeORM definitions. Then, you'll need to update the deployment files (docker-compose etc). There's also the docs to update and explain to people how you would convert your existing deployment to the Postgres one. We'll need to write a migration tool to copy the data from Mongo to Postgres.

This is a global overview, the best option is to navigate the code and try developing locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

No branches or pull requests

2 participants