Grafbase x Hashnode Hackathon
About the hackathon
In August, I participated in the GrafbaseHackathon (the 5th one now).
This time, it's about using the Grafbase tool, a serverless database platform open-source platform to deploy with a GraphQL API to connect.
Please check the hashnode post to get the full info about it.
Links
public repo: https://github.com/leopaul29/grafbase-ogame-clone
Ideas
I wanted to code a POC with grafbase and another frontend framework "Remix" so I took an old project idea I wanted to start with angular 6 months ago and I worked on it.
I wanted to make a small POC of an old game called "Ogame" with just a simple function as an increment building level and create a fleet.
Few links here:
Grafbase to store planets data
About grafbase, it's quite easy to understand cause it looks like planetscale but with a "pathfinder" part to do query and mutation request on database. You can run the pathfinder on local as well. I also used httpie.io instead of postman to make http requests.
Here is the basic schema model I used
type Planet @model {
name: String!
metalMineLevel: Int @default(value: 1)
crystalMineLevel: Int @default(value: 1)
deuteriumMineLevel: Int @default(value: 0)
resources: Resources
fleet: Fleet
owner: User
}
type Resources @model {
metal: Int @default(value: 500)
crystal: Int @default(value: 500)
deuterium: Int @default(value: 100)
}
type Fleet @model {
lightFighterCount: Int @default(value: 0)
}
type User @model {
name: String! @unique
planet: [Planet]
}
I think it would be nice to use the NASA open-data in the game as well and we can link multiple other database with grafbase using connectors.
Remix
About Remix, I wanted to test a React framework cause I like to follow a file structure and for me, with React alone it can be a mess. Also, I'm mainly working with Angular, so it's very strict about routes, components, etc. There are so many things to know about that now I would like up my React skills before using too much React framework.
Conclusion
The most I use serverless databases, the most I like it. Very nice to not have to handle the db anywhere and the API system is perfect for small front web apps.