Skip to main content
RapidDev - Software Development Agency
replit-tutorial

How to use multiple languages in Replit

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.

What you'll learn

  • Add multiple language runtimes to replit.nix
  • Configure the .replit file to run different languages
  • Set up language server support for code intelligence across languages
  • Run multiple processes simultaneously in one Repl
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner8 min read15 minutesAll Replit plans (Starter, Core, Pro, Enterprise)March 2026RapidDev Engineering Team
TL;DR

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

1

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.

2

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.

typescript
1{ pkgs }: {
2 deps = [
3 pkgs.nodejs-20_x
4 pkgs.python311
5 pkgs.nodePackages.typescript-language-server
6 pkgs.python311Packages.python-lsp-server
7 pkgs.go_1_21
8 ];
9}

Expected result: Running node --version, python3 --version, and go version in Shell all return valid version numbers.

3

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.

typescript
1entrypoint = "main.py"
2run = ["python3", "main.py"]
3
4[nix]
5channel = "stable-24_05"
6
7[[ports]]
8localPort = 3000
9externalPort = 80

Expected result: Clicking the Run button executes your Python entry point and output appears in the Console.

4

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.

typescript
1# In .replit file, run both processes:
2run = "python3 api/server.py & cd frontend && npm start & wait"
3
4# Or run them in separate Shell tabs:
5# Shell 1: python3 api/server.py
6# Shell 2: cd frontend && npm start

Expected result: Both the Python API and the Node.js frontend start and serve on their respective ports.

5

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.

typescript
1# Python dependencies
2pip install flask requests
3pip freeze > requirements.txt
4
5# Node.js dependencies
6cd frontend
7npm install express react
8cd ..
9
10# Go dependencies
11cd services
12go mod init myapp/services
13go get github.com/gin-gonic/gin
14cd ..

Expected result: All packages install without errors and appear in their respective dependency files.

6

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.

typescript
1# Recommended project structure:
2# .
3# .replit (run configuration)
4# replit.nix (system packages)
5# api/
6# server.py
7# requirements.txt
8# routes/
9# frontend/
10# package.json
11# src/
12# public/
13# scripts/
14# seed_db.sh

Expected result: Your project has a clean separation between language-specific directories with shared config at the root.

Complete working example

replit.nix
1# replit.nix Multi-language environment configuration
2# This file installs system-level packages for Python, Node.js, and Go
3# Search for packages at: https://search.nixos.org/packages
4
5{ pkgs }: {
6 deps = [
7 # Python 3.11 runtime and language server
8 pkgs.python311
9 pkgs.python311Packages.pip
10 pkgs.python311Packages.python-lsp-server
11
12 # Node.js 20 runtime and TypeScript support
13 pkgs.nodejs-20_x
14 pkgs.nodePackages.typescript
15 pkgs.nodePackages.typescript-language-server
16
17 # Go 1.21 runtime
18 pkgs.go_1_21
19 pkgs.gopls
20
21 # Common utilities
22 pkgs.curl
23 pkgs.jq
24 pkgs.htop
25 ];
26}
27
28# After editing this file:
29# 1. Save the file
30# 2. Open Shell from the Tools dock
31# 3. Type 'exit' and press Enter
32# 4. Reopen Shell the new packages will be available
33#
34# Verify installation:
35# python3 --version
36# node --version
37# go version
38#
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.

ChatGPT Prompt

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?

Replit Prompt

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.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.