{"id":16969530,"url":"https://github.com/webmasterdevlin/nextjs-pwa-graphql-js","last_synced_at":"2025-08-13T19:46:46.905Z","repository":{"id":40200714,"uuid":"303338109","full_name":"webmasterdevlin/nextjs-pwa-graphql-js","owner":"webmasterdevlin","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-06T15:15:31.000Z","size":2289,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-11T13:22:10.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"nextjs-pwa-demo3.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webmasterdevlin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-12T09:12:18.000Z","updated_at":"2020-10-14T05:09:00.000Z","dependencies_parsed_at":"2023-02-06T05:46:30.082Z","dependency_job_id":null,"html_url":"https://github.com/webmasterdevlin/nextjs-pwa-graphql-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"tomsoderlund/nextjs-pwa-graphql-sql-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterdevlin%2Fnextjs-pwa-graphql-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterdevlin%2Fnextjs-pwa-graphql-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterdevlin%2Fnextjs-pwa-graphql-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webmasterdevlin%2Fnextjs-pwa-graphql-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webmasterdevlin","download_url":"https://codeload.github.com/webmasterdevlin/nextjs-pwa-graphql-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247363381,"owners_count":20926938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T00:25:34.302Z","updated_at":"2025-04-05T16:25:07.236Z","avatar_url":"https://github.com/webmasterdevlin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js serverless PWA with GraphQL (Apollo) and Postgres SQL boilerplate\n\n## Tutorials\n\n- Nextjs https://www.youtube.com/watch?v=VAEyelMtWp8\n\n![nextjs-pwa-graphql-sql-boilerplate demo on phone](docs/github_preview.jpg)\n\n_Note: this is my v3 boilerplate for React web apps. See also [nextjs-sql-rest-api-boilerplate](https://github.com/tomsoderlund/nextjs-sql-rest-api-boilerplate) and [nextjs-express-mongoose-crudify-boilerplate](https://github.com/tomsoderlund/nextjs-express-mongoose-crudify-boilerplate)._\n\n## Why is this awesome?\n\nThis is a great template for a any project where you want **React (with Hooks)** (with server-side rendering, powered by [Next.js](https://github.com/zeit/next.js)) as frontend and **GraphQL and Postgres SQL** as backend.\n_Lightning fast, all JavaScript._\n\n- Great starting point for a [PWA (Progressive Web App)](https://en.wikipedia.org/wiki/Progressive_web_applications).\n- Both front-end client and GraphQL/SQL server in one project.\n- **NEW: Can be deployed as [serverless functions on Zeit Now](#deploying-serverless-on-zeit-now).**\n- A fast Postgres SQL database server.\n- [GraphQL API](#graphql-client-and-server) with Apollo.\n- React Hooks for business logic.\n- PWA features such as `manifest.json` and offline support (`next-offline`).\n- Easy to style the visual theme using CSS (e.g. using [Design Profile Generator](https://tomsoderlund.github.io/design-profile-generator/)).\n- `sitemap.xml` and `robots.txt` support.\n- Google Analytics and `google-site-verification` support (see `config/config.js`).\n- Flexible configuration with `config/config.js` and `.env` file.\n- Hot reloading with `nodemon`.\n- Unit testing with Jasmine (`yarn unit`).\n- Code linting and formatting with StandardJS (`yarn lint`/`yarn fix`).\n\n## Demo\n\nSee [**nextjs-pwa-graphql-sql-boilerplate** running on Zeit Now here](https://nextjs-pwa-graphql-sql-boilerplate.tomsoderlund.now.sh/).\n\n![nextjs-pwa-graphql-sql-boilerplate demo on phone](docs/demo.jpg)\n\n## How to use\n\nClone this repository:\n\n    git clone https://github.com/tomsoderlund/nextjs-pwa-graphql-sql-boilerplate.git [MY_APP]\n\nRemove the .git folder since you want to create a new repository\n\n    rm -rf .git\n\nInstall dependencies:\n\n    cd [MY_APP]\n    yarn  # or npm install\n\nInstall Postgres and set up the database:\n\n    psql postgres  # Start the Postgres command-line client\n\n    CREATE DATABASE \"nextjs-pwa-graphql-sql\";  -- You can also use \\connect to connect to existing database\n    \\connect \"nextjs-pwa-graphql-sql\";\n    CREATE TABLE article (id serial, title varchar(200), content text);  -- Create a blank table\n    INSERT INTO article (title) VALUES ('The first article');  -- Add example data\n    SELECT * FROM article;  -- Check data exists\n    \\q\n\nConfigure the `.env` file.\n\nStart it by doing the following:\n\n    yarn dev  # or 'yarn now' to run with Zeit Now serverless\n\nIn production:\n\n    yarn build\n    yarn start\n\nIf 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).\n\n### GraphQL client and server\n\nYour GraphQL API server is running at `http://localhost:3003/api/graphql`.\n[Try the GraphQL playground](https://nextjs-pwa-graphql-sql-boilerplate.tomsoderlund.now.sh/api/graphql) on the demo server.\n\n## Deploying\n\nYou can either deploy as a [serverless deployment](https://zeit.co/docs/v2/serverless-functions/introduction/), or as a traditional Express server.\n\nDepending on which deployment you make, some files are unnecessary\\*.\n\n### Deploying serverless (on Zeit Now)\n\nRun in development mode with:\n\n    yarn now\n\nDeploy to Now with:\n\n    yarn deploy\n\n\\*Unnecessary files:\n\n- `apollo-server-express` module\n- `/server` folder\n\n(Shortcut: `yarn remove apollo-server-express; rm -rf server`)\n\n### Deploying as Express server (on Heroku)\n\n    heroku create [MY_APP]\n    heroku addons:create heroku-postgresql:hobby-dev\n    git push heroku master\n\n\\*Unnecessary files:\n\n- `/api` folder\n- `apollo-server-micro` module\n\n(Shortcut: `yarn remove apollo-server-micro; rm -rf api`)\n\n## Modifying the app to your needs\n\n### Change app name\n\nDo search/replace for \"nextjs-pwa-graphql-sql-boilerplate\" AND \"nextjs-pwa-graphql-sql\" to something else.\n\nChange name in `public/manifest.json`\n\n### Renaming “Article” to something else\n\nThe database item is called “Article”, but you probably want something else in your app.\n\nRename the files:\n\n    mkdir graphql/{newName}\n    mv graphql/article/hooks.js graphql/{newName}/hooks.js\n    mv graphql/article/queries.js graphql/{newName}/queries.js\n    mv graphql/article/resolvers.js graphql/{newName}/resolvers.js\n    mv graphql/article/schema.js graphql/{newName}/schema.js\n    rm -r graphql/article\n    mkdir -p components/{newName}s\n    mv components/articles/ArticleList.js components/{newName}s/{NewName}List.js\n    mv components/articles/ArticleListItem.js components/{newName}s/{NewName}ListItem.js\n    mv components/articles/ArticleDetails.js components/{newName}s/{NewName}Details.js\n    rm -r components/articles\n    mkdir pages/{newName}s\n    mv \"pages/articles/[article].js\" \"pages/{newName}s/[{newName}].js\"\n    rm -r pages/articles\n\nThen, do search/replace inside the files for different casing: article, Article, ARTICLE\n\n### Create a new data model/object type\n\n    yarn model  # Creates a new folder graphql/newObject with 4 empty JS files inside\n\n### Change port number\n\nDo search/replace for \"3003\" to something else.\n\n### How to remove/replace SQL database\n\n1. Remove references to `graphql/postgres`\n2. `graphql/article/resolvers.js`: remove “sql\\*” references\n\n### Change visual theme (CSS)\n\n1. Change colors in `public/manifest.json`\n2. Change CSS in `public/app.css`\n3. Change font in `PageHead.js`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmasterdevlin%2Fnextjs-pwa-graphql-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebmasterdevlin%2Fnextjs-pwa-graphql-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebmasterdevlin%2Fnextjs-pwa-graphql-js/lists"}