GithubHelp home page GithubHelp logo

guicurcio / nextjs-typescript-postgresql-graphql-realtime-chat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wundergraph/nextjs-typescript-postgresql-graphql-realtime-chat

1.0 0.0 0.0 490 KB

WunderGraph Realtime Chat Example using NextJS, TypeScript, PostgreSQL, GraphQL

TypeScript 95.42% Shell 0.09% JavaScript 0.32% CSS 4.17%

nextjs-typescript-postgresql-graphql-realtime-chat's Introduction

WunderGraph Realtime Chat with Server Side Rendering (SSR) & Authentication

WunderGraph Realtime Chat Example using NextJS, TypeScript & PostgreSQL

Do you also hate applications that do complex login flows, loading spinners, etc. before allowing you into their app? Here's a simple solution how we can deliver a much better user experience while keeping the developer experience simple.

This example demonstrates how you can easily build a NextJS application with Server Side Rendering (SSR) and Realtime subscriptions in the client.

When the user is authenticated, the initial page will be rendered server side. Once the client is initialized, it will start a realtime subscription to keep the UI updated.

The example consists of two components, the NextJS service as well as the headless API service. The headless API service handles authentication and API requests. Once authenticated, a cookie is set by the API service. Both NextJS application and headless API service run on the same root domain.

This allows us to "forward" the cookie header from the initial client request from the NextJS getServerSideProps method to the headless API service.

The code that might interest you the most can be found in index.tsx

Features

Features:

  • Authentication
  • Authorization
  • Server Side Rendering
  • Realtime Updates
  • Cross Tab Login/Logout
  • typesafe generated Typescript Client

Prerequisites

Make sure you have docker compose installed. Alternatively, you can use any PostgreSQL database available on localhost.

Getting Started

Install the dependencies and run the example:

yarn global add @wundergraph/wunderctl@latest
yarn
yarn dev

Cleanup

docker-compose rm -v -f

Questions?

Read the Docs.

Join us on Discord!

nextjs-typescript-postgresql-graphql-realtime-chat's People

Contributors

jensneuse avatar

Stargazers

 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.