• Stars
    star
    2,413
  • Rank 19,067 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ’ช User-generated content for Git-powered websites

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 and/or GitLab 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 and/or GitLab, as seen on GitHub Pages, GitLab 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 and enter your config variables directly into Heroku as environment variables.

Deploy

Requirements

  • Node.js 8.11.3+
  • npm
  • A personal access token for the GitHub and/or GitLab account you want to run Staticman with
  • An RSA key in PEM format

Setting up the server on your own infrastructure

NOTE: The below steps are not required if deploying to Heroku. To deploy to Heroku, click the above deploy button and enter your configuration variables in the Heroku Dashboard.

  • Clone the repository and install the dependencies via npm.

    git clone [email protected]: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 and/or GitLab 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 and/or GitLab 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

More Repositories

1

include-media

๐Ÿ“ Simple, elegant and maintainable media queries in Sass
SCSS
2,571
star
2

static-api-generator

๐Ÿ”ง Generate a static JSON API from a tree of directories and files
JavaScript
146
star
3

compat-report

๐Ÿ”Œ A Developer Tools panel for flagging browser compatibility issues
JavaScript
117
star
4

buildtimes

โœ๏ธ Musings on building (and breaking) websites
JavaScript
88
star
5

popcorn

๐ŸŽฌ Demo of a Jekyll site using Staticman
HTML
85
star
6

include-media-export

๐Ÿ“ An include-media plugin for exporting breakpoints from Sass to JavaScript
JavaScript
72
star
7

inquirer-table-prompt

A table-like prompt for Inquirer
JavaScript
37
star
8

hugo-plus-staticman

โšก๏ธ Demo site using Hugo + Staticman
HTML
25
star
9

jekyll-social

Select what social media platforms to share your Jekyll blog posts on, right from the front matter.
21
star
10

jekyll-dynamic-menu

A Liquid snippet to generate markup for a dynamic navigation menu in Jekyll
HTML
19
star
11

postcss-cssential

๐Ÿšฉ PostCSS plugin to identify annotated blocks of critical CSS and inline them into a page
JavaScript
19
star
12

haiku

๐Ÿš€ Instant Heroku deploys from GitHub branches
JavaScript
16
star
13

include-media-columns

An include-media plugin for generating grid classes based on the BEMIT naming convention
CSS
16
star
14

gitemon

๐Ÿ‘พ Gotta Catch 'Em All!
JavaScript
16
star
15

wp-api-post-groups

A WP-API extension that allows multiple groups of posts with different filters to be obtained in a single request
PHP
15
star
16

eleventy-blog-staticman

A starter repository for a blog web site using the Eleventy static site generator and Staticman.
HTML
10
star
17

grunt-sass-import

A Grunt module for importing Sass partials with (some very basic) notion of source order
JavaScript
10
star
18

staticman-recaptcha

๐Ÿ‘ฎโ€โ™‚๏ธ Demo site using Staticman + reCAPTCHA
CSS
10
star
19

movies-api

๐ŸŽž Demo API using static-api-generator
JavaScript
9
star
20

homebridge-toggle-switch

Toggle switch for Homebridge
JavaScript
6
star
21

include-media-hidden-classes

๐Ÿ“ An include-media plugin to generate classes for hiding elements
CSS
6
star
22

notification-bus

๐ŸšŒ A Node.js library for loading and rendering notifications from a remote API
TypeScript
6
star
23

find-types

๐Ÿ” Find which of your module's dependencies have TypeScript types available
JavaScript
6
star
24

scheduled-netlify-deploys

Trigger Netlify deploys on a schedule
TypeScript
5
star
25

new-function

โœจ A tiny utility for creating a new Netlify Function.
JavaScript
4
star
26

staticman.net

๐Ÿ’ช Staticman website
SCSS
4
star
27

js-promise-queue

๐ŸŽข Runs JavaScript Promises in a queue
JavaScript
3
star
28

denis

A friendly DNS management bot for Slack
JavaScript
3
star
29

todo-api

๐Ÿ“‹ A RESTful API for a to-do list application built with DADI API
JavaScript
2
star
30

homebridge-arlo-basestation

Homebridge plugin for integrating Arlo with HomeKit
JavaScript
2
star
31

ok-to-test-action

2
star
32

next-netlify-starter-2

JavaScript
2
star
33

component-tree-webpack-plugin

A Webpack plugin for creating a simple tree of component dependencies
JavaScript
2
star
34

netlifind

Shell
2
star
35

codepen-scraper

JavaScript
1
star
36

next-netlify-starter

JavaScript
1
star
37

node-github-wrapper

JavaScript
1
star
38

mdn-speedtracker

JavaScript
1
star
39

preact-jsx-chai-match-template

๐Ÿ—œ A method that adds assertions with html-looks-like to Chai for testing Preact components
JavaScript
1
star
40

signally-case

1
star
41

jekyll-discuss-php

(UNMAINTAINED) A commenting system for Jekyll
PHP
1
star