Skip to content
💪 Static sites with superpowers
JavaScript Dockerfile
Branch: master
Clone or download
alexwaibel Merge test fixes into master (#331)
Resolve all failing unit and acceptance tests. Modernize handlePR controller with newer JS features.
Latest commit 6f1f694 Feb 12, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
controllers Merge test fixes into master (#331) Feb 12, 2020
docs Update README Jul 3, 2017
lib Merge test fixes into master (#331) Feb 12, 2020
test Merge test fixes into master (#331) Feb 12, 2020
.dockerignore Docker config added. Oct 22, 2016
.env .env cleaned up Feb 27, 2017
.gitignore Fix GitHub auth, upgrade GitHub API module, allow test suite to execu… Dec 11, 2019
.travis.yml Bump up Travis CI NodeJS version Jul 22, 2018
CONTRIBUTING.md Add StandardJS Jul 3, 2017
Dockerfile Add `gitlab` package and bump minimum NodeJS version to 8.11.3 Jul 14, 2018
LICENSE.md Add license Feb 24, 2017
README.md Fix broken link to Hugo Nested Replies article (#297) Dec 13, 2019
app.json Fix GitHub auth, upgrade GitHub API module, allow test suite to execu… Dec 11, 2019
config.js Add new GitHub auth to v3 endpoint Jan 13, 2019
config.sample.json Hook initial GitLab service into Staticman class and fix failing conf… Jul 17, 2018
config.test.json Add new GitHub auth to v3 endpoint Jan 13, 2019
docker-compose.development.yml ReCAPTCHA enabler flag moved to SiteConfig Feb 25, 2017
docker-compose.yml coxker-compose.yml template updates Feb 27, 2017
index.js Merge test fixes into master (#331) Feb 12, 2020
logo.png Update logo image Aug 7, 2016
package-lock.json Fix GitHub auth, upgrade GitHub API module, allow test suite to execu… Dec 11, 2019
package.json Fix GitHub auth, upgrade GitHub API module, allow test suite to execu… Dec 11, 2019
server.js Merge test fixes into master (#331) Feb 12, 2020
siteConfig.js fix: config schema, deprecated GitHub API methods Dec 30, 2018
staticman.sample.yml Add missing newline Nov 13, 2017
staticman_key.pub Add public key Oct 21, 2016

README.md

Staticman coverage Build Status JavaScript Style Guide

Static sites with superpowers

Introduction

Staticman is a Node.js application that receives user-generated content and uploads it as data files to a GitHub repository. In practice, this allows you to have dynamic content (e.g. blog post comments) as part of a fully static website, as long as your site automatically deploys on every push to GitHub, as seen on GitHub Pages, Netlify and others.

It consists of a small web service that handles the POST requests from your forms, runs various forms of validation and manipulation defined by you and finally pushes them to your repository as data files. You can choose to enable moderation, which means files will be pushed to a separate branch and a pull request will be created for your approval, or disable it completely, meaning that files will be pushed to the main branch automatically.

You can download and run the Staticman API on your own infrastructure. The easiest way to get a personal Staticman API instance up and running is to use the free tier of Heroku. If deploying to Heroku you can simply click the button below.

Deploy

Requirements

  • Node.js 8.11.3+
  • npm
  • A personal access token for the GitHub account you want to run Staticman with
  • An SSH key (click here to learn how to create one)

Setting up the server

  • Clone the repository and install the dependencies via npm.

    git clone git@github.com:eduardoboucas/staticman.git
    cd staticman
    npm install
    
  • Create a development config file from the sample file.

    cp config.sample.json config.development.json
    
  • Edit the newly-created config file with your GitHub access token, SSH private key and the port to run the server. Click here for the list of available configuration parameters.

  • Start the server.

    npm start
    

Each environment, determined by the NODE_ENV environment variable, requires its own configuration file. When you're ready to push your Staticman API live, create a config.production.json file before deploying.

Check this guide if you're using Docker.

Setting up a repository

Staticman runs as a bot using a GitHub account, as opposed to accessing your account using the traditional OAuth flow. This means that you can give it access to just the repositories you're planning on using it on, instead of exposing all your repositories.

To add Staticman to a repository, you need to add the bot as a collaborator with write access to the repository and ask the bot to accept the invite by firing a GET request to this URL:

http://your-staticman-url/v2/connect/GITHUB-USERNAME/GITHUB-REPOSITORY

Site configuration

Staticman will look for a config file. For the deprecated v1 endpoints, this is a _config.yml with a staticman property inside; for v2 endpoints, Staticman looks for a staticman.yml file at the root of the repository.

For a list of available configuration parameters, please refer to the documentation page.

Development

Would you like to contribute to Staticman? That's great! Here's how:

  1. Read the contributing guidelines
  2. Pull the repository and start hacking
  3. Make sure tests are passing by running npm test
  4. Send a pull request and celebrate

Useful links

You can’t perform that action at this time.