Deploying with Railway in Strapi version >4.6.2 (4.10.5)

You’re welcome! You should keep the environment variable names the same on strapi, unless you want to change where those variables are declared in the two files you mentioned. At the end of the day, Strapi is looking at the value of those variables anyways. So copy the variable values from Railway and paste them into your environment variables on your .env file in Strapi.

I would test running strapi locally first to see if you can connect to the remote database. Once that’s working, you can then create a Strapi app on Railway.

You should be running Strapi with

NODE_ENV=production yarn start

on your local machine to test the connection with the remote DB.
I saw somewhere that you should have a separate file for the production environment called: .env.production
You should copy the existing stuff on your .env file there.
If you can provide some logs that would help too. I don’t want to suggest something wrong without seeing what’s really happening.