Skip to content
← Back to Community
How to code a .replit
Profile icon
[deleted]

Introduction

.replit files can probably be the toughest for developers that use Replit heavily. You mainly have to code them when you clone from GitHub. I can show how to make one from scratch. .replitthon is actually simpler than you might think!

So, what you need is a repl and this guide.

Choosing a language

Choosing a language can be weird. They use weird "Language IDs" like python3. Now, the IDs come from replit.com/languages/ links. I made this which generates a list of those IDs. Make sure to check which one that you want to use because for example python is Python 2. python3 is Python 3. Note that Replit will show the language after a reload, however. Now that you have got the ID, it's time to add it. First, make a file called ".replit". Then put this in the file:

language = "<PUT THE ID HERE AND DO NOT REMOVE THE QUOTES>"

Adding the run command

This is the last step. Say it's a Python 3 app and the main script is main.py. The command would be python3 main.py. Or a Lua script, lua main.lua. So, all we have to do is add this to our .replit and we're almost done!:

run = "<INTERPRETER> <FILE>"

A lot of the time, the interpreter is the ID and vice versa. Also, if you are using a language that does not have the file pane on the left, it's typically main.EXTENSION. You can look up the extension on Google, but except for Java. That uses Main.java.

Comments

If you for some reason need to add a comment in a .replit file, it's the exact same in Python. Just a hashtag and a space. So here is a comment:

# This just for a demo.

Finished

You should have a .replit file looking like this:

# Comment language = "python3" run = "python3 main.py"
Voters
Profile icon
ThunderQuest6
Profile icon
BizzareDay
Profile icon
programmertest2
Profile icon
Th3Coder
Comments
hotnewtop
Profile icon
DynamicSquid

This is a little inaccurate:

run = "<INTERPRETER> <FILE>"

What if it's a compiled language?

So more specifically, run takes in a bash command.

It should also be important to note that .replit changes the way the RUN button works. The bash command you give run is the command that is executed when you hit the RUN button

Profile icon
[deleted]

gcc main.c && ./a.out@DynamicSquid

Profile icon
Th3Coder

Awesome!

Also, you might want to fix python3 main.lua... Other than that, nice job! :)

Profile icon
[deleted]
Profile icon
Th3Coder

@GaneshaSharma cool! Nice tutorial btw!

Profile icon
[deleted]

BTW, I use Arch @Th3Coder

Profile icon
Th3Coder

@GaneshaSharma cool! (Even though I don't know what that is XD)

Profile icon
[deleted]

wut?

Profile icon
[deleted]
Profile icon
[deleted]
Profile icon
[deleted]

@GaneshaSharma UR A HACKER?!?!?

Profile icon
[deleted]

I don't hack, but I have the Hacker Plan. @2342343wed

Profile icon
[deleted]