Can someone who runs a production app on graphcool...
# prisma-whats-new
j
Can someone who runs a production app on graphcool tell me how do you administer your data? Do you use the graphcool console or do you build a custom admin interface for that sole purpose?
m
use console, work fine
j
so you just manually edit strings, integers and etc.? don't you use any kind of "schema" inside a field, like certain formatting?
v
Use console and some custom scripts for importing data from JSON and deleting entities!
j
thanks for your answers guys! anybody wrote a custom admin?
m
i
I’m currently building an admin/CMS side for a large app
But it’s not OSS
I should build an OSS Graphcool CMS 😄
j
@iamclaytonray, @mulyoved thanks!
i
😄
j
just trying to understand how people use gc... been wondering why graphcool and graphCMS are separate products, and if a general need for a unified solution exists.
@iamclaytonray may I ask what type of CMS you're building and why it's not sufficient to use the console here?
i
The biggest reason is that a lot of people will be accessing it to CRUD data but there are plenty of non-technical people who would inevitably not understand using the Console or GraphiQL. I could make people deal with it but I’m nice sometimes 😅
As far as the type of CMS, what do you mean? Like, what is my stack?
j
I understand, I'm just gathering use cases 🙂 since mine would just need a slight enhencement of the console. Do you need gc Users in addition to the CMS you're building or are you using the User entity for the staff?
i
Basically, I’m using interfaces for different User roles that implements the User type. If that User has one of the authorized roles, they are able to sign into the admin/CMS. Otherwise, they’ll get a friendly message saying that they do not have proper authorization
So:
Copy code
type Business implements User {
  businessId: ID!
  ein: String! # Employer Identification Number
}

type Accountant implements User {
  accountantId: ID!
  bookingInfo: String!
}

