Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Roadmap of Canner v3.0 #141

Closed
25 tasks done
abz53378 opened this issue Jan 25, 2019 · 6 comments
Closed
25 tasks done

Roadmap of Canner v3.0 #141

abz53378 opened this issue Jan 25, 2019 · 6 comments

Comments

@abz53378
Copy link
Contributor

abz53378 commented Jan 25, 2019

The integration of Canner and GQLify

In @canner/cli@2.x version, we focused on how to create the CMS on our platform. So, there are just two major commands, script:server and script:deploy for users to preview and deploy their schema to our platform. Most of data connectors and config files are also designed for the platform. But we found the most developers care about how to self-host their CMSes.

So we create the project https://github.com/Canner/gqlify which is used to create a GraphQL server just with the data model and data sources.

GQLify examples basic example

const { Gqlify, MemoryDataSource } = require('@gqlify/server')
const { ApolloServer } = require('apollo-server');
const { readFileSync } = require('fs');

// Read datamodel
const sdl = readFileSync(__dirname + '/demo.graphql', { encoding: 'utf8' });

// mock default data
const defaultData = {
users: [
{id: '1', username: 'Alice', email: 'alice@gmail.com'},
{id: '2', username: 'Bob', email: 'bob@gmail.io'},
],
books: [
{id: '1', name: 'book1', userId: '1'},
{id: '2', name: 'book2', userId: '2'},
],
};

// construct gqlify
const gqlify = new Gqlify({
// provide datamodel to gqlify
sdl,

// provide data-sources map to GQLify,
// so GQLify would know how to create data-source for each model
dataSources: {
memory: args => new MemoryDataSource(defaultData[args.key]),
},
});

// GQLify will provide GraphQL apis & resolvers to apollo-server
const server = new ApolloServer(gqlify.createApolloConfig());

// start server
server.listen().then(({ url }) => {
console.log(🚀 Server ready at ${url});
});


demo.graphql


type User @GQLifyModel(dataSource: "memory", key: "users") {
  id: ID! @unique @autoGen # auto generate unique id
  username: String!
  email: String
  books: [Book!]! # User-Book: one-to-many
}

type Book @GQLifyModel(dataSource: "memory", key: "books") {
  id: ID! @unique @autoGen # auto generate unique id
  name: String!
  author: User!
}

To integrate Canner and GQLify, we transform Canner schema to GQLify data model, so that we can run the server with GQLify. And Canner only needs to know what is the endpoint of the graphQL server, not the Apollo connector. This makes the whole structure more clear and simple.

2019-01-25 11 24 22

CLI commands

To support the self-hosting, we rename most commands to be more clear.

Common

  • canner init - Initialize canner.schema.js, schema/*.schema.js, one of canner.server.js and canner.cloud.js
    • --only-schema, -s
    • --only-cloud, -c
    • --only-server, -S

OSS (self-hosting)

  • canner start - build the cms and run the GrapQL server
  • canner start:cms - run the cms server
    • build statics + serve statics
  • canner start:graphql - run the GrapQL server
  • canner start:auth - run the cms and run the GrapQL server

Cloud

  • canner cloud:signup
  • canner cloud:login
  • canner cloud:logout
  • canner cloud:deploy - Deploy the schemas and the server to Canner platform
  • canner cloud:preview - Run webpack-dev-server for developers to develop quick
  • canner cloud:whoami
  • canner cloud:dashboard
  • canner cloud:init - Intialize the project, the combination of canner app:use and canner init
  • canner app:use - Select one app on Canner, create the .cannerrc in project root
    • --app-name <app-name> - Specify the app
  • canner app:create - Create one app on Canner, create the .cannerrc in project root
    • --app-name <app-name>- The app name
  • canner app:list

The configuration files

  • canner.server.js for OSS
  • canner.cloud.js for Cloud

OSS modules

Cms server

Serving static files built from canner-bundle and render the whole cms view.

  • integration with GQLify
  • integration with auth server

Auth server

Authentication server implementing openid-connect.

  • follow basic openid-connect spec
  • login with username/password

GQLify server

  • integration with Canner Schema
  • integration with auth server -> authentication in apollo context

Others

  • Docs

Feedback

We are now fully working on this, and the first release will be published around February 2, welcome to try the new feature and give us some feedback, thanks!

@wwwy3y3 wwwy3y3 changed the title Roadmap of @canner/cli@3.0 Roadmap of Canner v3.0 Jan 25, 2019
@steurt
Copy link

steurt commented Feb 1, 2019

Looking forward to this! Want to start using Canner and use it as OSS (self-hosting) on firebase hosting (and firestore). Hearing that Canner v3.0 will be more focussed on OSS is great. Want to experiment with Canner, but I think I'll wait for the first v3.0 release (tomorrow?).

@MaksimKlepikov
Copy link

I hope you are fine. Can't wait to try v3 with prisma as self hosting

@wwwy3y3
Copy link
Contributor

wwwy3y3 commented Feb 8, 2019

Hi @steurt @kevrat

Our Canner v3 is released!

Check out our blog to see what's new: https://www.cannercms.com/blog/2019/02/07/canner-v3

Another thing is that Prisma will require more time to be integrated into our v3 framework. We'll get to that really soon.

@MaksimKlepikov
Copy link

Nice work! Hope to try it with prisma soon

@no-1ne
Copy link

no-1ne commented Feb 8, 2019

Kudos for thinking about greater good and making canner v3 self hosting friendly,

Wih firebase auth and firestore it really is significant asset for anyone

Cheers from India :)

@johhansantana
Copy link

Awesome work! I was trying to set it up with firestore but ran into some trouble:
https://spectrum.chat/?t=44268817-8232-41b2-a5a8-e86e2357bacd

It worked perfectly with realtime database from firebase though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants