#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)
Project ID: N/A
N/A
for this your project would contain a plugin for the postgre database, a service for the frontend, and another service for the backend
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?
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
is it recommended to split it into 3?
yes
I remember reading that railway auto injects variables? would i have to install dotenv for my front end or does railway have default variables
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
true. should i also hide the front ends http requests behind variables?
I don't understand the question
await fetch(http://localhost:5000/todos/${id}, {
method: 'DELETE',
});
would i want to hide the address in a variable?
you just use the railway domain there
ok, so thats safe? i mean i guess it has to be. but could i? if i wanted to keep the express server obfuscated?
you said you wanted to be as lazy as possible, and now you're trying to go and overcomplicate things
well if kant do one im going to do the other.
use the backend domain in your fetch requests, simple
would you happen to know if railway uses .env? or some fancy way of handeling the variables?
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
o neat.