当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

starter

授权协议 View license
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 徐卓
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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 emailaddresses you control.

NOTE: every time we merge to master, we ship a new version of GraphileStarter 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 deleteaccount feature baked into the starter.

NOT FOR BEGINNERS

We do not advise that you build your own projects on top of this project untilyou'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 fullstack. The project is called "Starter" because it helps you to start newprojects with all these technologies, tools and techniques already in place. Ifyou're not already familiar with these things then you'll probably find theproject overwhelming, it is not intended to be your first experience of any ofthese tools.

If you're just getting started with PostGraphile, before you dive into thisproject make sure you check out thePostGraphile required knowledgeand especially theschema design tutorial.This repository takes a slightly different approach to schema design than theaforementioned tutorial, but it's still an incredibly valuable resource.

Purpose

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

It is suitable for building projects both large and small, with a focus onproductivity. 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 bescaled to larger audiences both horizontally and vertically with very fewchanges.

Please note that this software is not "complete," free of software defects, orfree of security issues — it is not a "finished" solution, but rather the seedof 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 isnot intended that you can merge updates to this software into your ownderivative 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. Gomake some money, and give something back tosupport us building more tools and kits for the Node, GraphQL and PostgreSQLecosystems. We have made this project available under the simple and liberal MITlicense to give you to a huge amount of freedom in how you use it, but thisisn't possible without the help of our wonderful sponsors.

We need more people to join our sponsors so we can continue to bring aboutawesome 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 ─ pleasesponsor 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 andReact project, with server-side rendering (SSR) androuting thanks to Next.js. The backend is a beautifulpairing of Node.js and PostgreSQL running on Express.js, enabled byPostGraphile in library mode. Thefrontend uses the AntD design framework to acceleratedevelopment. The entire stack is written in TypeScript, with auto-generatedGraphQL types and operations thanks tographql-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 aspossible.

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

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

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

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

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

Variants

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

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

Prerequisites

You can either work with this project locally (directly on your machine) or usea pre-configured Docker environment. We'll differentiate this in the README witha 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 withproduction.Docker is absolutely fine.)

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

For users of Visual Studio Code (VSCode), a .vscode folder is included witheditor settings and debugger settings provided, plus a list of recommendedextensions. Should you need it, there is also a .devcontainer folder whichenables you to useVSCode's remote containersgiving you a local-like development experience whilst still using dockercontainers.

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 abash environment.

Windows users: making a project like Graphile Starter run smoothly onWindows can be a challenge; @JoeSchr and @hips on theGraphile Discord have been working in improvingthis and they're pretty pleased with the result, but you may still get someteething problems. PRs to fix Windows compatibility issues are welcome (pleasekeep 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 morerecommended
    • (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 yarninstalled, you can install it with npm install -g yarn. The Docker setupalready 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 filefor you containing your secrets.

NOTE: export UID is really important on Linux Docker hosts, otherwise thefiles and folders created by Docker will end up owned by root, which isnon-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 athttp://localhost:5678

This main command runs a number of tasks:

  • uses graphile-migrate to watchthemigrations/current.sql file for changes, and automatically runs itagainst 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 thecompiled 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 andgenerates your TypeScript React hooks for you automatically, leading tostrongly typed code with minimal effort
  • runs the jest tests in watch mode, automatically re-running as the databaseor test files change

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

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

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

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

To shut everything down:

Local mode OR Docker mode
Ctrl-c or export UID; yarn docker down

Making it yours

  1. Download and extract a zip ofthe latest release from GitHub
  2. In that folder run:
    • git init
    • git add .
    • git commit -m "Graphile Starter base"
  3. Change the project name in package.json
  4. Change the project settings in @app/config/src/index.ts
  5. Replace the README.md file
  6. Add your own copyright notices to the LICENSE.md file
  7. Commit as you usually would
  8. Show your appreciation with sponsorship

Docker development

Be sure to read docker/README.md.

Building the production docker image

To build the production image, use docker build as shown below. You shouldsupply the ROOT_URL build variable (which will be baked into the client code,so cannot be changed as envvars); if you don't then the defaults will apply(which likely will not be suitable).

To build the worker, pass TARGET="worker" instead of the defaultTARGET="server".

docker build \
  --file production.Dockerfile \
  --build-arg ROOT_URL="http://localhost:5678" \
  --build-arg TARGET="server" \
  .

When you run the image you must pass it the relevant environmental variables,for example:

docker run --rm -it --init -p 5678:5678 \
  -e GRAPHILE_LICENSE="$GRAPHILE_LICENSE" \
  -e SECRET="$SECRET" \
  -e JWT_SECRET="$JWT_SECRET" \
  -e DATABASE_VISITOR="$DATABASE_VISITOR" \
  -e DATABASE_URL="$DATABASE_URL" \
  -e AUTH_DATABASE_URL="$AUTH_DATABASE_URL" \
  -e GITHUB_KEY="$GITHUB_KEY" \
  -e GITHUB_SECRET="$GITHUB_SECRET" \
  docker-image-id-here

Currently if you miss required envvars weird things will happen; we don'tcurrently have environment validation (PRs welcome!).

Note: If you are using the production.Dockerfile to run graphile/starter in aDocker container on eg. Kubernetes, AWS ECS, DigitalOcean App Platform (orsimilar) and you are trying to connect to Amazon RDS or DigitalOcean databases(or probably other managed databases), make sure to replace/data/amazon-rds-ca-cert.pem with the CA certificate of your own database.This file is copied into your Docker image during build time and can thereforebe referenced in your env variables DATABASE_URL and AUTH_DATABASE_URL:
DATABASE_URL="postgres://name:password@host:port/dbname?ssl=true&sslrootcert=/app/data/amazon-rds-ca-cert.pem"

Production build for local mode

Use yarn run build to generate a production build of the project

Deploying to Heroku

Prerequisites:

If you are using graphile-migrate make sure that you have executedgraphile-migrate commit to commit all your database changes, since we only runcommitted migrations in production.

Make sure you have customized @app/config/src/index.ts.

Make sure everything is committed and pushed in git.

Set up a database server; we recommend using Amazon RDS.

Once your database server is running, you can use our heroku-setup script toautomate the setup process. This script does the following:

  • Creates the Heroku app
  • Adds the redis extension to this Heroku app
  • Creates the database in the database server
  • Creates the relevant roles, generating random passwords for them
  • Installs some common database extensions
  • Sets the Heroku config variables
  • Adds the Heroku app as a git remote named 'Heroku'
  • Pushes the 'master' branch to Heroku to perform your initial build

Create a copy of heroku-setup.template and rename the copy to heroku-setup,then edit it and customize the settings at the top. We also recommend readingthrough the script and customizing it as you see fit - particularly if you areusing additional extensions that need installing.

Now run the script:

bash heroku-setup

Hopefully all has gone well. If not, step through the remaining tasks in theHeroku-setup script and fix each task as you go. We've designed the script sothat if your superuser credentials are wrong, or the Heroku app already exists,you can just edit the settings and try again. All other errors will probablyneed manual intervention. Verbosity is high so you can track exactly whathappened.

The server should be up and running now (be sure to access it over HTTPSotherwise you will not be able to run GraphQL queries), but it is not yetcapable of sending emails. To achieve this, you must configure an emailtransport. We have pre-configured support for Amazon SES. Once SES is set up,your domain is verified, and you've verified any emails you wish to send emailto (or have had your sending limits removed), make sure that the fromEmail in@app/config/src/index.ts is correct, and then create an IAM role for yourPostGraphile server. Here's an IAM template for sending emails - this is theonly permission required for our IAM role currently, but you may wish to addothers later.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ses:SendRawEmail",
            "Resource": "*"
        }
    ]
}

Generate an Access Key for this IAM role, and then tell Heroku the access key idand secret:

heroku config:set AWS_ACCESS_KEY_ID="..." AWS_SECRET_ACCESS_KEY="..." -a $APP_NAME

Now you can tell Heroku to run the worker process as well as the currentlyrunning 'web' process:

heroku ps:scale worker=1 -a $APP_NAME

When you register an account on the server you should receive a verificationemail containing a clickable link. When you click the link your email will beverified and thanks to GraphQL subscriptions the previous tab should be updatedto reflect that your account is now verified.

You can also configure your application for social login. This works the same asin development except the callback URL will be different, something likehttps://MY_HEROKU_APP_NAME.herokuapp.com/auth/github/callback. Set the GitHubOAuth secrets on your Heroku app to trigger a restart and enable social login:

heroku config:set GITHUB_KEY="..." GITHUB_SECRET="..." -a $APP_NAME

Cleanup

To delete the Heroku app:

heroku apps:destroy -a $APP_NAME

To delete the database/roles (replace dbname with your database name):

drop database dbname;
drop role dbname_visitor;
drop role dbname_authenticator;
drop role dbname;

Custom packages

When running yarn setup, this command will also invoke lerna run setup. Thisallows you to add custom setup hooks necessary for your individual packages.

Add a line like the following to your scripts section in your package.json:

"setup": "npm i -g some-package"

MIT License

This is open source software; you may use, modify and distribute it under theterms of the MIT License, seeGRAPHILE_STARTER_LICENSE.md.

  • Spring Boot的启动器Starter详解 作者:chszs,未经博主允许不得转载。经许可的转载需注明作者和博客主页:http://blog.csdn.net/chszs Spring Boot应用启动器基本的一共有44种,具体如下: 1)spring-boot-starter 这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。 2)spring-boot-starte

 相关资料
  • 问题内容: 在Spring Boot中,模式上有一些jar 。所有这些罐子都不包含任何包装。它们有什么用? 在Maven POM中,添加了以下依赖项: org.springframework.boot:spring-boot-starter-web org.springframework.boot:spring-boot-starter-actuator org.springframework.b

  • 问题内容: 这是我的 pom.xml 这条线引起问题。 项目构建错误:com.skm:MyApps:0.0.1-SNAPSHOT的不可解析的父POM:无法从https:/转移org.springframework.boot:spring- boot-starter-parent:pom:2.0.2.RELEASE /repo.maven.apache.org/maven2已缓存在本地存储库中,直到

  • 问题内容: 我试图将@NotNull约束添加到我的Person对象中,但是我仍然可以@POST具有空电子邮件的新Person。我在MongoDB上使用Spring Boot Rest。 实体类: 存储库类: 应用类别: pom.xml 当我通过邮递员@POST一个新对象时,例如: 我仍然使用此有效负载创建: 问题答案: 我遇到了同样的问题,但是仅启用验证对我而言不起作用,这确实与JPA和Mongo

  • 问题内容: 我试图在我的appsettings.json文件中写入连接字符串,并将其带入我的启动文件中,但我不断得到一个Value不能为null。参数名称:connectionString。我一直在使用各种示例,但似乎看不到带有ASP.NET 1.0 Core启动类的新设置。 Appsetting.json文件: 尝试Startup.cs的方法 问题答案: 首先, 与在Visual Studio中

  • 主要内容:starter,spring-boot-starter-parent传统的 Spring 项目想要运行,不仅需要导入各种依赖,还要对各种 XML 配置文件进行配置,十分繁琐,但 Spring Boot 项目在创建完成后,即使不编写任何代码,不进行任何配置也能够直接运行,这都要归功于 Spring Boot 的 starter 机制。本节我们将对 stater 进行介绍。 starter Spring Boot 将日常企业应用研发中的各种场景都抽取出来,做成一个个的

  • 主要内容:Spring Boot Web 快速开发,示例 Spring MVC 是 Spring 提供的一个基于 MVC 设计模式的轻量级 Web 开发框架,其本身就是 Spring 框架的一部分,可以与 Spring 无缝集成,性能方面具有先天的优越性,是当今业界最主流的 Web 开发框架之一。   Spring Boot 是在 Spring 的基础上创建一款开源框架,它提供了 spring-boot-starter-web(Web 场景启动器) 来为

  • 我是新来spring的,所以如果你们中的任何人能在这方面帮助我,我将非常感激。我添加了一个spring-boot-starter-security的依赖项,其当前版本为2.2.6.release,我的父版本也有相同的版本。但还是有个错误- 未找到依赖项“org.springframework.boot:spring-boot-starter-security:2.2.6.release”。标记名称

  • 我已经克隆了flatterrepo并安装了androidsdk命令行工具,在中进行了设置。然后,我通过将设置为使意识到的安装。通过