Coder Social home page Coder Social logo

danielfgray / razzle-graphile Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 1.41 MB

a typescript+react boilerplate that generates a graphql api and types from postgres tables with user session auth

JavaScript 13.74% PLpgSQL 33.35% CSS 1.41% TypeScript 51.50%
postgresql typescript react postgraphile graphql session-management hacktoberfest

razzle-graphile's Introduction

razzle-graphile

a typescript+react boilerplate that generates a graphql api and types from postgres tables, and includes user session auth

getting started

make sure you have yarn, docker and docker-compose installed

yarn
yarn setup

npm will probably work instead of yarn but it's not tested by the author

the setup script will generate an .env file if it doesnt exist, launch a postgres container via docker-compose, run migrations, and then call yarn start

when you're finished, you can yarn db:stop (an alias for docker-compose stop) to preserve your data, or yarn db:down will purge the docker volume and your data

differences from graphile/starter

  • less opinionated UI
    • only provides the bare minimum UI code to make it easy to bring your own designs
  • razzle instead of Next.js
    • allows quicker page rebuilds during development (at the cost of slower startup)
    • react-router and react-helmet-async are used for routing and <head> metadata

roadmap

i'm aiming to achieve feature parity with graphile/starter but there's still a lot to do, including:

  • basic UI elements
  • tests
  • deployment strategies

check the issues if you're interested in helping!

credits

most of this is stolen borrowed from graphile/starter, ive just tried to make it work with razzle and apollo v3

razzle-graphile's People

Contributors

danielfgray avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

razzle-graphile's Issues

How can we manage session in the postgraphile app?

Hi, I'm new to the Postgraphile and I've just started looking at this project to know about how the session is managed in this postgraphile app. I saw there are 2 tables being used for a session management in here, 1. connect_pg_simple_sessions 2. sessions. And I've seen that the sessions table gets updated in every valid graphql request made to the database which keeps track of user that made request and his/her last active time. Also it has been used to track user login while login request is made through login function in the database where on successful login a new record is inserted into this table. But the connect_pg_simple_sessions table has just been used or initialized at the time of middleware setup on the server. So I was wondering as if we're using the sessions table to track user logins and every graphql request made by user then what is the use of connect_pg_simple_sessions table within the app? How can we track user's session after their login like we normally do in normal express js app using any session library (i.e. like this conect pg simple for instance)? How can we send session inside a cookie to the user after user logs in in the postgraphile app?

broken csrf

the csurf middleware setup is throwing errors

needs minimum client ui

nothing fancy, ideally very few (hopefully 0) library dependencies
easy to throw away and replace

  • #4
  • #5
  • settings
    • change user profile
    • change password
    • delete account
    • change email
      • create email
      • verify email
      • make email primary
      • delete email
  • forgot/reset password

no tests

needs tests

React Testing Library is probably the obvious choice, along with something like Cypress (or Playwright)

could probably steal lift more from the graphile starter and adapt as necessary

Failed to start the app

@DanielFGray I'm getting this error:

/Users/sussol/Documents/Git/temp/razzle-graphile/src/lib/hooks.ts:1
import { useState } from 'react'
^

Cannot find module '@/generated'

> 1 | import { useState } from 'react'
  2 | import { useApolloClient } from '@apollo/client'
  3 | import { useHistory, useLocation } from 'react-router-dom'
  4 | import { useLogoutMutation } from '@/generated'

    at webpackMissingModule (/Users/sussol/Documents/Git/temp/razzle-graphile/src/lib/hooks.ts:1:1)
    at Module../src/lib/hooks.ts (/Users/sussol/Documents/Git/temp/razzle-graphile/build/webpack:/src/lib/hooks.ts:1:1)
    at __webpack_require__ (/Users/sussol/Documents/Git/temp/razzle-graphile/build/webpack:/webpack/bootstrap:748:1)
    at fn

after setting up the app by yarn setup. Also tried to run yarn start but throws the same error. I'm not sure where the @/generated file is located.

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.