Code Monkey home page Code Monkey logo

postgres-graphql's Introduction

Full-stack web app with PostGraphile and React

This repo is for reference to blog post: Building Full-stack web app with PostGraphile and React

Here's the details about technologies we will be using to build our architecture.

  • Database: PostgreSQL
  • Server: Node, ExpressJS and PostGraphile
  • Client: React+TypeScript, GraphQL, Apollo-Client
  • Schema handling: Knex Migrations.

Server

Install postgreSQL and update configuration under following file .env

Edit and save sample.env as .env and update config as per your requirements.

Run the following command in server to install requied packages:

npm install

For schema migrations:

Here is the folder structure for that:

  • Server
    • db
      • migrations
      • seeds

To update your tables as per schema migrations files run the following command:

npx knex migrate:latest

To update your table with static data/seeds run the following command:

npx knex seed:run

Note: Make sure you migrations scripts to build your schema on fresh repo clone, and then proceed to start your server.

Run Server:

To get our server running run any of the following command:

  • yarn start or npm run start : Start our server.
  • yarn watch or npm run watch : Watch mode for server.

Hit following URL http://localhost:8080/graphql to see generated graphql by postgraphile

Client

GraphQL codegen:

To generate graphql querries and mutations hooks based run the following command:

yarn codegen

To have hook based queries and mutations, add them to respected folders and run codegen command as mentioned above.

Here's the folder structute for queries and mutations.

  • src
    • Components
    • graphql
      • query
      • mutations

Run client:

Run the following command in client to install requied packages:

yarn or npm install

To start our client run the following command:

yarn start

You client will run on http://localhost:3000

postgres-graphql's People

Contributors

pratikagashe avatar pratik-heady avatar

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.