Federal Source Code policy implementation.
Clone or download
DanielJDufour Merge pull request #698 from ftonato/feature-roadmap-background
Update roadmap cards to background white for best readability
Latest commit 6d74046 Oct 18, 2018
Failed to load latest commit information.
.circleci Fix circleci config format (#440) Feb 14, 2018
Dockerfiles added dockerfiles May 11, 2018
config Update config file to fix windows issue Oct 13, 2018
src Merge branch 'master' into feature-roadmap-background Oct 18, 2018
.codeinventory.yml adding .codeinventory.yml (#292) Aug 15, 2017
.dockerignore added some docker files but work is incomplete May 9, 2018
.editorconfig Initial Commit for Angular App Sep 30, 2016
.env new dashboard style Feb 17, 2017
.gitignore Added vscode launch folder Feb 13, 2018
.nvmrc Pb include source code policy #33 (#256) Jul 12, 2017
AngularClass License.txt Update LICENSE File Oct 13, 2016
CHANGELOG.md Ok schema200release (#293) Aug 9, 2017
CODE_OF_CONDUCT.md Add Code of Conduct Jan 3, 2018
CONTRIBUTING.md 665 - change link to local reference Oct 14, 2018
ISSUE_TEMPLATE.md Add issue and pull request templates. Jan 3, 2018
LICENSE.md integrated code-gov-font, which is basically a trimmed down font-awes… Apr 9, 2018
PULL_REQUEST_TEMPLATE.md Add issue and pull request templates. Jan 3, 2018
README.md Update README.md Sep 14, 2018
about.yml integrated code-gov-font, which is basically a trimmed down font-awes… Apr 9, 2018
dependency_licenses.json Update Dependency Licenses Nov 3, 2016
hound.yml Fix Issues with GitHub Deployment Oct 4, 2016
karma.conf.js Initial Commit for Angular App Sep 30, 2016
package-lock.json package bump Oct 16, 2018
package.json package bump Oct 16, 2018
protractor.conf.js Initial Commit for Angular App Sep 30, 2016
tsconfig.json Load a larger number of repositories and make changes to the site to … Sep 18, 2017
tslint.json fixed some tslint issues Aug 25, 2018
typedoc.json Initial Commit for Angular App Sep 30, 2016
typings.json Fix linting errors and upgrade dependencies. (#266) Jul 11, 2017
webpack.config.js updated so use API_URL env variable Feb 26, 2018
yarn.lock Added search box on home page and search results page. Aug 24, 2017


Code.gov - Unlocking the potential of the Federal Government’s software.

Build Status Code Climate Test Coverage


Code.gov is a website promoting good practices in code development, collaboration, and reuse across the U.S. Government. Code.gov will provide tools and guidance to help agencies implement the Federal Source Code Policy. It will include an inventory of the government's custom code to promote reuse between agencies and will provide tools to help government and the public collaborate on open source projects.

To learn more about the project, check out this blog post.

Code.gov is an open source project, so we invite your contributions, be it in the form of code, design, or ideas.


The development of code.gov is guided by the requirements set forth in Section 7.2 (Code Inventories and Discovery), Section 7.3 (Code.gov), and Section 7.6 (Agency Policy) of the Federal Source Code Policy. Namely:

  • "Within 90 days of the publication date of this policy, the Administration will launch https://www.code.gov, an online collection of tools, best practices, and schemas to help agencies implement this policy.";

  • "Within 90 days of the publication date of this policy, each agency’s CIO—in consultation with the agency’s CAO—shall develop an agency-wide policy that addresses the requirements of this [document.]"; and

  • "Within 120 days of the publication date of this policy, each agency must update—and thereafter keep up to date—its inventory of agency information resources to include an enterprise code inventory that lists custom-developed code for or by the agency after the publication of this policy."


For documentation on how to configure code-gov-web, go here.


Here’s how you can help contribute to code.gov:


If you have questions, please feel free to open an issue here: https://github.com/presidential-innovation-fellows/code-gov-web/issues or send us an email at [code@listserv.gsa.gov].

Getting Started

After you have cloned this repo, you can use npm install to install all of the project’s dependencies.

You can then run the server using npm start.

By default, the development server will listen on http://localhost:2700/. You can change the default port by setting the PORT environment variable before starting the server (for example, PORT=3000 npm start).


Unit tests

This app uses Karma + Jasmine to handle unit testing. Run npm test to execute tests. To add tests, simply create a file with .spec.ts as the extension and your tests will be included.

End-to-end tests

End-to-end testing is done with Protractor and tests are written in Jasmine with the Protractor API used to locate elements and interact with the page. Running e2e tests requires the following steps:

  • Run npm start to start the application.
  • In a second terminal window, run npm run webdriver:start to start the selenium server used to run the tests. This step must be done before the next step.
  • In a third terminal window, run npm run e2e. The Chrome browser will be launched to run the tests and the test results will be displayed in this window.

End-to-end tests need to be written in a file with an .e2e.ts extension.


This app uses the github-deploy package for handling deployment. To configure deployment, customize the config/github-deploy and webpack.github-deploy files to match your settings. When ready to deploy, run npm run federalist-deploy:dev or npm run federalist-deploy:prod, depending on your intended destination.

If you are deploying from a fork, you will have to set the GIT_REMOTE_NAME environmental variable, like GIT_REMOTE_NAME="upstream" npm run federalist-deploy.

Deploying Arbitrary Branch

If you'd like to deploy an arbitrary branch, set the GIT_BRANCH_NAME environmental variable. For example the following code will deploy the current branch to https://federalist-proxy.app.cloud.gov/preview/gsa/code-gov-web/federalist-demo/#/

GIT_BRANCH_NAME="federalist-demo" npm run federalist-deploy

Specifying API URL

The app uses the production API by default. To use the staging API, set an API_URL environmental variable for the npm process. Here's two examples:

API_URL=stag npm run start
API_URL=staging npm run start
API_URL='https://code-api-staging.app.cloud.gov/api/' npm run start
API_URL=staging GIT_REMOTE_NAME=upstream npm run federalist-deploy:dev

Specifying an API Key

The app uses the API key provided in the code-gov-config.json by default. If you want to override that, specify an CODE_GOV_API_KEY environmental variable. Here's an example:

CODE_GOV_API_KEY=l87sfdi7ybc2bic7bai8cb2i176c3b872tb3 npm run server

Deployment Problems

When pushing to staging or dev branches, you might run into an occasional error warning that the branch you're pushing to already exists. If you see this, you need to clear the cache in the gh-pages module using this command: rm -rf node_modules/gh-pages/.cache

Generating License Data

To update the dependency_licenses.json file, run npm run licenses.

File Structure

The directories in src/app are organized around the pillars of Angular, along with several additional custom file types. When creating new files, be sure to add your file and any necessary templates, styles, and tests to a directory dedicated to your new file in the appropriate place.

For the most part, components are organized based on the navigation structure of the app. For example, you can find Policy Guide content in src/app/components/policy-guide.

Component Structure

Most Components have a style, template, and component file. Template files are composed of HTML with Angular syntax for inserting content and view conditionals. Styles are encapsulated by default unless the Component has ViewEncapsulation disabled, so global class names are generally not an issue.

Style Guide

This app follows the official Angular Style Guide. Please ensure you follow the naming conventions defined in this guide.


We sometimes use the word entities. It basically means something that has repositories. Agencies are types of entities.


As stated in CONTRIBUTING:

[..] this project is in the worldwide public domain (in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication).

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.

This repo is built on top of the Angular2 Webpack Starter from Angular Class and includes the original [MIT License](/AngularClass License.txt). Should you choose to use this repo for your own purposes, be sure to retain the MIT license that comes with it.

For a detailed list of licenses from each of the node_modules, view the Dependency Licenses file.