Setting up your development environment

In order to get moving with Instant Answer development, you'll need to setup your environment. There are three main steps:

  1. Fork the appropriate repository on Github.com

  2. Set Up the Development Environment

  3. Clone Your Github Fork into the Development Environment

1. Fork the appropriate repository on Github.com

1a. Sign Up for Github.com

Already have a GitHub Account? Perfect, move to the next step.

Git is a tool that allows many people to collaborate on one codebase. GitHub is a popular site for groups to host Git repositories. If this is your first time using Git and GitHub, we've created an overview of how you'll use Git to contribute to DuckDuckHack.

To get started, let's sign up for GitHub:

  1. Go to https://github.com/join and enter the required information, then click "Create an Account"

  2. Click "Finish Signup" to continue with a Free GitHub account.

1b. Create a Fork

Let's obtain the latest copy of the open-source code powering all Instant Answers. We're going to "fork" that code, so you'll have your own personal copy which you can modify and test without affecting the original.

The two most common repositories are Goodies and Spice. If you're not sure what type to pick, here's a guide on the differences.

  1. Make sure you are logged in to Github.com as yourself

  2. Go to the corresponding Instant Answer repository homepage:

    • Spice (for Instant Answers that will make external API calls)

    • Goodies (for Cheat Sheets, and Instant Answers that don't make external API calls)

    • Fathead (for Instant Answers that use a key-value store)

    • Longtail (for Instant Answers that will perform full-text search)

  3. Click "Fork", near the top-right corner.

    Wait while the repo forks...

  4. You should see a page that looks nearly identical to the repo home page you were just on. The URL should be different though, it should look like https://github.com/yourGitHubUsername/zeroclickinfo-xxxxx.

    This is the URL for your personal fork of the DuckDuckHack code. Keep it handy, we'll be using it in a minute!

2. Set Up the Development Environment

NOTICE: DuckDuckHack is in maintenance mode. The DuckPAN development setup is not guaranteed to continue working during this time. Also, the previous Codio.com Development Environment has been removed and is no longer available.

Please see the documentation for alternate development environments if needed.

3. Clone Your Github Fork into the Development Environment

Now we'll put it all together - we'll bring the code we forked on Github onto the environment we set up. This is called cloning a repository.

3b. Clone the Code

  1. Open your Terminal.

  2. Type git clone <Your GitHub URL Here>.git into the Terminal, replacing <Your GitHub URL Here> accordingly. It should look something like this for a Goodie:

    $ git clone https://github.com/githubusername/zeroclickinfo-goodies.git

    Enter your Github credentials as prompted.

    If your Github password doesn't work, you may need to enter a Personal Access Token as your password instead. Simply copy and paste your token from your Github Settings when prompted for your password. (This happens if you have set up Github's Two-Factor Authentication feature.)

  3. Press "Enter". You should see the Terminal print out some text that looks like this:

    $ git clone https://github.com/githubusername/zeroclickinfo-goodies.git
    Cloning into 'zeroclickinfo-goodies'...
    remote: Counting objects: 18623, done.
    remote: Compressing objects: 100% (8083/8083), done.
    remote: Total 18623 (delta 8084), reused 18179 (delta 7868)
    Receiving objects: 100% (18623/18623), 5.50 MiB | 9.51 MiB/s, done.
    Resolving deltas: 100% (8084/8084), done.
    Checking connectivity... done.
  4. Change into the current directory of the terminal by typing cd zeroclickinfo-xxxxx, where "xxxxx" is whichever Instant Answer type you chose.

  5. To start working on a new change, create a new branch in your repository for this particular project. Make sure to work on a separate branch for each contribution.

    Create a new branch by typing git checkout -b branch_name. You can use any branch name you like. You can switch between branches by using git checkout branch_name.

Congrats! You've now cloned the DuckDuckHack code into your development environment. You're now prepared to code your first Instant Answer. Start hacking with one of our walkthroughs.

If this is your first time using Git and GitHub, we've created an overview of how you'll use Git to contribute to DuckDuckHack.

Get in Touch

Want help? Need to think out loud? There are several ways to get in touch with staff, leaders, and community members. We look forward to hearing from you!

P.S. Let us know if we can improve anything in these documents by opening issues directly on Github.