Replit supports multiple programming languages in a single project through its Nix-based environment. Add language runtimes like Python, Node.js, Go, or Rust to your replit.nix file, configure run commands in the .replit file to execute different entry points, and use language server support for syntax highlighting and autocompletion across all configured languages. This approach lets you build polyglot projects such as a Python backend with a Node.js frontend in one workspace.
Run Multiple Programming Languages in a Single Replit Project
Replit uses Nix under the hood to manage system-level packages, which means you can install any combination of language runtimes in one project. This tutorial shows you how to configure a polyglot workspace where Python and Node.js (or any other combination) coexist, each with its own package manager, language server, and run command. This is ideal for projects that have a Python backend API and a JavaScript frontend, or that use shell scripts alongside a compiled language.
Prerequisites
- A Replit account (any plan)
- A Repl created from any template or blank project
- Basic understanding of at least two programming languages
- Familiarity with the Replit Shell (accessible from Tools dock)
Step-by-step guide
Show hidden configuration files
Show hidden configuration files
Replit hides its configuration files by default. To edit them, click the three-dot menu at the top of the file tree panel on the left and select Show hidden files. This reveals the .replit and replit.nix files in your project root. These two files control your entire environment: .replit defines how your project runs, and replit.nix defines what system packages are available. You will edit both to set up multi-language support.
Expected result: The .replit and replit.nix files appear in your file tree.
Add multiple language runtimes to replit.nix
Add multiple language runtimes to replit.nix
Open the replit.nix file and add the language packages you need to the deps array. Each package follows the pkgs.packageName format. Search for exact package names at search.nixos.org/packages. For example, to use both Python 3.11 and Node.js 20 with TypeScript support, add both runtimes and their associated language servers. After saving the file, run exit in the Shell to restart the environment and load the new packages.
1{ pkgs }: {2 deps = [3 pkgs.nodejs-20_x4 pkgs.python3115 pkgs.nodePackages.typescript-language-server6 pkgs.python311Packages.python-lsp-server7 pkgs.go_1_218 ];9}Expected result: Running node --version, python3 --version, and go version in Shell all return valid version numbers.
Configure the .replit file for your primary language
Configure the .replit file for your primary language
Open the .replit file and set the entrypoint and run command for your primary language. The entrypoint tells the editor which file to open by default, and the run command defines what happens when you click the Run button. If your main application is a Python backend, point run to your Python entry file. You can change this later or run secondary languages from the Shell.
1entrypoint = "main.py"2run = ["python3", "main.py"]34[nix]5channel = "stable-24_05"67[[ports]]8localPort = 30009externalPort = 80Expected result: Clicking the Run button executes your Python entry point and output appears in the Console.
Run multiple language processes simultaneously
Run multiple language processes simultaneously
To run a Python backend and a Node.js frontend at the same time, use the ampersand operator in your run command to launch both as background processes. The wait command at the end keeps the parent process alive so both services stay running. Alternatively, open two Shell instances from the Tools dock and run each process in its own Shell tab for better log separation.
1# In .replit file, run both processes:2run = "python3 api/server.py & cd frontend && npm start & wait"34# Or run them in separate Shell tabs:5# Shell 1: python3 api/server.py6# Shell 2: cd frontend && npm startExpected result: Both the Python API and the Node.js frontend start and serve on their respective ports.
Install packages for each language
Install packages for each language
Open the Shell and install packages for each language using its native package manager. Use pip install for Python, npm install for Node.js, and go mod tidy for Go. Each package manager stores dependencies in its own standard location: requirements.txt or pyproject.toml for Python, package.json for Node.js, and go.mod for Go. This keeps dependencies isolated by language even within the same project directory.
1# Python dependencies2pip install flask requests3pip freeze > requirements.txt45# Node.js dependencies6cd frontend7npm install express react8cd ..910# Go dependencies11cd services12go mod init myapp/services13go get github.com/gin-gonic/gin14cd ..Expected result: All packages install without errors and appear in their respective dependency files.
Organize your project structure for multiple languages
Organize your project structure for multiple languages
Create a clear directory structure that separates each language's code. A common pattern is to have top-level folders for each service or language: api/ for your Python backend, frontend/ for your Node.js app, and scripts/ for any shell or utility scripts. Place shared configuration at the root. This structure makes it obvious which language each component uses and prevents package manager conflicts.
1# Recommended project structure:2# .3# ├── .replit (run configuration)4# ├── replit.nix (system packages)5# ├── api/6# │ ├── server.py7# │ ├── requirements.txt8# │ └── routes/9# ├── frontend/10# │ ├── package.json11# │ ├── src/12# │ └── public/13# └── scripts/14# └── seed_db.shExpected result: Your project has a clean separation between language-specific directories with shared config at the root.
Complete working example
1# replit.nix — Multi-language environment configuration2# This file installs system-level packages for Python, Node.js, and Go3# Search for packages at: https://search.nixos.org/packages45{ pkgs }: {6 deps = [7 # Python 3.11 runtime and language server8 pkgs.python3119 pkgs.python311Packages.pip10 pkgs.python311Packages.python-lsp-server1112 # Node.js 20 runtime and TypeScript support13 pkgs.nodejs-20_x14 pkgs.nodePackages.typescript15 pkgs.nodePackages.typescript-language-server1617 # Go 1.21 runtime18 pkgs.go_1_2119 pkgs.gopls2021 # Common utilities22 pkgs.curl23 pkgs.jq24 pkgs.htop25 ];26}2728# After editing this file:29# 1. Save the file30# 2. Open Shell from the Tools dock31# 3. Type 'exit' and press Enter32# 4. Reopen Shell — the new packages will be available33#34# Verify installation:35# python3 --version36# node --version37# go version38#39# .replit run command for multi-process:40# run = "python3 api/server.py & cd frontend && npm start & wait"Common mistakes when using multiple languages in Replit
Why it's a problem: Forgetting to restart the Shell after editing replit.nix, then wondering why new packages are not available
How to avoid: Type exit in the Shell to terminate it, then reopen Shell from the Tools dock. The Nix environment only reloads on Shell restart.
Why it's a problem: Using wrong package names in replit.nix without the pkgs prefix or with incorrect version suffixes
How to avoid: Search for the exact package name at search.nixos.org/packages. Package names are case-sensitive and version-specific, such as pkgs.nodejs-20_x, not pkgs.node or pkgs.nodejs.
Why it's a problem: Running two servers on the same port, causing one to fail with an EADDRINUSE error
How to avoid: Assign each server a different port (e.g., Python on 5000, Node.js on 3000) and update the [[ports]] section in .replit to map the primary port to externalPort 80.
Why it's a problem: Installing Python packages globally instead of per-project, causing version conflicts between Repls
How to avoid: Use pip install --user or virtual environments within your project. Replit isolates each Repl's Nix environment but Python packages need explicit scoping.
Best practices
- Add language servers to replit.nix for each language to get syntax highlighting, autocompletion, and error checking in the editor
- Use separate directories for each language to prevent package manager conflicts and keep the project organized
- Pin dependency versions in lock files for every language to avoid inconsistent builds
- Run exit in Shell after editing replit.nix to reload the Nix environment with new packages
- Use the ampersand operator in the .replit run command to start multiple language processes simultaneously
- Search for exact Nix package names at search.nixos.org/packages before adding them to replit.nix
- Keep a README at the project root documenting which languages are used and how to run each component
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to set up a Replit project that uses Python for the backend API and Node.js with React for the frontend, both running in the same workspace. How do I configure replit.nix and .replit files to support both languages with proper language servers and simultaneous execution?
Set up my Repl to run a Flask API on port 5000 and a React frontend on port 3000 at the same time. Configure replit.nix with Python 3.11 and Node.js 20. The Run button should start both servers. Add language server support for Python and TypeScript.
Frequently asked questions
There is no hard limit. You can add as many language runtimes as you need through replit.nix. The practical limit is your storage quota, since each language runtime and its packages consume disk space. Most polyglot projects use two or three languages.
No. The Nix environment is available on all plans including the free Starter tier. However, free plans have limited storage (about 2 GiB) and RAM, which may constrain how many runtimes you can install and run simultaneously.
Yes. Add the language server package for each language to your replit.nix deps array. For example, add pkgs.nodePackages.typescript-language-server for TypeScript and pkgs.python311Packages.python-lsp-server for Python. The editor detects file extensions and activates the appropriate language server.
Open the Shell from the Tools dock and run the Python script directly with python3 yourfile.py. The Run button only executes the command defined in the .replit file, but the Shell gives you full access to all installed languages.
Adding runtimes to replit.nix increases initial environment setup time but does not significantly affect runtime performance. Running multiple servers simultaneously does consume more RAM and CPU. Monitor usage via the Resources panel and consider upgrading from the free tier if you hit limits.
Agent works best with its default stack of React, Tailwind, and ShadCN UI. You can prompt Agent to use multiple languages, but complex polyglot setups may require manual configuration of replit.nix and .replit files. Use Agent for individual components and configure the multi-language setup yourself.
Add secrets through Tools then Secrets in the workspace. All languages access the same environment variables: Python uses os.environ or os.getenv, Node.js uses process.env, and Go uses os.Getenv. Secrets are shared across the entire Repl regardless of language.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation