I’m currently working on a project called Pharma Max, a pharmacy management web application built with Node.js and Express.
Here’s the development process I’m trying to set up:
I create the project on Replit (Node.js environment).
I connect it to GitHub for synchronization and version control.
Then, I clone the GitHub repository to my local machine and try to run it locally, connected to a Microsoft SQL Server database.
The main goal is not to run the app online on Replit, but rather to execute it locally on a workstation that acts as a local server, connected to a local SQL Server instance.
However, every time I try this approach, the SQL Server connection fails — even when the code is correctly cloned from GitHub. I’ve followed all the usual setup steps, but I can’t get the application to connect or run properly in this hybrid workflow (Replit → GitHub → Local).
So my question is:
Has anyone here successfully set up a similar workflow?
Is it even possible to use Replit to build a project designed to run locally with SQL Server?
If yes, could you please share your method or any reliable alternative approach?
Thanks a lot in advance to anyone who can shed some light on this
The short answer to your question is yes, it’s 100% possible to build any project with Replit and then run it locally. In this case it looks like not a code issue but some kind of communication issue. I would check if you’ve copied all your secrets over from Replit into a .env file (at the bottom of the secrets panel there’s an “Edit as .env” button which lets you copy everything as a .env file). The other thing to note is that Replit handles loading environment variables automatically, but when you run it locally it does not.
The easiest way to load environment variables in Node.js is to use the dotenv library, which you can install with npm install dotenv and then in your code at the top run require('dotenv').config();. This is probably the issue if you have login credentials etc. for your SQL server.
If this does not work (or you’ve already set your .env up) it could be a weirder issue with Microsoft trying to keep you secure by blocking the connection from your local computer. If this is the case, I would look at the documentation and see if Microsoft gives you a guide for whitelisting an IP or allowing a connection to the SQL server or something of the sort.