MCPcopy
hub / github.com/graphile/starter

github.com/graphile/starter @v4.1.0 sqlite

repository ↗ · DeepWiki ↗ · release v4.1.0 ↗
270 symbols 760 edges 151 files 1 documented · 0%
README

Graphile Starter

Take it for a spin!

We're running the starter at:

https://graphile-starter.herokuapp.com

Feel free to register an account and have a poke around as you see fit.

NOTE: emails are sent from Graphile Starter, so please only enter email addresses you control.

NOTE: every time we merge to master, we ship a new version of Graphile Starter to Heroku and entirely wipe the database, so your data may not persist. If you wish to delete your data before this time you can do so via the delete account feature baked into the starter.

NOT FOR BEGINNERS

We do not advise that you build your own projects on top of this project until you're comfortable with the various tools it uses (Node.js, Express, PostgreSQL, GraphQL, PostGraphile, Graphile Worker, Graphile Migrate, TypeScript, React, Apollo Client for React, GraphQL Code Generator, ESLint, Prettier, Jest, Cypress, etc).

This is an advanced project with deeply integrated tooling across the full stack. The project is called "Starter" because it helps you to start new projects with all these technologies, tools and techniques already in place. If you're not already familiar with these things then you'll probably find the project overwhelming, it is not intended to be your first experience of any of these tools.

If you're just getting started with PostGraphile, before you dive into this project make sure you check out the PostGraphile required knowledge and especially the schema design tutorial. This repository takes a slightly different approach to schema design than the aforementioned tutorial, but it's still an incredibly valuable resource.

Purpose

Graphile Starter is an opinionated quick-start project for full-stack application development in React, Node.js, GraphQL and PostgreSQL. It includes the foundations of a modern web application, with a full user registration system, organizations (e.g. teams/companies/etc), session management, optimized job queue, a significant amount of pre-configured tooling, tests (both end-to-end and more granular) and much more.

It is suitable for building projects both large and small, with a focus on productivity. You might use it:

  • to go from conception to launch of a web app during a hack day
  • as the foundation for client projects at your web agency
  • to build your side-hustle without spending lots of time on boilerplate
  • to build a SaaS project to help fund your open source work 😉

However you use it, the project can be deployed to many platforms, and can be scaled to larger audiences both horizontally and vertically with very few changes.

Please note that this software is not "complete," free of software defects, or free of security issues — it is not a "finished" solution, but rather the seed of a solution which you should review, customize, fix, and develop further.

It is intended that you use a "point in time" version of this software ─ it is not intended that you can merge updates to this software into your own derivative in an automated fashion.

Crowd-funded open-source software

PLEASE DONATE.

Take this software and use it as the starting point to build your project. Go make some money, and give something back to support us building more tools and kits for the Node, GraphQL and PostgreSQL ecosystems. We have made this project available under the simple and liberal MIT license to give you to a huge amount of freedom in how you use it, but this isn't possible without the help of our wonderful sponsors.

We need more people to join our sponsors so we can continue to bring about awesome projects like this. We'd love to spend more time on open source, building tools that will save you and others even more time and money ─ please sponsor our open source efforts:

Click here to find out more about sponsors and sponsorship.

And please give some love to our featured sponsors 🤩:

Chad Furman Chad Furman * Storyscript Storyscript * Postlight Postlight * Surge.io Surge.io *

* Sponsors the entire Graphile suite

Table of contents

Features

Graphile Starter is a full-stack GraphQL and React project, with server-side rendering (SSR) and routing thanks to Next.js. The backend is a beautiful pairing of Node.js and PostgreSQL running on Express.js, enabled by PostGraphile in library mode. The frontend uses the AntD design framework to accelerate development. The entire stack is written in TypeScript, with auto-generated GraphQL types and operations thanks to graphql-code-generator.

There are four tenets to Graphile Starter:

  • Speedy development
  • Batteries included
  • Type safety
  • Best practices

Graphile Starter is easy to start and everything is pre-configured as much as possible.

Speedy development: hot reloading, easy debugging, Graphile's idempotent migration system, job queue and server middleware ready to use; not to mention deep integration with VSCode should you use that editor: plugin recommendations, pre-configured settings, ESLint and Prettier integration and debugging profiles

Batteries included: full user system and OAuth, AntD design framework, Jest and Cypress end-to-end testing, security, email templating and transport, pre-configured linting and code formatting, deployment instructions, and more

Type safety: pre-configured type checking, strongly typed throughout with TypeScript

Best practices: React, GraphQL, PostGraphile, Node, Jest and Cypress best practices

See TECHNICAL_DECISIONS.md for a more detailed list of features included and the technical decisions behind them.

Variants

Since this is a highly opinionated starter; community members may have slightly different opinions and may choose to maintain forks of this project that apply their own opinions. A few of these are listed below; if you maintain a fork of this project please make a note at the top of your own README, and add it to this list:

VARIANTS ARE NOT OFFICIALLY SUPPORTED and may become out of date or unmaintained over time. If you have issues with variants, please submit issues or PRs to the projects in question, not to this project.

Prerequisites

You can either work with this project locally (directly on your machine) or use a pre-configured Docker environment. We'll differentiate this in the README with a table like this one:

Local mode OR Docker mode
command for local development or command for docker-compose development

Be careful not to mix and match Docker-mode vs local-mode for development. You should make a choice and stick to it. (Developing locally but deploying with production.Docker is absolutely fine.)

IMPORTANT: If you choose the Docker mode, be sure to read docker/README.md.