type Employee implements User {
  employeeId: ID!
  fullTime: Boolean! # Denotes if they are full time employee
}
j
ah okay, I get it, thanks
i
That’s not my actual data model. It’s a super contrived example, though. Basically, in this scenario, I only want
Accountant
and
Business
to access the CMS. They are the only ones allowed to CRUD financial records. To take it further, what if I didn’t want
Accountant
to CRUD other types of documents, such as
Legal
? Well, based on their role, I can easily change authorization levels up a bit
My syntax above may be incorrect, just as an FYI. If you think about implementing something similar, check out the docs 😅
j
maybe you can benefinit from graphCMS, since they're opensourceing atm.
but your use case slightly differs from mine
thanks for the info!
i
I’ve looked into them and decided against using them. But thanks for the recommendation! (They don’t quite meet my requirements) 😄
s
@iamclaytonray could you share what requirements GraphCMS didn't meet for you? I'm also puzzled as to how people manage their content when using Graphcool, surely a company can't rely on coders all the time to publish every little new thing. Is the only way to create an ad-hoc admin interface on top of our app from scratch? Or is there some lib that can help with that?
i
There may libs. I personally haven’t looked. One of the biggest problems I had was the pricing. For example, you pay $99 for 1M operations, yet, I can throw my functions into Lambda/Azure/GCP Functions and get that for free. (For Lambda, I get twice those operations for free.) For this app in specific, it just doesn’t reach the scale that it needs to at the price and power of AWS or GCP. I could write my own implementations that scales much better without the overhead of GraphCMS or any other SaaS company. (This is not an absolute. Stripe is a SaaS company and I’m using them.) Past that, I don’t want users to be able to access models/enums/interfaces/etc. That should only stay in the hands of programmers. Even if someone accidentally changed something in that portion of GraphCMS, that could cause a huge problem. Best to not even have that option available to regular users that are authorized to access the CMS.
I should note, I may use it in the future for small apps. But for medium to large applications, I’m better off building my on infrastructure
s
Good to know, thanks a lot. So I’m back with considering Graphcool, unfortunately from your descriptions it sounds like the only way to manage the creation flow (our meditation courses, audios and videos, articles, etc) is to build things basically from scratch.
i
Yeah, through their abstraction over GraphiQL
But, I’d like to build a CMS that inherits your GraphQL API dynamically to construct the interface
Instead of the other way around where you construct your GraphQL API from the interface. (Which is what GraphCMS does)
s
I wonder how helpful this project can be? https://github.com/sarkistlt/graphql-auto-generating-cms
i
Hmmm… Let me try this out locally. Seems like the online demo is down
Yeah, this looks good
Seriously outdated but I can fork this and upgrade/refactor everything
s
that would be quite amazing, especially if demoed in combination with Graphcool/Prisma 🎉
let me know if/when you progress, not sure I can contribute code but looking forward to share ideas and help if I can
i
What do you think… A hosted-on-your-infrastructure (what I am leaning towards) or a dependency that you can
npm i
or
yarn add
I like bouncing ideas 🙂 (Those are just as much contributions as code, in my opinion)
s
it would be awesome to learn from Netlify CMS, e.g. see what brings the most value to users. For example it's not so trivial to have a smooth authentication system. Netlify CMS offers a way for even non-GitHub users to participate.
it could help to be able to deploy this CMS/admin console as a separate microservice (e.g on Now)
i
That’s what I was thinking. Plus, less bloat in node_modules for performance-critical apps
That’s my fork. Currently, I’m working off of
feat/refactor
. Aside from upgrading deps and code, I’m also refactoring to TypeScript 😄
And no more gulp! 🦜
s
just to know, may I ask why Typescript and e.g not Reason?
i
For starters, I’ve never worked with Reason and I know TypeScript pretty well. Umm… Other than that… Ermm.. No other reason 😂
I could write it in Reason, though
Have you worked with Reason before?
It’d be cool to add support for WASM 😄
s
damn, I can't find the article. It was concluding that Reason was a better choice, especially because of the reason-react bindings which improve a lot upon React itself. Personally I've used neither because was stuck in maintaining an old project. I need to get back into React very soon though to migrate our platform.
i
I definitely agree that the performance gains with Reason are superb! And I’ve been wanting to write some Reason… I just haven’t had a… reason? 😂
s
i think that you avoid the need for a babel transpiler in this case too, so might simplify things a bit
i
True
You may also be interested in a small GraphQL framework I am writing. It’s not public on Github yet but I’ll shoot you a message when I open source it
s
ok 👍 About Typescript vs Reason, please don't take my thoughts too seriously as I've tried neither... in the end there are probably pros/cons to both so if you're already comfortable with TS that's a strong point.
i
Yeah, I’m still going to write it in TypeScript
But I am not opposed to rewriting it in Reason in the future
j
didn't have notifications on for this thread... really interesting points! I thought about using the auto generating cms too. To be honest I come form a wordpress background and with the plugin advanced custom fields you could model and design all data + forms.
I was thinking about the following: since the graphql-files are the source for the schema and underlying DB, why not create a preprocessing step that compiles to graphql-files? Only having "String", "Int" and "Enums" really limits the schema in my opinion. What to you guys think about a custom types like "Password" with validation rules and compiles down to "String!" to the schema... the "pre-schema"(?) could then be used for form/CMS generation
i
I’m writing that as part of my GraphQL framework 🙂
Date, DateTime, Time, Email, etc
j
with the same approach?
i
Well… What you are talking about is Scalar types. They don’t transpile to anything, necessarily, but they are very useful. If you come from a low-level background, they are similar to a
struct
, where you define the structure itself and it becomes a type
In a way, that is. It’s definitely not the same as a
struct
. But for brevity, it’s similar when comparing to Scalars.
And then you can use those Scalars wherever you want within any
.graphql
file
j
so you use custom scalar types in the schema to generate corresponding fields in the auto generated CMS?
haha, just googled and found this: https://github.com/graphcool/prisma/issues/1591
i
@jsvde - I totally forgot about that issue. Going to write up a quick draft now and send it over
I didn’t realize they were already in the docs