Skip to main content

A Relay-based web development kit on Flask

Project description

Relask Documentation Status Dependencies

A Relay-based web development kit on Flask.


  • Fast web development setup with ES6, React and Relay

  • Batteries included: React Router, Webpack and Babel

  • Server is powered by Python, Flask and Graphene

  • JWT integrated, with a working example using Flask-Login


  1. Install Relask:

pip install git+
  1. Create a Flask application, for example:

  2. Initialize your Flask application with Relask (this requires npm):

FLASK_APP=xxx flask init-relask
  1. Under the root path of your Flask application, create scripts/app.js with something like this:

import React from "react";
import ReactDOM from "react-dom";
import {Route, IndexRoute} from "react-router";
import Relay from "react-relay";
import {Relask, RelayContainer} from "babel-loader!relask";

class Hello extends React.Component {
    render() {
        return (
            <div>Hello, {}!</div>

    static relay = {
        fragments: {
            hello: () => Relay.QL`fragment on Hello { name }`

        <Route path="/" component={Hello} queries={{
            hello: () => Relay.QL`query { hello }`
), document.getElementById('app'));
  1. Initialize the Relask extension with something like this:

import graphene
from flask import Flask
from graphene import relay
from relask import Relask

class Hello(relay.Node):
    name = graphene.String()

    def resolve_name(self, args, info):
        return 'World'

    def get_node(cls, id, info):
        return Hello(id=id)

class Query(graphene.ObjectType):
    node = relay.NodeField()
    hello = graphene.Field(Hello)

    def resolve_hello(self, args, info):
        return Hello.get_node(1, None)

app = Flask(__name__)
relask = Relask(app)
relask.schema.query = Query
  1. See your result with one command - don’t worry about webpack any more:

FLASK_APP=xxx flask run


This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.1.0 (2016-06-07)

  • First release on PyPI.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

relask-0.1.0.tar.gz (17.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page