All Projects → tomsoderlund → Nextjs Pwa Graphql Sql Boilerplate

tomsoderlund / Nextjs Pwa Graphql Sql Boilerplate

Licence: other
Next.js serverless PWA with GraphQL (Apollo) + Postgres SQL boilerplate

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nextjs Pwa Graphql Sql Boilerplate

Space Cloud
Open source Firebase + Heroku to develop, scale and secure serverless apps on Kubernetes
Stars: ✭ 3,323 (+2558.4%)
Mutual labels:  graphql, serverless, postgres
Next Postgres Sequelize
React 16.8.4 + NextJS 8.0.3 + Emotion + Sequelize 5/Postgres + Passport Local Auth + Google App Engine or Heroku Deployment
Stars: ✭ 176 (+40.8%)
Mutual labels:  heroku, postgres, nextjs
Firebase Gcp Examples
🔥 Firebase app architectures, languages, tools & some GCP things! React w Next.js, Svelte w Sapper, Cloud Functions, Cloud Run.
Stars: ✭ 470 (+276%)
Mutual labels:  graphql, serverless, nextjs
Graphql Genie
Simply pass in your GraphQL type defintions and get a fully featured GraphQL API with referential integrity, inverse updates, subscriptions and role based access control that can be used client side or server side.
Stars: ✭ 147 (+17.6%)
Mutual labels:  graphql, serverless, pwa
Graphql Engine Heroku
Blazing fast, instant realtime GraphQL APIs on Postgres with fine grained access control, also trigger webhooks on database events.
Stars: ✭ 188 (+50.4%)
Mutual labels:  graphql, heroku, postgres
Trends
ultra high performance github trending application
Stars: ✭ 450 (+260%)
Mutual labels:  graphql, nextjs, pwa
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+6651.2%)
Mutual labels:  graphql, serverless, heroku
Next Starter
Next.js Starter using GraphQL, MobX (Next.js, TypeScript, Babel, Express.js, Apollo Client, React Apollo, React Apollo Hooks, GraphQL Codegen, MobX, mobx-state-tree, styled-components, next-optimized-images, Serverless Framework, AWS Lambda, Dotenv)
Stars: ✭ 90 (-28%)
Mutual labels:  serverless, nextjs
Meteor Apollo Starter Kit
Meteor, Apollo, React, PWA, Styled-Components boilerplate
Stars: ✭ 91 (-27.2%)
Mutual labels:  graphql, pwa
Onemanager Php
An index & manager of Onedrive based on serverless. Can be deployed to Heroku/Glitch/SCF/FG/FC/CFC/PHP web hosting/VPS.
Stars: ✭ 1,313 (+950.4%)
Mutual labels:  serverless, heroku
Serverless Postgraphql
Serverless GraphQL endpoint for PostgresSQL using AWS, serverless and PostGraphQL
Stars: ✭ 105 (-16%)
Mutual labels:  graphql, serverless
Gank
🦅 Gank api base △ next.js (react&ssr)
Stars: ✭ 122 (-2.4%)
Mutual labels:  nextjs, pwa
Pwa Weather
Minimal Weather PWA: Offline, Push Notification and Web Payments
Stars: ✭ 89 (-28.8%)
Mutual labels:  serverless, pwa
Next Offline
make your Next.js application work offline using service workers via Google's workbox
Stars: ✭ 1,306 (+944.8%)
Mutual labels:  nextjs, pwa
Aws Serverless Airline Booking
Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.
Stars: ✭ 1,290 (+932%)
Mutual labels:  graphql, serverless
Jamstack Ecommerce
A starter project for building performant ECommerce applications with Next.js and React
Stars: ✭ 1,384 (+1007.2%)
Mutual labels:  serverless, nextjs
Placeline Nextjs
HyperTrack Placeline web application sample using NextJS, Ant-Design, Styled-Components, and Heroku
Stars: ✭ 88 (-29.6%)
Mutual labels:  heroku, nextjs
Serverless With Next5 Boilerplate
Serverless.js with Next.js 5 on AWS, powered by the Serverless Framework
Stars: ✭ 100 (-20%)
Mutual labels:  serverless, nextjs
Firebase Functions Graphql Example
GraphQL server running on Cloud Functions for Firebase
Stars: ✭ 107 (-14.4%)
Mutual labels:  graphql, serverless
Laqul
A complete starter kit that allows you create amazing apps that look native thanks to the Quasar Framework. Powered by an API developed in Laravel Framework using the easy GraphQL queries language. And ready to use the Google Firebase features.
Stars: ✭ 110 (-12%)
Mutual labels:  graphql, pwa

Next.js serverless PWA with GraphQL (Apollo) and Postgres SQL boilerplate

nextjs-pwa-graphql-sql-boilerplate demo on phone

Note: this is my v3 boilerplate for React web apps. See also my Firebase and React Hooks boilerplate, Redux + REST + Postgres SQL boilerplate and REST + MongoDB boilerplate.

Support this project

Did you or your company find nextjs-pwa-graphql-sql-boilerplate useful? Please consider giving a small donation, it helps me spend more time on open-source projects:

Support Tom on Ko-Fi.com

Why is this awesome?

This is a great template for a any project where you want React (with Hooks) (with server-side rendering, powered by Next.js) as frontend and GraphQL and Postgres SQL as backend. Lightning fast, all JavaScript.

  • Great starting point for a PWA (Progressive Web App).
  • Both front-end client and GraphQL/SQL server in one project.
  • NEW: Can be deployed as serverless functions on Zeit Now.
  • A fast Postgres SQL database server.
  • GraphQL API with Apollo.
  • React Hooks for business logic.
  • PWA features such as manifest.json and offline support (next-offline).
  • Easy to style the visual theme using CSS (e.g. using Design Profile Generator).
  • sitemap.xml and robots.txt support.
  • Google Analytics and google-site-verification support (see config/config.js).
  • Flexible configuration with config/config.js and .env file.
  • Hot reloading with nodemon.
  • Unit testing with Jasmine (yarn unit).
  • Code linting and formatting with StandardJS (yarn lint/yarn fix).

Demo

See nextjs-pwa-graphql-sql-boilerplate running on Zeit Now here.

nextjs-pwa-graphql-sql-boilerplate demo on phone

How to use

Clone this repository:

git clone https://github.com/tomsoderlund/nextjs-pwa-graphql-sql-boilerplate.git [MY_APP]

Remove the .git folder since you want to create a new repository

rm -rf .git

Install dependencies:

cd [MY_APP]
yarn  # or npm install

Install Postgres and set up the database:

psql postgres  # Start the Postgres command-line client

CREATE DATABASE "nextjs-pwa-graphql-sql";  -- You can also use \connect to connect to existing database
\connect "nextjs-pwa-graphql-sql";
CREATE TABLE article (id serial, title varchar(200), content text);  -- Create a blank table
INSERT INTO article (title) VALUES ('The first article');  -- Add example data
SELECT * FROM article;  -- Check data exists
\q

Configure the .env file.

Start it by doing the following:

yarn dev  # or 'yarn now' to run with Zeit Now serverless

In production:

yarn build
yarn start

If you navigate to http://localhost:3003/ you will see a web page with a list of articles (or an empty list if you haven’t added one).

GraphQL client and server

Your GraphQL API server is running at http://localhost:3003/api/graphql. Try the GraphQL playground on the demo server.

Deploying

You can either deploy as a serverless deployment, or as a traditional Express server.

Depending on which deployment you make, some files are unnecessary*.

Deploying serverless (on Zeit Now)

Run in development mode with:

yarn now

Deploy to Now with:

yarn deploy

*Unnecessary files:

  • apollo-server-express module
  • /server folder

(Shortcut: yarn remove apollo-server-express; rm -rf server)

Deploying as Express server (on Heroku)

heroku create [MY_APP]
heroku addons:create heroku-postgresql:hobby-dev
git push heroku master

*Unnecessary files:

  • /api folder
  • apollo-server-micro module

(Shortcut: yarn remove apollo-server-micro; rm -rf api)

Modifying the app to your needs

Change app name

Do search/replace for "nextjs-pwa-graphql-sql-boilerplate" AND "nextjs-pwa-graphql-sql" to something else.

Change name in public/manifest.json

Renaming “Article” to something else

The database item is called “Article”, but you probably want something else in your app.

Rename the files:

mkdir graphql/{newName}
mv graphql/article/hooks.js graphql/{newName}/hooks.js
mv graphql/article/queries.js graphql/{newName}/queries.js
mv graphql/article/resolvers.js graphql/{newName}/resolvers.js
mv graphql/article/schema.js graphql/{newName}/schema.js
rm -r graphql/article
mkdir -p components/{newName}s
mv components/articles/ArticleList.js components/{newName}s/{NewName}List.js
mv components/articles/ArticleListItem.js components/{newName}s/{NewName}ListItem.js
mv components/articles/ArticleDetails.js components/{newName}s/{NewName}Details.js
rm -r components/articles
mkdir pages/{newName}s
mv "pages/articles/[article].js" "pages/{newName}s/[{newName}].js"
rm -r pages/articles

Then, do search/replace inside the files for different casing: article, Article, ARTICLE

Create a new data model/object type

yarn model  # Creates a new folder graphql/newObject with 4 empty JS files inside

Change port number

Do search/replace for "3003" to something else.

How to remove/replace SQL database

  1. Remove references to graphql/postgres
  2. graphql/article/resolvers.js: remove “sql*” references

Change visual theme (CSS)

  1. Change colors in public/manifest.json
  2. Change CSS in public/app.css
  3. Change font in PageHead.js
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].