Awesome
<p align="center"> <img alt="Lerna" src="https://raw.githubusercontent.com/christophercliff/flatmarket/master/packages/flatmarket-example/src/images/pineapple.png" width="360" /> </p> <h1 align="center">Flatmarket</h1> <p align="center"> <a href="https://circleci.com/gh/christophercliff/flatmarket"><img src="https://camo.githubusercontent.com/5843fae6a2c92bed031acbc78027a2b0d5f0061c/68747470733a2f2f636972636c6563692e636f6d2f67682f6368726973746f70686572636c6966662f666c61746d61726b65742e7376673f7374796c653d736869656c64" alt="Build Status" data-canonical-src="https://circleci.com/gh/christophercliff/flatmarket.svg?style=shield" style="max-width:100%;"></a> <a href="http://codecov.io/github/christophercliff/flatmarket?branch=master"><img src="https://camo.githubusercontent.com/ea3c9df6a64408856944933ba4a73f3ea680e47b/687474703a2f2f636f6465636f762e696f2f6769746875622f6368726973746f70686572636c6966662f666c61746d61726b65742f636f7665726167652e7376673f6272616e63683d6d6173746572" alt="codecov.io" data-canonical-src="http://codecov.io/github/christophercliff/flatmarket/coverage.svg?branch=master" style="max-width:100%;"></a> </p>Flatmarket is a free, open source e-commerce platform for static websites. It offers the performance, reliability, and simplicity of a static website combined with secure and scalable payment processing.
The platform uses Stripe for payment processing and it's built on the latest web technologies like hapi, React, and Webpack. The backend can be deployed automatically to AWS Lambda.
At its core is a batteries-included CLI to help you get started quickly. Modules are also packaged individually so you can customize your rig.
Features
- Automated deployment to AWS Lambda
- Customizable React UI (or use whatever frontend you prefer)
- Separate billing and shipping addresses
- Subscription billing
- Supports many global currencies
- Manual charge authorization
- Bitcoin
- Mobile-ready
- Email receipts
Demo
:point_right: christophercliff.com/flatmarket/
You can complete checkout using credit card number 4242 4242 4242 4242
. A test charge will be created in Stripe, so do not submit personal information.
How it works
Flatmarket is a static website generator paired with a proxy server for sending payments to Stripe. The static website content is generated from a public schema document. The proxy server reads from that document during checkout to prevent charge tampering. Once the proxy server is deployed, all content and configuration updates are made via the static website.
Creating a charge
- The web browser loads the static website from the static web server.
- The web browser obtains a token from Stripe via Stripe Checkout.
- The web browser submits the token and product ID to the Flatmarket service.
- The Flatmarket service reads the product price from the schema document on the static web server.
- The Flatmarket service submits the charge to Stripe.
Cost to Operate
This data is for the Flatmarket demo for the month of September, 2016.
Sales | |
---|---|
Gross volume | $2,586 |
Successful charges | 213 |
Operating costs | |
---|---|
Static website (GitHub Pages) | $0.00 |
Flatmarket service (AWS) | $0.82 |
DNS/SSL (CloudFlare) | $0.00 |
Total | $0.82 |
Documentation
- Installation
- Creating the schema
- Developing locally
- Deploying the proxy server
- Building & deploying the static website
- Using themes
Installation
Install the CLI:
npm install flatmarket-cli
Creating the schema
The schema is a JSON document that conforms to the flatmarket-schema spec. It contains information about individual products (e.g. description, price, images), Stripe configuration (e.g. currency, addresses) and any other data needed to render the static website. It looks like this. By convention, this document should be located at src/flatmarket.json
.
Developing locally
The Flatmarket CLI comes with a local development server so you can preview your website and create charges with your Stripe test keys. The following command will build your website and start a development server at https://127.0.0.1:8000/ (note the https).
./node_modules/.bin/flatmarket ./src/flatmarket.json \
--stripe-secret-key YOUR_TEST_SECRET_KEY \
--dev
An example project is included to help you get started.
Deploying the proxy server
Automated deployments
Platform | Deploy | |
---|---|---|
AWS | ![]() | Docs |
Manual deployments
Building & deploying the static website
When you're finished with development, generate a production-ready build of the static website.
./node_modules/.bin/flatmarket ./src/flatmarket.json
Then upload the files to your preferred web server.
Using themes
A theme is a container component that gets bound to the Redux store implemented by flatmarket-ui.
Themes are defined by a single React component but can contain multiple child components, CSS, fonts, and images. Flatmarket uses Webpack loaders to import non-JavaScript file types. The following loaders are supported by default:
To use a theme, run:
./node_modules/.bin/flatmarket ./src/flatmarket.json \
--component ./path/to/your-theme.jsx
Included Themes
Developers
Install dependencies:
npm install
make reset
Run tests:
make test
Run the example locally:
make example-dev
License
See LICENSE.