Coder Social home page Coder Social logo

ncrmro / rjango Goto Github PK

View Code? Open in Web Editor NEW
73.0 8.0 12.0 1.33 MB

Django boilerplate with GraphQL, serving a Webpack compiled React Relay Modern frontend.

License: MIT License

Python 44.64% HTML 0.19% CSS 6.86% JavaScript 47.78% Dockerfile 0.53%
graphql react-boilerplate django relay react webpack heroku docker docker-deployment selenium

rjango's Introduction

reango

The Django + GraphQL Relay Modern backend.

Check out the react-native branch as well which can also compile to the web!

Looking to help with development and more up to date issue check the Gitlab hosted version of Reango.

Features

  • Relay Support
  • User Registration/Sign up using JWT
  • Postgres as a first class database, making use of Trigram Full Text Search Extension
  • Heroku or Docker Deployment

Quick start:

You will need python 3, postgres and node installed. You will also need to have a virtualenv activated before running npm install/yarn or the post install build step will fail as django needs to be available to dump the graphql_schema

source ~/.virtualenvs/reango/bin/activate
cp .env.sample .env
pip3 install -r ./lib/deps/dev.txt
yarn

Getting started

Define a django model, register the node and query with in the ./server/reango/schema.py

To work with the client side, add a route in the ./client/routes

Reusable components go in ./client/components, If you'd like you can split of django apps into there own folders in the ./client/modules like the django apps concept

Staging Data

Factories should be used to generate the staging data during tests as well and in the development environment.

A single django managment command should be available to get everything staged initial.

This command should be composed of smaller commands defined in each django app's management folder. This way you can delete a single users object and regenerate or generate multiple for each users.

python3 manage.py stagedata

Prod

See readme in ./lib/deployment

Front-End originally based on the awesome Relay Fullstack

https://github.com/lvarayut/relay-fullstack

rjango's People

Contributors

lukeaus avatar ncrmro avatar sourabhtk37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rjango's Issues

Dealing with Django's CSRF Implications and API Usage.

At the moment if you attempt to curl the graphql endpoint you will see a response indicating a missing CSRF issue.

curl -X POST -H "Content-Type: application/json" -d '{"query": "{ hello }"}' http://localhost:8000/graphql

<div id="summary">
  <h1>Forbidden <span>(403)</span></h1>
  <p>CSRF verification failed. Request aborted.</p>


  <p>You are seeing this message because this site requires a CSRF cookie when submitting forms. This cookie is required for security reasons, to ensure that your browser is not being hijacked by third parties.</p>
  <p>If you have configured your browser to disable cookies, please re-enable them, at least for this site, or for &#39;same-origin&#39; requests.</p>

</div>

This stackover flow post talks about the issue not being relevent to api usage, I'd like to use it if only for the sake of securing the admin section.

http://stackoverflow.com/questions/10741339/do-csrf-attacks-apply-to-apis

Update the setup documentation

I was getting error while setting up the project . Please , update about .env file in the readme and nodejs version in dependency file.

Get login flow tests

Check nav bar for logged in user and routes

Sign up should work and redirect
Sign out should work and redirect
Login shouldn't work with non existent account
Login should redirect

Authenticated Query to GraphQL endpoint

Mockup static data needed sent and received from the front end and devise a testing solution and the code.

See #11 for more details on the front end requirements for this issue.

Create JWT GraphQL authentication mechanism

User Auth

Posted to GraphQL endpoint to check if user is logged out and grab the viewer object.

If someone wouldn't mind further splitting these off into separate issues/branches that would be great.

This project can provide a url for grabbing auth token.
https://github.com/jpadilla/django-jwt-auth

AuthenticatedQuery

Happens when ever auth is required on a page or to load the viewer object and data

  • user ID,
  • username
  • token

Sign Up

  • username
  • email
  • password
  • password confirmation

Login

  • username or email
  • password

Log out

Viewer object

  • user account
  • todos

Standardized JWT Auth

Client
Should check token is valid, a method to request new tokens should be set up.

Server
A function that validates the graphql context and reads the jwt token in the headers.

It should then return the user.id in the jwt token payload if it's valid.

Password Reset

Should allow users to reset password

will need to test email

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.