Skip to content

melloc01/nextjs-twin-graphql-starter

Repository files navigation

This is a starter for new Next.js projects, easily deployable to vercel, with GraphQL (with codegen!), tailwind (twin.macro) and friends working out of the box.

Note that besides Next.js and twin.macro, all other libraries are easily replaced or taken off.

What is included

VS Code integration

It is important to have some extensions so your intellisense works properly. There are configuration files on the project that makes them work properly.

  • GraphQL (from GraphQL Foundation)
  • Tailwind CSS Intellisense (from Brad Cornes)
  • twin.macro Auto Complete (from Dannis Vash)
  • optional: Tailwind Docs (Austen Cameron)

Getting started

  • Create file .env.local based on .env.example
  • Customize meta tags at: lib/constants.ts@META_TAGS
  • Customize your schema.graphql

Project structure:

├── codegen.yml -- codegen config (https://graphql-code-generator.com/)
├── components
│   ├── AppHead.tsx -- <head /> tag
│   ├── AppWrappers.js
│   ├── GlobalStyles.js -- global styles
│   ├── Header.js -- App Header component
│   └── styled.js -- Some styled components
├── graphql.config.js --  config,
├── lib
│   ├── api
│   │   └── handlers.ts -- common handlers
│   ├── constants.ts -- app constants
│   ├── db
│   │   ├── db.ts -- db wrappers
│   │   └── MenuRepository.ts -- repository
│   ├── graphql
│   │   ├── documents
│   │   │   ├── mutations.graphql
│   │   │   └── query.graphql
│   │   ├── graphqlClient.ts
│   │   ├── resolvers
│   │   │   └── resolvers.ts
│   │   ├── schema.graphql
│   │   └── useGraphqlSub.ts
│   ├── graphql-generated.ts
│   ├── hooks
│   │   └── data-hooks.ts
│   ├── queryClient.ts
│   ├── session.js -- session utils
│   └── socket.js -- websocket utils
├── next.config.js
├── next-env.d.ts
├── package.json
├── pages
│   ├── admin
│   │   └── index.js
│   ├── api
│   │   ├── graphql.ts
│   │   ├── login.js
│   │   └── logout.ts
│   ├── _app.js
│   ├── _document.js
│   ├── index.js
│   ├── login.js
│   └── logout.js
├── public
│   └── favicon.ico
├── README.md
├── __server__socket-io-trial.js
├── tailwind.config.js
├── TODO.md
├── tsconfig.json
├── yarn-error.log
└── yarn.lock

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.js. The page auto-updates as you edit the file.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

Next.js, twin.macro, graphql and react-query starter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published