For users of Visual Studio Code (VSCode), a .vscode folder is included with editor settings and debugger settings provided, plus a list of recommended extensions. Should you need it, there is also a .devcontainer folder which enables you to use VSCode's remote containers giving you a local-like development experience whilst still using docker containers.

Local development

Requires:

  • Node.js v14+ must be installed
  • PostgreSQL v10+ server must be available
  • pg_dump command must be available (or you can remove this functionality)
  • VSCode is recommended, but any editor will do

This software has been developed under Mac and Linux, and should work in a bash environment.

Windows users: making a project like Graphile Starter run smoothly on Windows can be a challenge; @JoeSchr and @hips on the Graphile Discord have been working in improving this and they're pretty pleased with the result, but you may still get some teething problems. PRs to fix Windows compatibility issues are welcome (please keep them small!) Failing that, try the Docker mode :)

Docker development

Requires:

  • docker
  • docker-compose
  • Ensure you've allocated Docker at least 4GB of RAM; significantly more recommended
  • (Development only, production is much more efficient)

Has been tested on Windows and Linux (Ubuntu 18.04LTS).

Getting started

This project is designed to work with yarn. If you don't have yarn installed, you can install it with npm install -g yarn. The Docker setup already has yarn & npm installed and configured.

To get started, please run:

Local mode OR Docker mode
yarn setup or export UID; yarn docker setup

This command will lead you through the necessary steps, and create a .env file for you containing your secrets.

NOTE: export UID is really important on Linux Docker hosts, otherwise the files and folders created by Docker will end up owned by root, which is non-optimal. We recommend adding export UID to your ~/.profile or ~/.bashrc or similar so you don't have to remember it.

Do not commit .env to version control!

Running

You can bring up the stack with:

Local mode OR Docker mode
yarn start or export UID; yarn docker start

After a short period you should be able to load the application at http://localhost:5678

This main command runs a number of tasks:

  • uses graphile-migrate to watch themigrations/current.sql file for changes, and automatically runs it against your database when it changes
  • watches the TypeScript source code of the server, and compiles it from @app/*/src to @app/*/dist so node/graphile-worker/etc. can run the compiled code directly
  • runs the node server (includes PostGraphile and Next.js middleware)
  • runs graphile-worker to execute your tasks (e.g. sending emails)
  • watches your GraphQL files and your PostGraphile schema for changes and generates your TypeScript React hooks for you automatically, leading to strongly typed code with minimal effort
  • runs the jest tests in watch mode, automatically re-running as the database or test files change

NOTE: docker-compose up server also runs the PostgreSQL server that the system connects to.

You may also choose to develop locally, but use the PostgreSQL server via docker-compose up -d db.

Then for development you may need a console; you can open one with:

| Local mode | OR | Docker

Extension points exported contracts — how you extend this code

IProps (Interface)
(no doc)
@app/client/src/pages/reset.tsx
FourOhFourProps (Interface)
(no doc)
@app/components/src/FourOhFour.tsx
GraphileApolloLinkInterface (Interface)
(no doc)
@app/lib/src/GraphileApolloLink.ts
UserEmailsSendVerificationPayload (Interface)
(no doc)
@app/worker/src/tasks/user_emails__send_verification.ts
DbSession (Interface)
(no doc)
@app/server/src/middleware/installPassportStrategy.ts
Chainable (Interface)
(no doc)
@app/e2e/cypress/support/commands.ts
RegisterProps (Interface)
(no doc)
@app/client/src/pages/register.tsx
PageSpec (Interface)
(no doc)
@app/components/src/SettingsLayout.tsx

Core symbols most depended-on inside this repo

add
called by 18
scripts/lib/dotenv.js
getCodeFromError
called by 14
@app/lib/src/errors.ts
runSync
called by 9
scripts/lib/run.js
extractError
called by 9
@app/lib/src/errors.ts
login
called by 9
@app/server/src/middleware/installPostGraphile.ts
safeRandomString
called by 5
scripts/lib/random.js
page
called by 5
@app/components/src/SettingsLayout.tsx
getWebsocketMiddlewares
called by 5
@app/server/src/app.ts

Shape

Function 197
Interface 53
Method 9
Class 8
Enum 3

Languages

TypeScript100%

Modules by API surface

@app/db/__tests__/helpers.ts20 symbols
@app/server/src/middleware/installPostGraphile.ts9 symbols
@app/server/__tests__/helpers.ts7 symbols
@app/lib/src/withApollo.tsx7 symbols
@app/components/src/SharedLayout.tsx7 symbols
@app/__tests__/helpers.ts7 symbols
@app/server/src/middleware/installCypressServerCommand.ts6 symbols
@app/client/src/pages/o/[slug]/settings/members.tsx6 symbols
@app/client/src/pages/login.tsx6 symbols
@app/client/src/pages/_error.tsx6 symbols
@app/server/src/shutdownActions.ts5 symbols
@app/lib/src/GraphileApolloLink.ts5 symbols

Dependencies from manifests, versioned

@ant-design/icons4.6.2 · 1×
@apollo/client3.3.19 · 1×
@app/client0.0.0 · 1×
@app/components0.0.0 · 1×
@app/config0.0.0 · 1×
@app/graphql0.0.0 · 1×
@app/lib0.0.0 · 1×
@babel/core7.14.3 · 1×
@babel/preset-env7.14.2 · 1×
@babel/preset-typescript7.13.0 · 1×
@cypress/webpack-preprocessor5.5.0 · 1×
@graphile-contrib/pg-simplify-inflector6.0.0 · 1×

Datastores touched

dbnameDatabase · 1 repos
postgresDatabase · 1 repos

For agents

$ claude mcp add starter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact