GraphQL API Server and Prisma ORM project template
This is a fbi project template. If you haven't installed fbi yet, use the following command to install.
$ npm i -g fbi
oryarn global add fbi
fbi v3.0+
node v7.6+
- prisma v1
- apollo-server
- Code generation
$ fbi add https://github.com/fbi-templates/fbi-project-graphql-prisma.git
# Create a project
fbi init graphql-prisma -o
-
start a database service
start a postgres database service:docker pull postgres docker run -p 5432:5432 --name my-postgres -e POSTGRES_PASSWORD=pgpass -d postgres
More info: https://hub.docker.com/_/postgres
-
start database access service:
npm run db:up
-
init database:
- modify
dal/model.graphql
npm i -g prisma && npm run db:init
DOCKER_HOST_IP=docker.for.mac.localhost
in package.json only works on macos.Change
docker.for.mac.localhost
with actual docker IP on other platforms. - modify
-
update datebase:
npm run db:init
-
code generation:
-
Generate database schema, database client code and API schema based on database model:
fbi gd
-
Generate type-safe API resolvers:
fbi ga
-
-
start development server:
fbi s
- Description: Generate database schema, database client code and API schema based on database model.
- Alias:
gd
- Examples:
fbi gd
- Description: Generate type-safe API resolvers.
- Alias:
ga
- Examples:
fbi ga
- Description: Start development server.
- Alias:
s
- Examples:
fbi s
- Description: Build the project for the specified environment.
- Params:
p/prod
{Boolean}
(default) Production environment.t/test
{Boolean}
Test environment.
- Alias:
b
- Examples:
fbi b -t
fbi b -p