This repository was previously used to power multiple language support for CodeCrafters challenges.
IMPORTANT: The content in this repository has since been migrated to challenge-specific repositories like this:
- codecrafters-io/build-your-own-redis
- codecrafters-io/build-your-own-docker
- codecrafters-io/build-your-own-git
- codecrafters-io/build-your-own-sqlite
- codecrafters-io/build-your-own-grep
New PRs must be sent to the above repositories. We're still updating docs around contributing support.
The language one uses for a CodeCrafters challenge is an integral part of the challenge experience. A few questions to think about:
- Is it easy to setup locally?
- Does the standard library have all required functions to complete the challenge?
- Are there any tricky areas where people are likely to get stuck?
We'll tackle these problems through a combination of:
- Sample code to get started
- Troubleshooting advice in the README
- Helpful language-specific hints in stages wherever applicable
For a language to be supported in a specific challenge, we need the following things in place:
- A Dockerfile, which'll be used to build the container where code is evaluated.
- A starter repo, like this one.
You'll need one Dockerfile per language version supported. These'll be placed under the
dockerfiles/<course>
folder.
The Dockerfile needs to setup the language + all required dependencies, and make
the tester
executable available at /bin/tester
.
Wherever possible, utilize Docker's build cache.
The starter repo needs to contains the following files:
codecrafters.yml
README.md
- An executable script / entry point, based on the challenge.
your_docker.sh
for Docker,your_git.sh
for Git etc. - An
app
folder, that contains boilerplate code that the user will build upon. This code must also include a section that can be commented out to pass the first stage.
Any language-specific code must adhere to common conventions or style guides for that language.
Since starter repos for different languages are likely to have a lot of similar
code, we use templates to create these. The raw files are under
starter_templates
, the compiled versions are under compiled_starters
.
Slow build times drastically affect the codecrafters challenge experience. Building an image for a language and executing the starter should be snappy - ideally under 1 second.
To achieve this, we use Docker's build caching.
The experience of downloading a repository, running it locally, receiving results via a git push etc. can be pretty daunting to a new user who isn't used to how CodeCrafters works.
We make this easier by adding a concise step-by-step README, and also including all code needed to pass the first stage.
Thank you for considering contributing to this project!
Here's a detailed guide on Adding support for a new language. If you need help, feel free to ask in the Discord server.