#Is it possible to deploy a postgresql db, vite react front end, with an express back end all in one?

23 messages · Page 1 of 1 (latest)

tepid marlin
#

Just wondering if Railway handles that somehow, or is that crazy nonsense. Other thought is DB service plus express server that serves the /dist folder of my front end

rugged veldtBOT
#

Project ID: N/A

tepid marlin
#

N/A

dreamy basin
#

for this your project would contain a plugin for the postgre database, a service for the frontend, and another service for the backend

tepid marlin
#

I'm trying to be as lazy as possible and do everything in a mono repo. Is this actually not lazy and requires more work?

dreamy basin
#

your frontend and backend can absolutely be in a monorepo, that would still require two services though, for the database, you have to use one of railways provided databases, you can't spin up your own because there's no persistent storage

#

the backend serving the frontend is not recommended

tepid marlin
#

is it recommended to split it into 3?

dreamy basin
#

yes

tepid marlin
#

I remember reading that railway auto injects variables? would i have to install dotenv for my front end or does railway have default variables

dreamy basin
#

variables for your database are exposed to your app once you setup the variable references, you should not be storing any production secrets in .env files

tepid marlin
#

true. should i also hide the front ends http requests behind variables?

dreamy basin
#

I don't understand the question

tepid marlin
#

await fetch(http://localhost:5000/todos/${id}, {
method: 'DELETE',
});

#

would i want to hide the address in a variable?

dreamy basin
#

you just use the railway domain there

tepid marlin
#

ok, so thats safe? i mean i guess it has to be. but could i? if i wanted to keep the express server obfuscated?

dreamy basin
#

you said you wanted to be as lazy as possible, and now you're trying to go and overcomplicate things

tepid marlin
#

well if kant do one im going to do the other.

dreamy basin
#

use the backend domain in your fetch requests, simple

tepid marlin
#

would you happen to know if railway uses .env? or some fancy way of handeling the variables?

dreamy basin
#

variables set in the service are injected into the apps environment, for node you would access them with process.env.ENV_NAME no need for an .env loader

tepid marlin
#

o neat.